aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/LiteralSupport.cpp
AgeCommit message (Collapse)Author
2009-10-08This fixes support for complex literals, reworked to avoid a goto, andMike Stump
to add a flag noting the presence of a Microsoft extension suffix (i8, i16, i32, i64). Patch by John Thompson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16Update lexer to work with the new APFloat string parsing.Erick Tryzelaar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29CharLiteralParser::IsMultiChar was sometimes uninitialized.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Fix the buildAlisdair Meredith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75627 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10PR4353: Add support for \E as a character escape.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73153 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05Move CharIsSigned from TargetInfo to LangOptions.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-01PR4283: Don't truncate multibyte character constants in the Eli Friedman
preprocessor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Implement -Wfour-char-constants, which is an extension, not an extwarn,Chris Lattner
and apparently not part of -Wall git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28implement -WmulticharChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Get rid of some useless uses of NoExtensions. The philosophy here is Eli Friedman
that if we're going to print an extension warning anyway, there's no point to changing behavior based on NoExtensions: it will only make error recovery worse. Note that this doesn't cause any behavior change because NoExtensions isn't used by the current front-end. I'm still considering what to do about the remaining use of NoExtensions in IdentifierTable.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Use an APInt of target int size to detect overflow while parsing multichars.Sanjiv Gupta
So 'abc' on i16 platforms will warn but not on i32 platforms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14temporarily revert r69046Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69054 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14Literal value calculation isn't likely to overflow on targets having int as ↵Sanjiv Gupta
32 or less. Fixing the assert as it otherwise triggers for PIC16 which as i16 as int. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01ProcessUCNEscape(): Incorportate some feedback from Chris.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01Fix pascal string support; testcase from mailing list message.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31Incorporate feedback from Eli.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Implement UCN support for C string literals (C99 6.4.3) and add some very ↵Steve Naroff
basic tests. Chris Goller has graciously offered to write some test to help validate UCN support. From a front-end perspective, I believe this code should work for ObjC @-strings. At the moment, I believe we need to tweak the code generation for @-strings (which doesn't appear to handle them). Will be investigating. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26fix some sema problems with wide strings and hook up basic codegen for them.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Next step toward making string diagnostics correct: handleChris Lattner
escapes in the string for subtoken positioning. This gives us working examples like: t.m:5:16: warning: field width should have type 'int', but argument has type 'unsigned int' printf("\n\n%*d", (unsigned) 1, 1); ^ ~~~~~~~~~~~~ where before the caret pointed two spaces to the left. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29move library-specific diagnostic headers into library private dirs. ReduceChris Lattner
redundant #includes. Patch by Anders Johnsen! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27Split the single monolithic DiagnosticKinds.def file into oneChris Lattner
.def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16minor cleanups to StringLiteralParser: no need to pass target infoChris Lattner
into its ctor. Also, make it handle validity checking of pascal strings instead of making clients do it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22Fix a weird inconsistency with hex floats. Previously the lexer Chris Lattner
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept it when extensions are on. This caused strangeness and failures when hexfloats were properly treated as an extension (not error) in LiteralSupport. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22remove the NumericLiteralParser::Diag helper method, inlining it intoChris Lattner
its call sites. This makes it more explicit when the hasError flag is getting set and removes a confusing difference in behavior between PP.Diag and Diag in this code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18Remove the last of the old-style Preprocessor::Diag methods.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16Speed up NumericLiteralParser::GetIntegerValue.Daniel Dunbar
- Implement fast path when value easily fits in a uint64. - ~6x faster, translates to 1-2% on Cocoa.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30Document assumptions that NumericLiteralParser makes with an assertion.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29Fix the root cause of PR2750 instead of the side effect.Chris Lattner
NumericLiteral parser is not careful about overrun because it should never be possible. It implicitly expects that its input matched the regex for pp-constant. Because of this, it knows it can't be pointing to a prefix of something that looks like a number. This is all fine, except that __LINE__ does not prevent implicit concatenation from happening. Fix __LINE__ to not do this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02Fix for PR2750; don't check for an 'e' in the trash after the token.Eli Friedman
Note that this isn't really a complete fix; I think there are other potential overrun situations. I don't really know what the best systematic fix is, though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11More #include cleaningDaniel Dunbar
- Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25In c89 mode accept hex fp constants as an extension:Chris Lattner
t2.c:1:17: warning: hexadecimal floating constants are a C99 feature long double d = 0x0.0000003ffffffff00000p-16357L; ^ instead of emitting a weird error message that doesn't make sense: t2.c:1:41: error: hexadecimal floating constants require an exponent long double d = 0x0.0000003ffffffff00000p-16357L; ^ rdar://6096838 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30Fix a bug reported by Kelly Wilson, where we incorrectlyChris Lattner
rejected FP immediates like 08.123 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30refactor some code out into a new method.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20for exponent-related errors, emit the diagnostic on the 'e' or 'p'.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20when emitting diagnostics about some character in a numericChris Lattner
literal, indicate what character the error is about or where it would be. For example: pr2241.c:1:17: error: exponent has no digits float f[] = { 1e , 1ee0 }; ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04Support MS-specific integer suffixes (i8, i16, i32, i64, i128).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8