summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a couple of bugs:Chris Lattner2009-05-251-18/+27
| | | | | | | | | | | | 1. When we accept "#garbage" in asm-with-cpp mode, change the token kind of the # to unknown so that the preprocessor won't try to process it as a real #. This fixes a crash on the attached example 2. Fix macro definition extents processing to handle #foo at the end of a macro to say the definition ends with the foo, not the #. This is a follow-on fix to r72283, and rdar://6916026 llvm-svn: 72388
* In assembler-with-cpp mode, don't error on '#' (stringize) operator applied toDaniel Dunbar2009-05-221-3/+5
| | | | | | non-argument names, pass the tokens through. llvm-svn: 72283
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-2/+2
| | | | llvm-svn: 72210
* improve MacroInfo to track the source range of the macro definition,Chris Lattner2009-04-211-1/+10
| | | | | | patch by Alexei Svitkine! llvm-svn: 69659
* add a preprocessor callback function for #undef, patch byChris Lattner2009-04-211-1/+5
| | | | | | Alexei Svitkine! llvm-svn: 69656
* Fix PR4006, incorrect handling of __VA_ARGS__ when it was the first tokenChris Lattner2009-04-191-9/+9
| | | | | | | in a function-like macro body. This has the added bonus of moving some function-like macro specific code out of the object-like macro codepath. llvm-svn: 69530
* more fun with line markers: the digit string is required to be interpretedChris Lattner2009-04-181-23/+23
| | | | | | | as decimal, even if it starts with 0. Also, since things like 0x1 are completely illegal, don't even bother using numericliteralparser for them. llvm-svn: 69454
* second half of PR3940: #line requires simple digit sequence.Chris Lattner2009-04-181-1/+2
| | | | llvm-svn: 69422
* enforce requirements imposed by C90 6.8 TC1, fixing PR3919.Chris Lattner2009-04-181-11/+26
| | | | llvm-svn: 69415
* Fix PR3938 by taking into account C99 6.10p4.Chris Lattner2009-04-181-1/+1
| | | | llvm-svn: 69413
* Fix two problems from PR3916, and one problem I noticed while hackingChris Lattner2009-04-171-2/+5
| | | | | | on the code. llvm-svn: 69404
* implement PR3940: #line numbers not fully checkedChris Lattner2009-04-171-0/+5
| | | | llvm-svn: 69403
* #line is allowed to have macros that expand to nothing after them.Chris Lattner2009-04-171-7/+13
| | | | llvm-svn: 69401
* Offer a fixit hint for our warning about tokens at the end of a directive:Chris Lattner2009-04-141-1/+7
| | | | | | | | | | | | | t.c:3:8: warning: extra tokens at end of #endif directive #endif foo ^ // Don't do this in strict-C89 mode because bcpl comments aren't valid there, and it is too much trouble to analyze whether C block comments are safe. llvm-svn: 69024
* Fix the #import / #include_next "extra tokens at end of #foo directive" Chris Lattner2009-04-141-9/+9
| | | | | | | Warning to properly report that it is an import/include_next instead of claiming it is a #include. llvm-svn: 69023
* Fix assertion failure in PTH when tokens followed a closing #endif.Daniel Dunbar2009-04-131-3/+2
| | | | | | | | | - Ted, please check. - Missing test case because PTH won't reliably cache the tokens in a test case. *cough* llvm-svn: 68966
* add a ppcallback hook for macro definitions.Chris Lattner2009-04-121-0/+4
| | | | llvm-svn: 68883
* finish the implementation of -imacros. The driver still needs to be hooked up.Chris Lattner2009-04-081-4/+10
| | | | llvm-svn: 68640
* reject the #__include_macros directive unless it comes from the Chris Lattner2009-04-081-1/+20
| | | | | | predefines buffer. llvm-svn: 68627
* Add initial support for -imacros. Right now it has the same semantics asChris Lattner2009-04-081-2/+4
| | | | | | -include, but that will be fixed soon. llvm-svn: 68625
* push line markers through -E mode.Chris Lattner2009-03-271-0/+22
| | | | llvm-svn: 67854
* when preprocessing a .S file, unknown directives should just be passed through,Chris Lattner2009-03-181-0/+19
| | | | | | | | | | | | | | and the token after the # should be expanded if it is not a valid directive. This allows us to transform things like: #define FOO BAR # FOO into # BAR, even though FOO is not normally expanded for directives. This should fix PR3833 llvm-svn: 67236
* This is not considered a preprocessor directive in .S files:Chris Lattner2009-03-181-0/+2
| | | | | | # 4 llvm-svn: 67233
* use accessor instead of poking ivar directlyChris Lattner2009-03-131-1/+1
| | | | llvm-svn: 66954
* #import is not considered an extension for ObjC.Chris Lattner2009-03-061-1/+2
| | | | llvm-svn: 66246
* switch the macroinfo argument lists from being allocated off the heapChris Lattner2009-02-201-4/+4
| | | | | | | | | to being allocated from the same bumpptr that the MacroInfo objects themselves are. This speeds up -Eonly cocoa.h pth by ~4%, fsyntax-only is barely measurable. llvm-svn: 65195
* detemplatify setArgumentList and some other cleanups.Chris Lattner2009-02-201-7/+5
| | | | llvm-svn: 65187
* require the MAcroInfo objects are explcitly destroyed.Chris Lattner2009-02-201-3/+11
| | | | llvm-svn: 65179
* Fix PR3464 by searching for headers from the predefinesChris Lattner2009-02-041-2/+13
| | | | | | buffer as if the #include happened from the main file. llvm-svn: 63764
* Implement handling of file entry/exit notifications from GNUChris Lattner2009-02-041-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | line markers, including maintenance of the virtual include stack. For something like this: # 42 "bar.c" 1 # 142 "bar2.c" 1 #warning zappa # 92 "bar.c" 2 #warning gonzo # 102 "foo.c" 2 #warning bonkta we now produce these three warnings: #1: In file included from foo.c:3: In file included from bar.c:42: bar2.c:143:2: warning: #warning zappa #warning zappa ^ #2: In file included from foo.c:3: bar.c:92:2: warning: #warning gonzo #warning gonzo ^ #3: foo.c:102:2: warning: #warning bonkta #warning bonkta ^ llvm-svn: 63722
* propagate linemarker flags down into the the line table, currentlyChris Lattner2009-02-041-4/+6
| | | | | | ignoring include stack push/pop info though. llvm-svn: 63719
* stub out basic #line handling calls.Chris Lattner2009-02-031-5/+3
| | | | llvm-svn: 63667
* 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
* Fix a bug that I noticed by inspection.Chris Lattner2009-01-271-0/+1
| | | | llvm-svn: 63094
* remove my hacks that aggressively threw away multiple Chris Lattner2009-01-261-12/+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
* start plumbing together the line table information. So far we justChris Lattner2009-01-261-6/+32
| | | | | | unique the Filenames in #line directives, assigning them UIDs. llvm-svn: 63010
* add parsing and constraint enforcement for GNU line marker directives.Chris Lattner2009-01-261-35/+148
| | | | llvm-svn: 63003
* a few minor cleanupsChris Lattner2009-01-261-2/+6
| | | | llvm-svn: 63000
* parse and enforce required constraints on #line directives. Right nowChris Lattner2009-01-261-14/+86
| | | | | | we just discard them. llvm-svn: 62999
* Eagerly resolve the spelling location of the tokens in a definitionChris Lattner2009-01-261-0/+12
| | | | | | | | | | | | 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
* do not use SourceManager::getFileCharacteristic(FileID), it is notChris Lattner2009-01-191-1/+1
| | | | | | | safe because a #line can change the file characteristic on a per-loc basis. llvm-svn: 62501
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-6/+6
| | | | | | | | | | | | | | | "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
* As a performance optimization, don't bother calling MacroInfo::isIdenticalTo Chris Lattner2009-01-161-9/+16
| | | | | | | | if warnings in system headers are disabled. isIdenticalTo can end up calling the expensive getSpelling method, and other bad stuff and is completely unneeded if the warning will be discarded anyway. rdar://6502956 llvm-svn: 62347
* PTH:Ted Kremenek2008-12-231-0/+7
| | | | | | | | | | | | - Embed 'eom' tokens in PTH file. - Use embedded 'eom' tokens to not lazily generate them in the PTHLexer. This means that PTHLexer can always advance to the next token after reading a token (instead of buffering tokens using a copy). - Moved logic of 'ReadToken' into Lex. GetToken & ReadToken no longer exist. - These changes result in a 3.3% speedup (-Eonly) on Cocoa.h. - The code is a little gross. Many cleanups are possible and should be done. llvm-svn: 61360
* Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead ↵Ted Kremenek2008-12-151-7/+19
| | | | | | 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
* eliminate the isCXXNamedOperator function and some string compares andChris Lattner2008-12-131-8/+2
| | | | | | use identifierinfo instead. Patch by Chris Goller! llvm-svn: 60992
* Added PTH optimization to not process entire blocks of tokens that appear in ↵Ted Kremenek2008-12-121-0/+78
| | | | | | skipped preprocessor blocks. This improves PTH speed by 6%. The code for this optimization itself is not very optimized, and will get cleaned up. llvm-svn: 60956
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* Rename IsNonPragmaNonMacroLexer to IsFileLexer.Ted Kremenek2008-11-201-2/+2
| | | | llvm-svn: 59731
OpenPOWER on IntegriCloud