summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Add a new mode to the lexer which enables it to return all characters,Chris Lattner2008-10-121-15/+49
| | | | | | | | | | | | | | | | | | | | | | | | even whitespace, as tokens from the file. This is enabled with L->SetKeepWhitespaceMode(true) on a raw lexer. In this mode, you too can use clang as a really complex version of 'cat' with code like this: Lexer RawLex(SourceLocation::getFileLoc(SM.getMainFileID(), 0), PP.getLangOptions(), File.first, File.second); RawLex.SetKeepWhitespaceMode(true); Token RawTok; RawLex.LexFromRawLexer(RawTok); while (RawTok.isNot(tok::eof)) { std::cout << PP.getSpelling(RawTok); RawLex.LexFromRawLexer(RawTok); } This will emit exactly the input file, with no canonicalization or other translation. Realistic clients actually do something with the tokens of course :) llvm-svn: 57401
* Stop the preprocessor from poking the lexer's private parts.Chris Lattner2008-10-121-6/+6
| | | | llvm-svn: 57399
* Fix a couple more places that poke KeepCommentMode unnecesarily. Chris Lattner2008-10-121-3/+4
| | | | llvm-svn: 57398
* add a new inKeepCommentMode() accessor to abstract the KeepCommentModeChris Lattner2008-10-121-4/+4
| | | | | | ivar. llvm-svn: 57397
* fix misleading comment.Chris Lattner2008-10-121-1/+1
| | | | llvm-svn: 57396
* Simplify raw mode lexing by treating an unterminate /**/ comment theChris Lattner2008-10-122-8/+5
| | | | | | | | same we we do an unterminated string or character literal. This makes it so we can guarantee that the lexer never calls into the preprocessor (which would be suicide for a raw lexer). llvm-svn: 57395
* add a comment.Chris Lattner2008-10-121-0/+2
| | | | llvm-svn: 57394
* Change how raw lexers are handled: instead of creating them and thenChris Lattner2008-10-122-11/+12
| | | | | | | | | | | using LexRawToken, create one and use LexFromRawLexer. This avoids twiddling the RawLexer flag around and simplifies some code (even speeding raw lexing up a tiny bit). This change also improves the token paster to use a Lexer on the stack instead of new/deleting it. llvm-svn: 57393
* silence some release-assert warnings.Chris Lattner2008-10-121-2/+1
| | | | llvm-svn: 57391
* improve a comment.Chris Lattner2008-10-121-1/+2
| | | | llvm-svn: 57389
* __CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTRChris Lattner2008-10-061-4/+4
| | | | | | won't expand to the builtin. This fixes rdar://6248329 llvm-svn: 57164
* move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ intoChris Lattner2008-10-051-4/+10
| | | | | | target indep code. llvm-svn: 57139
* suck the rest of the FP macros out of the targets into the PPChris Lattner2008-10-051-4/+42
| | | | llvm-svn: 57137
* start moving fp macros overChris Lattner2008-10-051-2/+38
| | | | llvm-svn: 57134
* move a bunch more integer sizing out of target-specific code intoChris Lattner2008-10-051-0/+49
| | | | | | | | | | target indep code. Note that this changes functionality on PIC16: it defines __INT_MAX__ correctly for it, and it changes sizeof(long) to 16-bits (to match the size of pointer). llvm-svn: 57132
* eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start movingChris Lattner2008-10-051-6/+23
| | | | | | integer size #defines over to the Preprocessor. llvm-svn: 57130
* gcc no longer defines __block to nothing when blocks aren't enabled.Chris Lattner2008-10-051-4/+1
| | | | llvm-svn: 57129
* rearrange preprocessor macro definitions into language-specificChris Lattner2008-10-051-44/+51
| | | | | | then target specific. llvm-svn: 57128
* Implement PR2773, support for __USER_LABEL_PREFIX__Chris Lattner2008-10-051-0/+7
| | | | llvm-svn: 57127
* Add Preprocessor::RemovePragmaHandler.Daniel Dunbar2008-10-041-0/+37
| | | | | | - No functionality change. llvm-svn: 57065
* Document assumptions that NumericLiteralParser makes with an assertion.Chris Lattner2008-09-301-1/+10
| | | | llvm-svn: 56876
* define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.Chris Lattner2008-09-301-0/+4
| | | | llvm-svn: 56824
* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #defineChris Lattner2008-09-301-1/+1
| | | | llvm-svn: 56822
* Fix the root cause of PR2750 instead of the side effect.Chris Lattner2008-09-292-9/+14
| | | | | | | | | | | | 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. llvm-svn: 56818
* whitespace and comment changes, to fix grammar and 80 col violationsNico Weber2008-09-291-1/+1
| | | | llvm-svn: 56776
* clean up a bunch of fixme's I added, by moving Chris Lattner2008-09-263-14/+8
| | | | | | DirectoryLookup::DirType into SourceManager.h llvm-svn: 56692
* Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfoChris Lattner2008-09-263-31/+24
| | | | | | | | | | | to whether the fileid is a 'extern c system header' in addition to whether it is a system header, most of this is spreading plumbing around. Once we have that, PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to base the system header state on FileIDInfo instead of HeaderSearch. Finally, in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness of a file being entered can be set due to the #includer or the #includee. llvm-svn: 56688
* Update clang to pretend to be gcc-4.2.Daniel Dunbar2008-09-261-4/+4
| | | | | | - This really needs to be automated and configurable. llvm-svn: 56635
* Fix <rdar://problem/6240065> clang: __BLOCKS__ should be defined.Steve Naroff2008-09-231-2/+3
| | | | llvm-svn: 56503
* Line endings: CRLF -> LFArgyrios Kyrtzidis2008-09-051-8/+8
| | | | llvm-svn: 55829
* - Implement __block.Steve Naroff2008-09-021-3/+10
| | | | | | - Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions. llvm-svn: 55639
* Pull code from last commit. will put back soon.Steve Naroff2008-09-021-7/+0
| | | | llvm-svn: 55637
* Implement block pseudo-storage class modifiers (__block, __byref).Steve Naroff2008-09-021-0/+7
| | | | llvm-svn: 55635
* Fix for PR2750; don't check for an 'e' in the trash after the token.Eli Friedman2008-09-021-1/+1
| | | | | | | | 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. llvm-svn: 55622
* Rename Preprocessor::DisableBacktrack -> Preprocessor::CommitBacktrackedTokens.Argyrios Kyrtzidis2008-08-241-10/+10
| | | | llvm-svn: 55281
* Add a safety check.Argyrios Kyrtzidis2008-08-231-0/+2
| | | | | | Make sure there's no "dangling" backtrack position when Preprocessor is destroyed. llvm-svn: 55236
* Change line endings: CRLF -> LFArgyrios Kyrtzidis2008-08-231-30/+30
| | | | llvm-svn: 55235
* Allow nested backtracks.Argyrios Kyrtzidis2008-08-221-0/+32
| | | | llvm-svn: 55204
* various updates to match r54873 on mainline.Chris Lattner2008-08-171-2/+4
| | | | llvm-svn: 54874
* Change Parser & Sema to use interned "super" for comparions.Daniel Dunbar2008-08-141-6/+0
| | | | | | | | | | | | | | - Added as private members for each because it is not clear where to put the common definition. Perhaps the IdentifierInfos all of these "pseudo-keywords" should be collected into one place (this would KnownFunctionIDs and Objective-C property IDs, for example). Remove Token::isNamedIdentifier. - There isn't a good reason to use strcmp when we have interned strings, and there isn't a good reason to encourage clients to do so. llvm-svn: 54794
* Move some ObjC preprocessor definitions intoDaniel Dunbar2008-08-121-1/+18
| | | | | | | InitializePredefinedMacros(). - Also now properly wired to -fobjc-gc, -fnext-runtime. llvm-svn: 54661
* remove obsolete comment.Chris Lattner2008-08-111-13/+0
| | | | llvm-svn: 54652
* More #include cleaningDaniel Dunbar2008-08-115-7/+0
| | | | | | | | | | | - 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. llvm-svn: 54632
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-102-1/+13
| | | | | | | | | | | | | | | | * Move FormatError() from TextDiagnostic up to DiagClient, remove now empty class TextDiagnostic * Make DiagClient optional for Diagnostic This fixes the following problems: * -html-diags (and probably others) does now output the same set of warnings as console clang does * nothing crashes if one forgets to call setHeaderSearch() on TextDiagnostic * some code duplication is removed llvm-svn: 54620
* Allow the preprocessor to cache the lexed tokens, so that we can do ↵Argyrios Kyrtzidis2008-08-103-89/+66
| | | | | | | | | | | | | | | efficient lookahead and backtracking. 1) New public methods added: -EnableBacktrackAtThisPos -DisableBacktrack -Backtrack -isBacktrackEnabled 2) LookAhead() implementation is replaced with a more efficient one. 3) LookNext() is removed. llvm-svn: 54611
* In c89 mode accept hex fp constants as an extension:Chris Lattner2008-07-251-4/+7
| | | | | | | | | | | | | | | | 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 llvm-svn: 54035
* Patch byTed Kremenek2008-07-191-1/+1
| | | | | | | "When dumping the tokens (-dumptokens output type), the column numbers are not correctly shown. This patch fixes that issue." llvm-svn: 53796
* Convert CRLF -> LF line endings.Argyrios Kyrtzidis2008-07-121-21/+21
| | | | llvm-svn: 53519
* Add Preprocessor::LookNext method, which implements an efficient way to ↵Argyrios Kyrtzidis2008-07-091-0/+26
| | | | | | 'take a peek' at the next token without consuming it. llvm-svn: 53375
* move the linux predefined macro definition to the TargetInfo, where it ↵Nuno Lopes2008-07-051-5/+0
| | | | | | really belongs llvm-svn: 53149
OpenPOWER on IntegriCloud