summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/TokenLexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* No need to call setIdentifierInfo() after LookUpIdentifierInfo() which ↵Kovarththanan Rajaratnam2010-03-131-3/+2
| | | | | | LookUpIdentifierInfo() will automatically do llvm-svn: 98435
* The PreExpArgTokens array is indexed with an argument #,Chris Lattner2009-12-281-1/+1
| | | | | | | not a token number. Fix the reserve logic to get the right amount of space. llvm-svn: 92202
* comment tweakChris Lattner2009-12-231-1/+1
| | | | llvm-svn: 92055
* move the VarargsElided member of MacrosArgs to shrink the MacroArgs structChris Lattner2009-12-141-1/+1
| | | | | | | on 64-bit targets. Pass Preprocessor into create/destroy methods of MacroArgs even though it isn't used yet. llvm-svn: 91345
* minor tidy.Chris Lattner2009-12-041-6/+5
| | | | llvm-svn: 90543
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-60/+60
| | | | llvm-svn: 81346
* fix the "pasting formed 'a]', an invalid preprocessing token"Chris Lattner2009-05-281-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic to include the full instantiation location for the invalid paste. For: #define foo(a, b) a ## b #define bar(x) foo(x, ]) bar(a) bar(zdy) Instead of: t.c:3:22: error: pasting formed 'a]', an invalid preprocessing token #define foo(a, b) a ## b ^ t.c:3:22: error: pasting formed 'zdy]', an invalid preprocessing token we now produce: t.c:7:1: error: pasting formed 'a]', an invalid preprocessing token bar(a) ^ t.c:4:16: note: instantiated from: #define bar(x) foo(x, ]) ^ t.c:3:22: note: instantiated from: #define foo(a, b) a ## b ^ t.c:8:1: error: pasting formed 'zdy]', an invalid preprocessing token bar(zdy) ^ t.c:4:16: note: instantiated from: #define bar(x) foo(x, ]) ^ t.c:3:22: note: instantiated from: #define foo(a, b) a ## b ^ llvm-svn: 72519
* Make the bad paste diagnostic print the entire pasted token.Eli Friedman2009-05-271-1/+1
| | | | llvm-svn: 72497
* improve comment, no functionality change.Chris Lattner2009-05-251-10/+15
| | | | llvm-svn: 72386
* Make sure an invalid concatentaion doesn't insert whitespace before Eli Friedman2009-05-241-1/+5
| | | | | | the RHS. Fixes assembler-with-cpp issue reported on cfe-dev. llvm-svn: 72370
* The TokenLexer may encounter annotations if the parser enters them using ↵Argyrios Kyrtzidis2009-05-221-1/+2
| | | | | | | | Preprocessor::EnterTokenStream. So check for annotation before using the Token's IdentifierInfo. llvm-svn: 72278
* Fix for PR4132: make sure to insert whitespace consistently before a Eli Friedman2009-05-031-1/+1
| | | | | | pasted token. llvm-svn: 70793
* Silence gcc warnings.Eli Friedman2009-04-251-2/+2
| | | | llvm-svn: 70086
* move token paste poisoning diagnostics to after the instantiation locChris Lattner2009-04-191-11/+16
| | | | | | | for a token is set, this makes the diagnostic "expanded from stack" work for this diagnostic. Add a testcase for PR3918. llvm-svn: 69544
* Fix PR3918: Invalid use of __VA_ARGS__ not diagnosed,Chris Lattner2009-04-191-2/+13
| | | | | | | by rejecting invalid poisoned tokens in the token pasting path. llvm-svn: 69536
* The individual pieces of an invalid paste as still candidates for expansion.Chris Lattner2009-03-231-1/+3
| | | | | | | This matters in assembler mode, where this is silently allowed. This fixes rdar://6709206. llvm-svn: 67539
* constructs like:Chris Lattner2009-03-181-3/+4
| | | | | | | | | #define Y X ## . Y are ok in .S files. llvm-svn: 67231
* simplify some logic by making ScratchBuffer handle the application of trailingChris Lattner2009-03-081-35/+28
| | | | | | | \0's to created tokens instead of making all clients do it. No functionality change. llvm-svn: 66373
* make the token lexer allocate its temporary token buffers forChris Lattner2009-03-041-2/+9
| | | | | | | preexpanded macro arguments from the preprocessor's bump pointer. This reduces # mallocs from 12444 to 11792. llvm-svn: 66025
* track "just a little more" location information for macro instantiations.Chris Lattner2009-02-151-8/+10
| | | | | | | | | | | | Now instead of just tracking the expansion history, also track the full range of the macro that got replaced. For object-like macros, this doesn't change anything. For _Pragma and function-like macros, this means we track the locations of the ')'. This is required for PR3579 because apparently GCC uses the line of the ')' of a function-like macro as the location to expand __LINE__ to. llvm-svn: 64601
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .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! llvm-svn: 63111
* remove my hacks that aggressively threw away multiple Chris Lattner2009-01-261-6/+0
| | | | | | | | | | | instantiation history in an effort to speed up c99-intconst-1.c. Now that multiple nested instantiations are allowed, we just make them and don't pay the cost of lookups. With the other changes that went in before this, reverting this is actually a speedup for c99-intconst-1.c, speeding it up from 1.96s to 1.80s, and preserves much better loc info. llvm-svn: 63036
* This change refactors some of the low-level lexer interfaces a bit.Chris Lattner2009-01-261-17/+22
| | | | | | | | | | | | | Token now has a class of kinds for "literals", which include numeric constants, strings, etc. These tokens can optionally have a pointer to the start of the token in the lexer buffer. This makes it faster to get spelling and do other gymnastics, because we don't have to go through source locations. This change is performance neutral, but will make other changes more feasible down the road. llvm-svn: 63028
* Only resolve a macro's instantiation loc once per macro, instead of onceChris Lattner2009-01-261-0/+7
| | | | | | | | per token lexed from it. This speeds up clang on c99-intconst-1.c from the GCC testsuite from 3.64s to 2.66s (36%). This reduces the number of binary search FileID lookups from 251570522 to 114175649 on this testcase. llvm-svn: 62992
* Check in the long promised SourceLocation rewrite. This lays theChris Lattner2009-01-261-3/+4
| | | | | | | | | | ground work for implementing #line, and fixes the "out of macro ID's" problem. There is nothing particularly tricky about the code, other than the very performance sensitive SourceManager::getFileID() method. llvm-svn: 62978
* This is a follow-up to r62675:Chris Lattner2009-01-231-3/+8
| | | | | | | | | | Refactor how the preprocessor changes a token from being an tok::identifier to a keyword (e.g. tok::kw_for). Instead of doing this in HandleIdentifier, hoist this common case out into the caller, so that every keyword doesn't have to go through HandleIdentifier. This drops time in HandleIdentifier from 1.25ms to .62ms, and speeds up clang -Eonly with PTH by about 1%. llvm-svn: 62855
* Add a bit to IdentifierInfo that acts as a simple predicate whichChris Lattner2009-01-211-2/+3
| | | | | | | | | tells us whether Preprocessor::HandleIdentifier needs to be called. Because this method is only rarely needed, this saves a call and a bunch of random checks. This drops the time in HandleIdentifier from 3.52ms to .98ms on cocoa.h on my machine. llvm-svn: 62675
* Make SourceLocation::getFileLoc private to reduce the API exposure of Chris Lattner2009-01-191-4/+12
| | | | | | | SourceLocation. This requires making some cleanups to token pasting and _Pragma expansion. llvm-svn: 62490
* make the verbose raw-lexer ctor fully explicit instead of havingChris Lattner2009-01-171-4/+4
| | | | | | embedded magic. llvm-svn: 62417
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-2/+1
| | | | | | | | | | | | | | | "FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. llvm-svn: 62407
* Remove the last of the old-style Preprocessor::Diag methods.Chris Lattner2008-11-181-2/+2
| | | | llvm-svn: 59554
* Simplify raw mode lexing by treating an unterminate /**/ comment theChris Lattner2008-10-121-5/+1
| | | | | | | | 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
* Change how raw lexers are handled: instead of creating them and thenChris Lattner2008-10-121-6/+6
| | | | | | | | | | | 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
* whitespace and comment changes, to fix grammar and 80 col violationsNico Weber2008-09-291-1/+1
| | | | llvm-svn: 56776
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+488
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. llvm-svn: 48402
OpenPOWER on IntegriCloud