summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Explicitly link macro instantiations to macro definitions in theDouglas Gregor2010-03-181-3/+5
| | | | | | | | preprocessing record. Use that link with clang_getCursorReferenced() and clang_getCursorDefinition() to match instantiations of a macro to the definition of the macro. llvm-svn: 98842
* Introduce the notion of a "preprocessing record", which keeps track ofDouglas Gregor2010-03-182-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | the macro definitions and macro instantiations that are found during preprocessing. Preprocessing records are *not* generated by default; rather, we provide a PPCallbacks subclass that hooks into the existing callback mechanism to record this activity. The only client of preprocessing records is CIndex, which keeps track of macro definitions and instantations so that they can be exposed via cursors. At present, only token annotation uses these facilities, and only for macro instantiations; both will change in the near future. However, with this change, token annotation properly annotates macro instantiations that do not produce any tokens and instantiations of macros that are later undef'd, improving our consistency. Preprocessing directives that are not macro definitions are still handled by clang_annotateTokens() via re-lexing, so that we don't have to track every preprocessing directive in the preprocessing record. Performance impact of preprocessing records is still TBD, although it is limited to CIndex and therefore out of the path of the main compiler. llvm-svn: 98836
* Entering the main source file in the preprocessor can fail if theDouglas Gregor2010-03-171-5/+4
| | | | | | source file has been changed. Handle that failure more gracefully. llvm-svn: 98727
* Remove unused variableDouglas Gregor2010-03-161-1/+0
| | | | llvm-svn: 98691
* Audit all Preprocessor::getSpelling() callers, improving failureDouglas Gregor2010-03-166-24/+58
| | | | | | recovery for those that need it. llvm-svn: 98689
* Audit all callers of SourceManager::getCharacterData(); update some ofDouglas Gregor2010-03-163-3/+10
| | | | | | them to recover more gracefully on failure. llvm-svn: 98672
* Audit all getBuffer() callers (for both the FullSourceLoc andDouglas Gregor2010-03-161-2/+4
| | | | | | | SourceManager versions), updating those callers that need to recover gracefully from failure. llvm-svn: 98665
* Teach the one caller of SourceManager::getMemoryBufferForFile() to cope with ↵Douglas Gregor2010-03-161-2/+3
| | | | | | errors llvm-svn: 98664
* Let SourceManager::getBufferData return StringRef instead of a pair of two ↵Benjamin Kramer2010-03-162-6/+5
| | | | | | const char*. llvm-svn: 98630
* Introduce optional "Invalid" parameters to routines that invoke theDouglas Gregor2010-03-163-13/+49
| | | | | | | | | | | | | SourceManager's getBuffer() and, therefore, could fail, along with Preprocessor::getSpelling(). Use the Invalid parameters in the literal parsers (string, floating point, integral, character) to make them robust against errors that stem from, e.g., PCH files that are not consistent with the underlying file system. I still need to audit every use caller to all of these routines, to determine which ones need specific handling of error conditions. llvm-svn: 98608
* Use SourceManager's Diagnostic object for all file-reading errors,Douglas Gregor2010-03-161-2/+1
| | | | | | simplifying the SourceManager interfaces somewhat. llvm-svn: 98598
* Give SourceManager a Diagnostic object with which to report errors,Douglas Gregor2010-03-162-7/+6
| | | | | | and start simplifying the interfaces in SourceManager that can fail. llvm-svn: 98594
* Introduce a new BufferResult class to act as the return type ofDouglas Gregor2010-03-153-5/+15
| | | | | | | | | | | | | | SourceManager's getBuffer() (and similar) operations. This abstract can be used to force callers to cope with errors in getBuffer(), such as missing files and changed files. Fix a bunch of callers to use the new interface. Add some very basic checks for file consistency (file size, modification time) into ContentCache::getBuffer(), although these checks don't help much until we've updated the main callers (e.g., SourceManager::getSpelling()). llvm-svn: 98585
* Use SmallString instead of SmallVectorKovarththanan Rajaratnam2010-03-133-29/+29
| | | | llvm-svn: 98436
* No need to call setIdentifierInfo() after LookUpIdentifierInfo() which ↵Kovarththanan Rajaratnam2010-03-131-3/+2
| | | | | | LookUpIdentifierInfo() will automatically do llvm-svn: 98435
* Allow users to set CPPFLAGS and CXXFLAGS on the make command line.Jeffrey Yasskin2010-03-121-2/+2
| | | | | Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test) llvm-svn: 98399
* Switch over IdentifierInfoLookup to StringRefKovarththanan Rajaratnam2010-03-121-5/+5
| | | | llvm-svn: 98337
* Augment __has_feature to report that Clang supports adding attribute 'unused'Ted Kremenek2010-03-051-0/+1
| | | | | | to an Objective-C instance variable. llvm-svn: 97850
* Move method out-of-line. I thought this would be a candidate for inlining ↵Benjamin Kramer2010-02-271-1/+18
| | | | | | but I was wrong. llvm-svn: 97330
* Another trivial getSpelling simplification.Benjamin Kramer2010-02-271-4/+2
| | | | llvm-svn: 97327
* Add an overload of Preprocessor::getSpelling which takes a SmallVector andBenjamin Kramer2010-02-275-24/+10
| | | | | | returns a StringRef. Use it to simplify some repetitive code. llvm-svn: 97322
* fix rdar://7683173, rejecting an invalid conditionalChris Lattner2010-02-261-1/+1
| | | | llvm-svn: 97253
* Add __has_feature support for attributes ns_returns_not_retainedTed Kremenek2010-02-181-1/+3
| | | | | | and cf_returns_not_retained. llvm-svn: 96538
* 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
* When placing an annotation token over an existing annotation token, make ↵Sebastian Redl2010-02-081-1/+1
| | | | | | sure that the new token's range extends to the end of the old token. Assert that in AnnotateCachedTokens. Fixes PR6248. llvm-svn: 95555
* don't inform comment handlers about comments in #if 0 blocks,Chris Lattner2010-02-031-7/+9
| | | | | | | | | doing so invalidates the file guard optimization and is not in the spirit of "#if 0" because it is supposed to completely skip everything, even if it isn't lexically valid. Patch by Abramo Bagnara! llvm-svn: 95253
* Fix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead ↵Ted Kremenek2010-01-291-1/+1
| | | | | | of '='. llvm-svn: 94830
* Use raw_ostreams in Preprocessor::ExpandBuiltinMacro. Still not nice but ↵Benjamin Kramer2010-01-271-19/+17
| | | | | | less fragile than the old code. llvm-svn: 94679
* Fix typo in commentDouglas Gregor2010-01-261-1/+1
| | | | llvm-svn: 94576
* -fno-rtti is now the default.Chris Lattner2010-01-241-1/+0
| | | | llvm-svn: 94379
* ui64, etc. are valid VS suffixes.Fariborz Jahanian2010-01-221-1/+1
| | | | | | Fixes radar 7562363. llvm-svn: 94224
* Teach CIndex's cursor visitor to restrict its traversal to a specificDouglas Gregor2010-01-222-11/+11
| | | | | | | | | | | | | | region of interest (if provided). Implement clang_getCursor() in terms of this traversal rather than using the Index library; the unified cursor visitor is more complete, and will be The Way Forward. Minor other tweaks needed to make this work: - Extend Preprocessor::getLocForEndOfToken() to accept an offset from the end, making it easy to move to the last character in the token (rather than just past the end of the token). - In Lexer::MeasureTokenLength(), the length of whitespace is zero. llvm-svn: 94200
* revert my patch for rdar://7520940 that warns when a published headerChris Lattner2010-01-223-18/+4
| | | | | | | is #included with "foo.h" style syntax instead of framework syntax. It produced too much noise. llvm-svn: 94120
* allow the HandlerComment callback to push tokens into theChris Lattner2010-01-182-17/+34
| | | | | | | preprocessor. This could be used by an OpenMP implementation or something. Patch by Abramo Bagnara! llvm-svn: 93795
* 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
* Add a bunch more feature-checking macros for C++0x features. Some of these areAlexis Hunt2010-01-131-0/+10
| | | | | | | disabled with the intent that users can start with them now and not have to change a thing to have them work when we implement the features. llvm-svn: 93312
* add a TODO for a perf improvement in LexIdentifier.Chris Lattner2010-01-111-2/+5
| | | | llvm-svn: 93141
* Do not parse hexadecimal floating point literals in C++0x mode because they areAlexis Hunt2010-01-102-3/+9
| | | | | | | | | | | | | | | | | | incompatible with user-defined literals, specifically with the following form: 0x1p+1 The preprocessing-number token extends only as far as the 'p'; the '+' is not included. Previously we could get away with this extension as p was an invalid suffix, but now with user-defined literals, 'p' might well be a valid suffix and we are forced to consider it as such. This patch also adds a warning in non-0x C++ modes telling the user that this extension is incompatible with C++0x that is enabled by default (previously and with other languages, we warn only with a compliance option such as -pedantic). llvm-svn: 93135
* Simplify code. No functionality change.Benjamin Kramer2010-01-101-18/+1
| | | | llvm-svn: 93114
* stringref'ize a bunch of filename handling logic. MuchChris Lattner2010-01-105-92/+73
| | | | | | 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-103-3/+16
| | | | | | | import other headers within the same framework with the full framework path, not with a relative include. llvm-svn: 93083
* Simplify with StringSwitch.Benjamin Kramer2010-01-091-28/+12
| | | | llvm-svn: 93064
* Teach Preprocessor::macro_begin/macro_end to lazily load all macroDouglas Gregor2010-01-042-4/+32
| | | | | | | | definitions from a precompiled header. This ensures that code-completion with macro names behaves the same with or without precompiled headers. llvm-svn: 92497
* Avoid an unnecessary copy of Predefines. getMemBufferCopy does the null ↵Benjamin Kramer2009-12-311-12/+3
| | | | | | termination for us. llvm-svn: 92358
* Convert to StringRef, avoid a memcpy in the common case.Benjamin Kramer2009-12-311-19/+16
| | | | llvm-svn: 92357
* use best-fit instead of first-fit when reusing a MacroArgs object,Chris Lattner2009-12-281-7/+16
| | | | | | this speeds up Eonly on the testcase in PR5888 from 30.5s to 0.85s llvm-svn: 92203
* The PreExpArgTokens array is indexed with an argument #,Chris Lattner2009-12-283-7/+8
| | | | | | | not a token number. Fix the reserve logic to get the right amount of space. llvm-svn: 92202
* Diagnose out-of-bounds floating-point constants. Fixes rdar://problem/6974641John McCall2009-12-241-13/+4
| | | | llvm-svn: 92127
* comment tweakChris Lattner2009-12-231-1/+1
| | | | llvm-svn: 92055
OpenPOWER on IntegriCloud