summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Transcribe clattner email to SVN.Daniel Dunbar2010-07-291-1/+1
| | | | llvm-svn: 109727
* Change #pragma crash to segv, instead of abort.Daniel Dunbar2010-07-291-1/+1
| | | | llvm-svn: 109725
* Preprocessor: Add support for '#pragma clang __debug crash' and '#pragma clangDaniel Dunbar2010-07-281-0/+28
| | | | | | | | __debug overflow_stack'. - For testing crash reporting stuff... you'd think I could just use some C++ code but Doug keeps fixing stuff! llvm-svn: 109587
* Record macros in dependent PCHs. Also add various info tables to dependent ↵Sebastian Redl2010-07-271-0/+1
| | | | | | PCHs; tests for this to follow. llvm-svn: 109554
* Add PTHLexer::LexEndOfFile() to emit diagnostics at end-of-file similar to ↵Ted Kremenek2010-07-271-4/+25
| | | | | | those by Lexer::LexEndOfFile(). llvm-svn: 109486
* Introduce basic support for loading a precompiled preamble whileDouglas Gregor2010-07-262-3/+21
| | | | | | | | | | | | | | | | | | | | | | | reparsing an ASTUnit. When saving a preamble, create a buffer larger than the actual file we're working with but fill everything from the end of the preamble to the end of the file with spaces (so the lexer will quickly skip them). When we load the file, create a buffer of the same size, filling it with the file and then spaces. Then, instruct the lexer to start lexing after the preamble, therefore continuing the parse from the spot where the preamble left off. It's now possible to perform a simple preamble build + parse (+ reparse) with ASTUnit. However, one has to disable a bunch of checking in the PCH reader to do so. That part isn't committed; it will likely be handled with some other kind of flag (e.g., -fno-validate-pch). As part of this, fix some issues with null termination of the memory buffers created for the preamble; we were trying to explicitly NULL-terminate them, even though they were also getting implicitly NULL terminated, leading to excess warnings about NULL characters in source files. llvm-svn: 109445
* Fix namespace polution.Dan Gohman2010-07-261-0/+4
| | | | llvm-svn: 109440
* Improve performance during cursor traversal when a region of interestDouglas Gregor2010-07-221-0/+53
| | | | | | | | | | | | | | | | | | | | | is present. Rather than using clang_getCursorExtent(), which requires us to lex the token at the ending position to determine its length. Then, we'd be comparing [a, b) source ranges that cover the characters in the range rather than the normal behavior for Clang's source ranges, which covers the tokens in the range. However, relexing causes us to read the source file (which may come from a precompiled header), which is rather unfortunate and affects performance. In the new scheme, we only use Clang-style source ranges that cover the tokens in the range. At the entry points where this matters (clang_annotateTokens, clang_getCursor), we make sure to move source locations to the start of the token. Addresses most of <rdar://problem/8049381>. llvm-svn: 109134
* Introduce a new lexer function to compute the "preamble" of a file,Douglas Gregor2010-07-201-0/+125
| | | | | | | | | which is the part of the file that contains all of the initial comments, includes, and preprocessor directives that occur before any of the actual code. Added a new -print-preamble cc1 action that is only used for testing. llvm-svn: 108913
* Complain when string literals are too long for the active languageDouglas Gregor2010-07-201-0/+14
| | | | | | standard's minimum requirements. llvm-svn: 108837
* BUILD_ARCHIVE is the default for libraries, no need to set it.Chris Lattner2010-07-181-1/+0
| | | | llvm-svn: 108633
* Add another terrible VC++ compatibility hack: allow users toChris Lattner2010-07-171-2/+7
| | | | | | | allow invalid token pastes (when in -fms-extensions mode) with -Wno-invalid-token-paste llvm-svn: 108624
* Modify the pragma handlers to accept and use StringRefs instead of ↵Argyrios Kyrtzidis2010-07-132-75/+61
| | | | | | | | | | | IdentifierInfos. When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded). We can avoid this if we just use StringRefs for the pragmas. As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified. llvm-svn: 108237
* 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
OpenPOWER on IntegriCloud