summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix the second half of PR4006 and rdar://6807000 by treatingChris Lattner2009-04-201-7/+11
| | | | | | | () as being either zero arguments or one empty argument depending on situation. llvm-svn: 69627
* Fix PR3917: the location of a #line directive is the location of the first _.Chris Lattner2009-04-181-0/+4
| | | | llvm-svn: 69485
* fix PR3927 by being more careful about the pp test for identifier.Chris Lattner2009-04-181-1/+1
| | | | llvm-svn: 69423
* Substantially restructure function-like macro argument parsing.Chris Lattner2009-04-181-36/+56
| | | | | | | | | Highlights: PP::isNextPPTokenLParen() no longer eats the ( when present. We now simplify slightly the logic parsing macro arguments. We now handle PR3937 and other related cases correctly. llvm-svn: 69411
* implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310Chris Lattner2009-04-131-0/+8
| | | | llvm-svn: 68933
* simplify code.Chris Lattner2009-04-101-6/+4
| | | | llvm-svn: 68825
* fix PR3880, fixing a comma swallowing bug handling macros that only takeChris Lattner2009-03-251-0/+6
| | | | | | ... arguments. llvm-svn: 67706
* remove some dead code. ArgTokens can never be empty, because it is always Chris Lattner2009-03-251-9/+0
| | | | | | | | | | | | terminated with an EOF token. The condition it is trying to check for is handled by this code above. // Empty arguments are standard in C99 and supported as an extension in // other modes. if (ArgTokens.empty() && !Features.C99) Diag(Tok, diag::ext_empty_fnmacro_arg); llvm-svn: 67705
* add a callback for macro expansion, based on a patch by Paolo Bolzoni!Chris Lattner2009-03-121-0/+2
| | | | llvm-svn: 66799
* simplify some logic by making ScratchBuffer handle the application of trailingChris Lattner2009-03-081-16/+7
| | | | | | | \0's to created tokens instead of making all clients do it. No functionality change. llvm-svn: 66373
* improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)Chris Lattner2009-03-021-0/+1
| | | | llvm-svn: 65884
* add a new SourceManager::getInstantiationRange helper method.Chris Lattner2009-02-151-3/+1
| | | | llvm-svn: 64606
* fix PR3579: __LINE__ expands to the presumed location of the Chris Lattner2009-02-151-1/+11
| | | | | | | | *end* of a macro instantiation, not the start of it. This is really all about bug-for-bug compatibility with GCC, but not doing this breaks the FreeBSD kernel. llvm-svn: 64604
* track "just a little more" location information for macro instantiations.Chris Lattner2009-02-151-6/+15
| | | | | | | | | | | | 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
* Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner2009-01-271-11/+23
| | | | | | | | | | | | | | | | | | | as reported to the user and as manipulated by #line. This is what __FILE__, __INCLUDE_LEVEL__, diagnostics and other things should follow (but not dependency generation!). This patch also includes several cleanups along the way: - SourceLocation now has a dump method, and several other places that did similar things now use it. - I cleaned up some code in AnalysisConsumer, but it should probably be simplified further now that NamedDecl is better. - TextDiagnosticPrinter is now simplified and cleaned up a bit. This patch is a prerequisite for #line, but does not actually provide any #line functionality. llvm-svn: 63098
* remove my hacks that aggressively threw away multiple Chris Lattner2009-01-261-8/+1
| | | | | | | | | | | 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-10/+14
| | | | | | | | | | | | | 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
* eagerly resolve the spelling locations of macro argument preexpansions.Chris Lattner2009-01-261-1/+1
| | | | | | | | | | | | | | | This reduces fsyntax-only time on c99-intconst-1.c from 2.43s down to 2.01s (20%), reducing the number of fileid lookups from 2529040 linear and 64771121 binary to 5625902 linear and 4151182 binary. This knocks getFileID down to only 4.6% of compile time on this testcase. At this point, malloc/free is over 35% of compile time, primarily allocating MacroArgs objects and their argument preexpansion vectors. I don't feel like malloc avoiding right now, so I'm just going to call this good. llvm-svn: 62994
* Eagerly resolve the spelling location of the tokens in a definitionChris Lattner2009-01-261-0/+6
| | | | | | | | | | | | of a macro. Since these tokens may themselves be from macro expansions, we need to resolve down to the spelling loc when the macro ends up being instantiated. Instead of resolving this for each token expanded from the macro definition, just do it once when the macro is defined. This speeds up clang on c99-intconst-1.c from 2.66s to 2.43s (9.5%), reducing the FileID lookups from 407244 linear and 114175649 binary to 2529040 linear and 64771121 binary. llvm-svn: 62993
* Check in the long promised SourceLocation rewrite. This lays theChris Lattner2009-01-261-4/+7
| | | | | | | | | | 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
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-3/+3
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead ↵Ted Kremenek2008-12-151-1/+1
| | | | | | using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%. llvm-svn: 61042
* Handle another case where we should use PTHLexer as an alternative to the ↵Ted Kremenek2008-11-201-1/+3
| | | | | | normal Lexer. llvm-svn: 59736
* Assign the result of getCurrentFileLexer() to a PreprocessorLexer* instead ↵Ted Kremenek2008-11-201-1/+1
| | | | | | of Lexer* (narrower interface). llvm-svn: 59691
* Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is ↵Ted Kremenek2008-11-191-1/+1
| | | | | | an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*. llvm-svn: 59672
* Move more cases of using 'CurLexer' to 'CurPPLexer'.Ted Kremenek2008-11-191-0/+2
| | | | | | Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer. llvm-svn: 59671
* When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().Ted Kremenek2008-11-191-1/+1
| | | | llvm-svn: 59668
* Replace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.Ted Kremenek2008-11-181-1/+1
| | | | llvm-svn: 59482
* Fix the root cause of PR2750 instead of the side effect.Chris Lattner2008-09-291-8/+13
| | | | | | | | | | | | 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
* The awesome GNU "comma elision extension" works with both the standardChris Lattner2008-05-081-3/+6
| | | | | | | __VA_ARGS__ syntax as well as with the amazingly awesome GNU "named variadic macro" extension. Allow it with the GNU syntax as well. llvm-svn: 50843
* Plug a memory leak in the "this macro expands into a single trivially-Sam Bishop2008-03-211-1/+4
| | | | | | expanded token" case. llvm-svn: 48637
* move #include to the file that needs it.Chris Lattner2008-03-181-0/+1
| | | | llvm-svn: 48485
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+523
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