summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* 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-226-52/+65
| | | | llvm-svn: 122394
* Add missing standard includes. Patch by Joerg Sonnenberger!Nick Lewycky2010-12-191-0/+1
| | | | llvm-svn: 122194
* Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.Michael J. Spencer2010-12-171-1/+1
| | | | llvm-svn: 122087
* MemoryBuffer API update.Michael J. Spencer2010-12-161-4/+2
| | | | llvm-svn: 121956
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-156-22/+40
| | | | | | | | | | | | 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
* Use error_code instead of std::string* for MemoryBuffer.Michael J. Spencer2010-12-091-1/+5
| | | | llvm-svn: 121378
* Fix diagnostic for reporting bad escape sequence.Ted Kremenek2010-12-031-1/+1
| | | | | | Patch by Paul Curtis! llvm-svn: 120759
* Merge System into Support.Michael J. Spencer2010-11-292-2/+2
| | | | llvm-svn: 120297
* change the 'is directory' indicator to be a null-or-notChris Lattner2010-11-231-2/+3
| | | | | | | | | pointer that is passed down through the APIs, and make FileSystemStatCache::get be the one that filters out directory lookups that hit files. This also paves the way to have stat queries be able to return opened files. llvm-svn: 120060
* simplify the cache miss handling code, eliminating CacheMissing.Chris Lattner2010-11-231-3/+2
| | | | llvm-svn: 120038
* rework the stat cache, pulling it out of FileManager.h intoChris Lattner2010-11-231-13/+14
| | | | | | | its own header and giving it some more structure. No functionality change. llvm-svn: 120030
* don't allow remapping PTH file paths with -fworking-directory, theChris Lattner2010-11-231-3/+2
| | | | | | client should just pass in absolute paths. llvm-svn: 120012
* now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner2010-11-234-28/+18
| | | | | | | | | FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
* tidy upChris Lattner2010-11-231-4/+4
| | | | llvm-svn: 119996
* remove old compatibility APIs, use StringRef versions instead.Chris Lattner2010-11-212-14/+8
| | | | llvm-svn: 119935
* Revert r119838 "Don't warn for empty 'if' body if there is a macro that ↵Argyrios Kyrtzidis2010-11-201-1/+1
| | | | | | | | | | expands to nothing" and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! llvm-svn: 119887
* Several PPCallbacks take an SourceLocation + IdentifierInfo, ratherCraig Silverstein2010-11-192-9/+9
| | | | | | | | | | | 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
* Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:Argyrios Kyrtzidis2010-11-191-0/+1
| | | | | | | | | if (condition) CALL(0); // empty macro but don't warn for empty body. Fixes rdar://8436021. llvm-svn: 119838
* move getSpelling from Preprocessor to Lexer, which it is more conceptually ↵Chris Lattner2010-11-173-114/+105
| | | | | | related to. llvm-svn: 119479
* propagate preprocessor out of StringLiteralParser. It is nowChris Lattner2010-11-171-10/+18
| | | | | | possible to create one without a preprocessor. llvm-svn: 119476
* push the preprocessor out of EncodeUCNEscapeChris Lattner2010-11-171-21/+14
| | | | llvm-svn: 119475
* move AdvanceToTokenCharacter and getLocForEndOfToken fromChris Lattner2010-11-173-65/+82
| | | | | | Preprocessor to Lexer where they make more sense. llvm-svn: 119474
* add a static version of PP::AdvanceToTokenCharacter.Chris Lattner2010-11-172-15/+21
| | | | llvm-svn: 119472
* push use of Preprocessor out farther.Chris Lattner2010-11-171-22/+18
| | | | llvm-svn: 119471
* push use of Preprocessor out of getOffsetOfStringByte Chris Lattner2010-11-171-6/+5
| | | | llvm-svn: 119470
* add a static form of the efficient PP::getSpelling method.Chris Lattner2010-11-172-3/+8
| | | | llvm-svn: 119469
* refactor the interface to StringLiteralParser::getOffsetOfStringByte,Chris Lattner2010-11-171-32/+39
| | | | | | pushing the dependency on the preprocessor out a bit. llvm-svn: 119468
* Make sure to always check the result ofDouglas Gregor2010-11-123-8/+20
| | | | | | | SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. llvm-svn: 118885
* lib/Lex/PPMacroExpansion.cpp: Fixup to appease MSVC.NAKAMURA Takumi2010-11-091-0/+4
| | | | | | Confirmed on MSVS10. llvm-svn: 118496
* Appeasing MSVC, take 3Douglas Gregor2010-11-091-0/+1
| | | | llvm-svn: 118493
* Try to appease MSVCDouglas Gregor2010-11-091-0/+5
| | | | llvm-svn: 118487
* sprintf -> snprintf conversion, from Vladimir KirillovDouglas Gregor2010-11-091-3/+3
| | | | llvm-svn: 118478
* Document Clang's support for attributes on individual enumerators andJohn McCall2010-11-081-0/+3
| | | | | | | tweak the documentation for deprecation-with-message. Provide __has_feature tests for both. rdar://problem/8605692 llvm-svn: 118435
* 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
* Implement -working-directory.Argyrios Kyrtzidis2010-11-034-18/+31
| | | | | | | | | | | | | | | | | | | When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. llvm-svn: 118203
* Plug a leak in the preprocessing record's handling of inclusionDouglas Gregor2010-11-011-2/+18
| | | | | | | directives. We had a std::string in an object that was allocated via a BumpPtrAllocator. llvm-svn: 117912
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-301-1/+1
| | | | | | PR8423 llvm-svn: 117775
* Make the deserialization of macro definitions lazy, so that we canDouglas Gregor2010-10-301-0/+15
| | | | | | | | | load identifiers without loading their corresponding macro definitions. This is likely to improve PCH performance slightly, and reduces deserialization stack depth considerably when using preprocessor metaprogramming. llvm-svn: 117750
* Update remaining attribute macros to new style.Chandler Carruth2010-10-231-4/+2
| | | | llvm-svn: 117204
* Extend the preprocessing record and libclang with support forDouglas Gregor2010-10-203-16/+70
| | | | | | | | | 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
* Add a __has_attribute macro that works much like __has_feature and ↵Anders Carlsson2010-10-202-3/+15
| | | | | | __has_builtin. llvm-svn: 116906
* Really^2 fix <rdar://problem/8361834>, this time without crashing.Ted Kremenek2010-10-192-14/+33
| | | | | | | | | 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 loop. No functionality change.Ted Kremenek2010-10-191-4/+1
| | | | llvm-svn: 116861
* Simplify lifetime management of MacroInfo objects in Preprocessor by having ↵Ted Kremenek2010-10-192-26/+11
| | | | | | | | | | | | 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
* In ~Preprocessor(), also cleanup the MacroInfo objects left-over from stray ↵Ted Kremenek2010-10-191-0/+7
| | | | | | | | "#pragma push_macro" uses. This fixes a potential memory leak. llvm-svn: 116826
OpenPOWER on IntegriCloud