summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-4/+2
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Only ignore extra tokens after #else if we skip it, otherwise warn. Fixes ↵Argyrios Kyrtzidis2011-05-211-1/+3
| | | | | | rdar://9475098. llvm-svn: 131788
* To be able to replay compilations we need to accurately remodel howManuel Klimek2011-04-261-8/+12
| | | | | | | | | includes get resolved, especially when they are found relatively to another include file. We also try to get it working for framework includes, but that part of the code is untested, as I don't have a code base that uses it. llvm-svn: 130246
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* Add a 'RawPath' parameter to the PPCallbacks interface. This allowsChandler Carruth2011-03-161-12/+20
| | | | | | | | | | | | | | | clients to observe the exact path through which an #included file was located. This is very useful when trying to record and replay inclusion operations without it beind influenced by the aggressive caching done inside the FileManager to avoid redundant system calls and filesystem operations. The work to compute and return this is only done in the presence of callbacks, so it should have no effect on normal compilation. Patch by Manuel Klimek. llvm-svn: 127742
* Rename tok::eom to tok::eod.Peter Collingbourne2011-02-281-45/+45
| | | | | | | | The previous name was inaccurate as this token in fact appears at the end of every preprocessing directive, not just macro definitions. No functionality change, except for a diagnostic tweak. llvm-svn: 126631
* Reimplement __pragma support using a TokenLexerPeter Collingbourne2011-02-221-0/+1
| | | | llvm-svn: 126221
* Make TokenLexer capable of storing preprocessor directive tokensPeter Collingbourne2011-02-221-3/+5
| | | | llvm-svn: 126220
* When redefining a macro don't warn twice if it's not used and don't warn for ↵Argyrios Kyrtzidis2011-01-181-1/+3
| | | | | | | | duplicate definition by command line options. Fixes rdar://8875916. llvm-svn: 123767
* fix rdar://8823139, a crash on a comment in a preprocessed .s fileChris Lattner2011-01-061-0/+6
| | | | | | that contains the ## operator. llvm-svn: 122946
* Fix PR8654, ensuring each branch of an #if, #elif, #else, ... chainChandler Carruth2011-01-031-1/+12
| | | | | | | | receives a PPCallback. Patch by Richard Smith. llvm-svn: 122755
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-2/+2
| | | | | | | | | new gcc warning that complains on self-assignments and self-initializations. Fix one bug found by the warning, in which one clang::OverloadCandidate constructor failed to initialize its FunctionTemplate member. llvm-svn: 122459
* Introduced raw_identifier token kind.Abramo Bagnara2010-12-221-7/+3
| | | | llvm-svn: 122394
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-6/+14
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Don't crash when code-completing after "#include <". It would be farDouglas Gregor2010-12-091-0/+6
| | | | | | | better to actually produce a decent set of completions by checking the system include paths, but not today. Fixes PR8744. llvm-svn: 121431
* Several PPCallbacks take an SourceLocation + IdentifierInfo, ratherCraig Silverstein2010-11-191-5/+4
| | | | | | | | | | | than a Token that holds the same information all in one easy-to-use package. There's no technical reason to prefer the former -- the information comes from a Token originally -- and it's clumsier to use, so I've changed the code to use tokens everywhere. Approved by clattner llvm-svn: 119845
* Make sure to always check the result ofDouglas Gregor2010-11-121-1/+3
| | | | | | | SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. llvm-svn: 118885
* Add PPCallbacks for #if/#ifdef/etc.Craig Silverstein2010-11-061-14/+37
| | | | | | | | | | | The callback info for #if/#elif is not great -- ideally it would give us a list of tokens in the #if, or even better, a little parse tree. But that's a lot more work. Instead, clients can retokenize using Lexer::LexFromRawLexer(). Reviewed by nlewycky. llvm-svn: 118318
* Extend the preprocessing record and libclang with support forDouglas Gregor2010-10-201-14/+30
| | | | | | | | | inclusion directives, keeping track of every #include, #import, etc. in the translation unit. We keep track of the source location and kind of the inclusion, how the file name was spelled, and the underlying file to which the inclusion resolved. llvm-svn: 116952
* Really^2 fix <rdar://problem/8361834>, this time without crashing.Ted Kremenek2010-10-191-13/+31
| | | | | | | | | Now MICache is a linked list (per the FIXME), where we tradeoff between MacroInfo objects being in MICache and MIChainHead. MacroInfo objects in the MICache chain are already "Destroy()'ed", so they can be reused. When inserting into MICache, we need to remove them from the regular linked list so that they aren't destroyed more than once. llvm-svn: 116869
* Revert most of r116862. It isn't quite the right fix for a memory leak in ↵Ted Kremenek2010-10-191-5/+1
| | | | | | Preprocessor. llvm-svn: 116864
* Really fix: <rdar://problem/8361834> MacroInfo::AddTokenToBody() leaks memoryTed Kremenek2010-10-191-2/+6
| | | | | | | | | The problem was not the management of MacroInfo objects, but that when we recycle them via the MICache the memory of the underlying SmallVector (within MacroInfo) was not getting released. This is because objects stashed into MICache simply are reused with a placement new, and never have their destructor called. llvm-svn: 116862
* Simplify lifetime management of MacroInfo objects in Preprocessor by having ↵Ted Kremenek2010-10-191-2/+6
| | | | | | | | | | | | the Preprocessor maintain them in a linked list of allocated MacroInfos. This requires only 1 extra pointer per MacroInfo object, and allows us to blow them away in one place. This fixes an elusive memory leak with MacroInfos (whose exact location I couldn't still figure out despite substantial digging). Fixes <rdar://problem/8361834>. llvm-svn: 116842
* When we parse a pragma, keep track of how that pragma was originallyDouglas Gregor2010-09-091-1/+2
| | | | | | | | spelled (#pragma, _Pragma, __pragma). In -E mode, use that information to add appropriate newlines when translating _Pragma and __pragma into #pragma, like GCC does. Fixes <rdar://problem/8412013>. llvm-svn: 113553
* Implement preprocessor code completion where a macro name is expected,Douglas Gregor2010-08-241-0/+7
| | | | | | | e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname> expression in a preprocessor conditional. llvm-svn: 111954
* Introduce basic code-completion support for preprocessor directives,Douglas Gregor2010-08-241-1/+12
| | | | | | e.g., after a "#" we'll suggest #if, #ifdef, etc. llvm-svn: 111943
* Detabify.Eli Friedman2010-08-221-1/+1
| | | | llvm-svn: 111768
* no need to pass bumppointer allocator into macroinfo::destroyChris Lattner2010-08-181-2/+2
| | | | llvm-svn: 111364
* Implement #pragma push_macro, patch by Francois Pichet!Chris Lattner2010-08-171-4/+15
| | | | llvm-svn: 111234
* Don't emit end-of-file diagnostics like "unterminated conditional" orDouglas Gregor2010-08-121-2/+3
| | | | | | "unterminated string" when we're performing code completion. llvm-svn: 110933
* Revert r110440, the fix for PR4897. Chris claims to have a better way.Douglas Gregor2010-08-081-26/+8
| | | | llvm-svn: 110544
* Push location through the MacroUndefined PPCallback and use it to print ↵Benjamin Kramer2010-08-071-1/+2
| | | | | | #undefs in -dD mode. (PR7818) llvm-svn: 110523
* Fix the #include search path when reading from stdin, from Jon Simons!Douglas Gregor2010-08-061-8/+26
| | | | | | Fixes PR4897. llvm-svn: 110440
* push some source location information down through the compiler,Chris Lattner2010-04-201-6/+2
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* add a PPCallback handler for a skipped #include, patch byChris Lattner2010-04-191-6/+9
| | | | | | Zhanyong Wan! llvm-svn: 101813
* Improve line marker directive locations, patch by Jordy RoseChris Lattner2010-04-141-2/+3
| | | | llvm-svn: 101226
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-3/+3
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-311-3/+3
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-311-3/+3
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Audit all Preprocessor::getSpelling() callers, improving failureDouglas Gregor2010-03-161-5/+16
| | | | | | recovery for those that need it. llvm-svn: 98689
* Audit all callers of SourceManager::getCharacterData(); update some ofDouglas Gregor2010-03-161-1/+6
| | | | | | them to recover more gracefully on failure. llvm-svn: 98672
* Use SmallString instead of SmallVectorKovarththanan Rajaratnam2010-03-131-5/+5
| | | | llvm-svn: 98436
* Add an overload of Preprocessor::getSpelling which takes a SmallVector andBenjamin Kramer2010-02-271-6/+2
| | | | | | returns a StringRef. Use it to simplify some repetitive code. llvm-svn: 97322
* Fix PR6282: the include guard optimization cannot happen if theChris Lattner2010-02-121-7/+10
| | | | | | | | guard macro is already defined for the first occurrence of the header. If it is, the body will be skipped and not be properly analyzed for the include guard optimization. llvm-svn: 95972
* revert my patch for rdar://7520940 that warns when a published headerChris Lattner2010-01-221-13/+2
| | | | | | | is #included with "foo.h" style syntax instead of framework syntax. It produced too much noise. llvm-svn: 94120
* simplify the code for skipping in a #if 0 block. The CurLexerChris Lattner2010-01-181-4/+1
| | | | | | | pointer is always non-null because the PTH case exits earlier in the method. llvm-svn: 93794
* stringref'ize a bunch of filename handling logic. MuchChris Lattner2010-01-101-38/+28
| | | | | | nicer than passing around two const char*'s. llvm-svn: 93094
* clarify comment.Chris Lattner2010-01-101-2/+2
| | | | llvm-svn: 93084
* implement rdar://7520940: published framework headers shouldChris Lattner2010-01-101-2/+13
| | | | | | | import other headers within the same framework with the full framework path, not with a relative include. llvm-svn: 93083
* Convert to StringRef, avoid a memcpy in the common case.Benjamin Kramer2009-12-311-19/+16
| | | | llvm-svn: 92357
OpenPOWER on IntegriCloud