summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove the check for repeated tok::eofs, we are not supposed to go past eof ↵Argyrios Kyrtzidis2010-07-121-9/+4
| | | | | | | | so this code is totally unnecessary. llvm-svn: 108199
* If we are past tok::eof and in caching lex mode, avoid caching repeated ↵Argyrios Kyrtzidis2010-07-121-4/+12
| | | | | | tok::eofs. llvm-svn: 108175
* we do in fact have to cache the EOF token returned by the preprocessor.Chris Lattner2010-07-121-6/+3
| | | | | | | | | | In the case of backtracking, the cached token lexer will be the only lexer on the stack, without this the token stack will be empty and EOF won't be returned. This fixes PR7072. llvm-svn: 108124
* fix PR4499, patch by Kyle Dean!Chris Lattner2010-07-071-24/+16
| | | | llvm-svn: 107836
* Implement support for #pragma message, patch by Michael Spencer!Chris Lattner2010-06-261-1/+72
| | | | llvm-svn: 106950
* More clang support for darwin tls. Add a __has_feature macro andEric Christopher2010-06-241-0/+2
| | | | | | target specific preprocessor define as well. llvm-svn: 106715
* Remove a dead argument to ProcessUCNEscape.Chris Lattner2010-06-151-10/+5
| | | | | | | | | | Fix string concatenation to treat escapes in concatenated strings that are wide because of other string chunks to process the escapes as wide themselves. Before we would warn about and miscompile the attached testcase. This fixes rdar://8040728 - miscompile + warning: hex escape sequence out of range llvm-svn: 106012
* Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.Daniel Dunbar2010-06-111-0/+8
| | | | llvm-svn: 105830
* Fix memory leak in Preprocessor where MacroInfo objects in the MICache ↵Ted Kremenek2010-06-081-0/+8
| | | | | | | | wouldn't have their associated SmallVectors get deallocated. llvm-svn: 105658
* Makefiles: Set Clang CPP compiler flags in a single location, instead of ↵Daniel Dunbar2010-06-081-2/+0
| | | | | | scattered throughout the project Makefiles. llvm-svn: 105638
* Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.Daniel Dunbar2010-06-081-3/+3
| | | | | | - This eliminates most dependencies on how Clang is installed relative to LLVM. llvm-svn: 105637
* simpler fix for rdar://8044135 - escaped newlines have alreadyChris Lattner2010-05-301-10/+7
| | | | | | been processed, so they don't have to be tip-toed around. llvm-svn: 105182
* Improve our handling of NULL after an escaping '\' in a stringDouglas Gregor2010-05-301-2/+7
| | | | | | literal. Fixes <rdar://problem/8044135>. llvm-svn: 105181
* Fix a miscompile of wchar pascal strings.Fariborz Jahanian2010-05-281-0/+2
| | | | | | (radar 8020384) llvm-svn: 104996
* Tell the string literal parser when it's not permitted to emitDouglas Gregor2010-05-261-20/+35
| | | | | | | | diagnostics. That would be while we're parsing string literals for the sole purpose of producing a diagnostic about them. Fixes <rdar://problem/8026030>. llvm-svn: 104684
* Improve code completion in failure cases in two ways:Douglas Gregor2010-05-251-0/+3
| | | | | | | | | | | 1) Suppress diagnostics as soon as we form the code-completion token, so we don't get any error/warning spew from the early end-of-file. 2) If we consume a code-completion token when we weren't expecting one, go into a code-completion recovery path that produces the best results it can based on the context that the parser is in. llvm-svn: 104585
* robustify the conflict marker stuff. Don't add 7 twice, which wouldChris Lattner2010-05-171-1/+2
| | | | | | | | | | | | | | | | | | | | | make it miss (invalid) things like: <<<<<<< >>>>>>> and crash if <<<<<<< was at the end of the line. When we find a >>>>>>> that is not at the end of the line, make sure to reset Pos so we don't crash on something like: <<<<<<< >>>>>>> This isn't worth making testcases for, since each would require a new file. rdar://7987078 - signal 11 compiling "<<<<<<<<<<" llvm-svn: 103968
* when code completing inside a C-style block comment, don't emit errors aboutChris Lattner2010-05-161-2/+3
| | | | | | | | a missing */ since we truncated the file. This fixes rdar://7948776 llvm-svn: 103913
* Add '__has_feature' support for weak ObjC classes.Ted Kremenek2010-04-291-0/+1
| | | | llvm-svn: 102588
* Sort '__has_feature' cases. No functionality change.Ted Kremenek2010-04-291-15/+15
| | | | llvm-svn: 102587
* push some source location information down through the compiler,Chris Lattner2010-04-203-19/+17
| | | | | | | | 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
* emit warn_char_constant_too_large at most once per literal, fixing PR6852Chris Lattner2010-04-161-1/+4
| | | | llvm-svn: 101580
* Improve line marker directive locations, patch by Jordy RoseChris Lattner2010-04-141-2/+3
| | | | llvm-svn: 101226
* make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."Chris Lattner2010-04-141-2/+4
| | | | | | when avoiding paste. Patch by David Peixotto! llvm-svn: 101218
* fix a minor bug I noticed while work with Jordy's patch for PR6101,Chris Lattner2010-04-121-2/+4
| | | | | | | | | | | | | | | | | in an input file like this: # 42 int x; we were emitting: # <something> int x; (with a space before the int) because we weren't clearing the leading whitespace flag properly after the \n from the directive was handled. llvm-svn: 101084
* Match MemoryBuffer API changes.Chris Lattner2010-04-051-5/+4
| | | | llvm-svn: 100484
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-312-5/+4
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-312-4/+5
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-312-5/+4
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* fix a case where macro expansion should be disabled, patch by Chris Lattner2010-03-261-4/+7
| | | | | | Abramo Bagnara! llvm-svn: 99626
* fix a bug in paste avoidance which would cause us to accidentallyChris Lattner2010-03-261-1/+1
| | | | | | form a >>=. Patch by Abramo Bagnara, testcase by me. llvm-svn: 99624
* PPCallbacks: Add hook for reaching the end of the main file, and fix ↵Daniel Dunbar2010-03-232-0/+6
| | | | | | DependencyFile to not do work in its destructor. llvm-svn: 99257
* Robustify PreprocessingRecord slightly, by only creating macroDouglas Gregor2010-03-191-3/+12
| | | | | | | | instantiations when we have the corresponding macro definition and by removing macro definition information from our table when the macro is undefined. llvm-svn: 99004
* Implement serialization and lazy deserialization of the preprocessingDouglas Gregor2010-03-191-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | record (which includes all macro instantiations and definitions). As with all lay deserialization, this introduces a new external source (here, an external preprocessing record source) that loads all of the preprocessed entities prior to iterating over the entities. The preprocessing record is an optional part of the precompiled header that is disabled by default (enabled with -detailed-preprocessing-record). When the preprocessor given to the PCH writer has a preprocessing record, that record is written into the PCH file. When the PCH reader is given a PCH file that contains a preprocessing record, it will be lazily loaded (which, effectively, implicitly adds -detailed-preprocessing-record). This is the first case where we have sections of the precompiled header that are added/removed based on a compilation flag, which is unfortunate. However, this data consumes ~550k in the PCH file for Cocoa.h (out of ~9.9MB), and there is a non-trivial cost to gathering this detailed preprocessing information, so it's too expensive to turn on by default. In the future, we should investigate a better encoding of this information. llvm-svn: 99002
* Make the preprocessing record a PPCallbacks subclass itself,Douglas Gregor2010-03-192-39/+27
| | | | | | | | eliminating the extra PopulatePreprocessingRecord object. This will become useful once we start writing the preprocessing record to precompiled headers. llvm-svn: 98966
* Optionally store a PreprocessingRecord in the preprocessor itself, andDouglas Gregor2010-03-192-16/+45
| | | | | | tie its creation to a CC1 flag -detailed-preprocessing-record. llvm-svn: 98963
* 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
OpenPOWER on IntegriCloud