summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPLexerChange.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* pass the reason for failure up from MemoryBuffer and report itChris Lattner2009-12-011-2/+4
| | | | | | | | | | | | in diagnostics when we fail to open a file. This allows us to report things like: $ clang test.c -I. test.c:2:10: fatal error: error opening file './foo.h': Permission denied #include "foo.h" ^ llvm-svn: 90276
* Fix PR5633 by making the preprocessor handle the case where we canChris Lattner2009-11-301-4/+13
| | | | | | | | | | stat a file but where mmaping it fails. In this case, we emit an error like: t.c:1:10: fatal error: error opening file '../../foo.h' instead of "cannot find file". llvm-svn: 90110
* remove stall commentNuno Lopes2009-11-291-2/+1
| | | | llvm-svn: 90080
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-34/+34
| | | | llvm-svn: 81346
* Add PCH support for #import.Steve Naroff2009-04-241-1/+1
| | | | llvm-svn: 69987
* when preprocessing a .S file, unknown directives should just be passed through,Chris Lattner2009-03-181-1/+0
| | | | | | | | | | | | | | and the token after the # should be expanded if it is not a valid directive. This allows us to transform things like: #define FOO BAR # FOO into # BAR, even though FOO is not normally expanded for directives. This should fix PR3833 llvm-svn: 67236
* use accessor instead of poking ivar directlyChris Lattner2009-03-131-1/+2
| | | | llvm-svn: 66954
* track "just a little more" location information for macro instantiations.Chris Lattner2009-02-151-3/+4
| | | | | | | | | | | | Now instead of just tracking the expansion history, also track the full range of the macro that got replaced. For object-like macros, this doesn't change anything. For _Pragma and function-like macros, this means we track the locations of the ')'. This is required for PR3579 because apparently GCC uses the line of the ')' of a function-like macro as the location to expand __LINE__ to. llvm-svn: 64601
* add an assertion from Alexei Svitkine!Chris Lattner2009-02-131-2/+2
| | | | llvm-svn: 64503
* add interface for walking macro table.Chris Lattner2009-02-061-3/+1
| | | | llvm-svn: 63925
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* do not use SourceManager::getFileCharacteristic(FileID), it is notChris Lattner2009-01-191-6/+7
| | | | | | | safe because a #line can change the file characteristic on a per-loc basis. llvm-svn: 62502
* simplify PTHManager::CreateLexerChris Lattner2009-01-171-1/+1
| | | | llvm-svn: 62424
* Change the Lexer ctor used in the non _Pragma case to take a FileID insteadChris Lattner2009-01-171-9/+3
| | | | | | of a SourceLocation. This should speed it up and definitely simplifies it. llvm-svn: 62422
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-9/+6
| | | | | | | | | | | | | | | "FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. llvm-svn: 62407
* Remove old PTH token-generation test harness.Ted Kremenek2008-12-231-71/+0
| | | | llvm-svn: 61382
* PTH: Remove some methods and simplify some conditions in PTHLexer::Lex(). ↵Ted Kremenek2008-12-231-1/+1
| | | | | | No big functionality change. llvm-svn: 61381
* PreprocessorLexer (and subclasses):Ted Kremenek2008-12-101-10/+2
| | | | | | | | - Added virtual method 'getSourceLocation()' (no arguments) that gets the location of the next "observable" location (e.g., next character, next token). PPLexerChange.cpp: - Implemented FIXME by using PreprocessorLexer::getSourceLocation() to get the location in the file we are returning to after lexing a #included file. This appears to be slightly faster than having the branch (i.e., 'if(CurLexer)'). It's also not a really hot part of the Preprocessor. llvm-svn: 60860
* Preprocessor:Ted Kremenek2008-12-021-2/+32
| | | | | | | | | - Added method "setPTHManager" that will be called by the driver to install a PTHManager for the Preprocessor. - Fixed some comments. - Added EnterSourceFileWithPTH to mirror EnterSourceFileWithLexer. llvm-svn: 60437
* PTHLexer now owns the Token vector.Ted Kremenek2008-11-271-12/+14
| | | | llvm-svn: 60136
* Reenable the default lexer.Ted Kremenek2008-11-211-1/+1
| | | | llvm-svn: 59843
* When creating the raw tokens for PTHLexer, make sure the token representing ↵Ted Kremenek2008-11-211-1/+4
| | | | | | the file to include is checked for being an identifier. llvm-svn: 59842
* When creating raw tokens for the PTHLexer specially handle angled strings ↵Ted Kremenek2008-11-211-6/+30
| | | | | | for #include directives. llvm-svn: 59840
* Rename IsNonPragmaNonMacroLexer to IsFileLexer.Ted Kremenek2008-11-201-5/+5
| | | | llvm-svn: 59731
* Add ugly "test harness" for PTHLexer that is not enabled by default. TheTed Kremenek2008-11-201-6/+49
| | | | | | | | | | (temporary hack) to test the PTHLexer is that whenever we would create a Lexer object we instead raw lex a memory buffer first and then use the PTHLexer. This logic exists only to driver the PTHLexer and will be removed/changed in the future. Note that the regular path using normal Lexer objects is what is used by default. llvm-svn: 59723
* Make FIXME a hard assertion.Ted Kremenek2008-11-201-2/+6
| | | | llvm-svn: 59695
* Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead ofTed Kremenek2008-11-201-5/+6
| | | | | | | a Lexer*. This means it will either return the current (normal) file Lexer or a PTHLexer. llvm-svn: 59694
* Move more cases of using 'CurLexer' to 'CurPPLexer'.Ted Kremenek2008-11-191-26/+35
| | | | | | Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer. llvm-svn: 59671
* - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.Ted Kremenek2008-11-191-14/+5
| | | | | | | | | | | | | - Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry (simplifies some uses). - Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile. - Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid when looking up the FileEntry for a file Performance testing of -Eonly on Cocoa.h shows no performance regression because of this patch. llvm-svn: 59666
* Revert 59574 (caused tests to fail).Ted Kremenek2008-11-191-5/+14
| | | | llvm-svn: 59579
* - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.Ted Kremenek2008-11-191-14/+5
| | | | | | | | | | | - Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry (simplifies some uses). - Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile. Performance testing of -Eonly on Cocoa.h shows no performance regression because of this patch. llvm-svn: 59574
* - Add Lexer::isPragma() accessor for clients of Lexer that aren't friends.Ted Kremenek2008-11-181-8/+14
| | | | | | | | | - Add static method to test if the current lexer is a non-macro/non-pragma lexer. - Refactor some code in PPLexerChange to use this static method. - No performance change. llvm-svn: 59486
* - Add 'CurPPLexer' to Preprocessor to keep track of the currentTed Kremenek2008-11-181-0/+1
| | | | | | | | | PreprocessorLexer, which will either be a 'Lexer' or 'PTHLexer'. - Added stub field 'CurPTHLexer' to keep track of the current PTHLexer. - Modified IncludeStackInfo to track both the current PTHLexer and current PreprocessorLexer. llvm-svn: 59472
* Using llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ↵Ted Kremenek2008-11-131-15/+13
| | | | | | ownership semantics of these objects explicit within the Preprocessor and also tightens up the code (explicit deletes not needed). llvm-svn: 59249
* Use PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping ↵Ted Kremenek2008-11-131-14/+6
| | | | | | from IncludeMacroStack. This is both cleaner and makes the include stack transparently extensible. llvm-svn: 59248
* Rename Characteristic_t to CharacteristicKindChris Lattner2008-10-271-2/+2
| | | | llvm-svn: 58224
* Change FormTokenWithChars to take the token kind to form, since all clientsChris Lattner2008-10-121-2/+1
| | | | | | | were setting a kind and then forming it. This is just a minor API cleanup, no functionality change. llvm-svn: 57404
* clean up a bunch of fixme's I added, by moving Chris Lattner2008-09-261-8/+4
| | | | | | DirectoryLookup::DirType into SourceManager.h llvm-svn: 56692
* Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfoChris Lattner2008-09-261-13/+9
| | | | | | | | | | | to whether the fileid is a 'extern c system header' in addition to whether it is a system header, most of this is spreading plumbing around. Once we have that, PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to base the system header state on FileIDInfo instead of HeaderSearch. Finally, in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness of a file being entered can be set due to the #includer or the #includee. llvm-svn: 56688
* More #include cleaningDaniel Dunbar2008-08-111-1/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* Allow the preprocessor to cache the lexed tokens, so that we can do ↵Argyrios Kyrtzidis2008-08-101-88/+0
| | | | | | | | | | | | | | | efficient lookahead and backtracking. 1) New public methods added: -EnableBacktrackAtThisPos -DisableBacktrack -Backtrack -isBacktrackEnabled 2) LookAhead() implementation is replaced with a more efficient one. 3) LookNext() is removed. llvm-svn: 54611
* Convert CRLF -> LF line endings.Argyrios Kyrtzidis2008-07-121-21/+21
| | | | llvm-svn: 53519
* Add Preprocessor::LookNext method, which implements an efficient way to ↵Argyrios Kyrtzidis2008-07-091-0/+26
| | | | | | 'take a peek' at the next token without consuming it. llvm-svn: 53375
* Avoid overflowing buffer, patch by Algeris Kirtzidis!Chris Lattner2008-03-241-1/+1
| | | | llvm-svn: 48741
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+401
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud