summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead ↵Ted Kremenek2008-12-153-11/+23
| | | | | | using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%. llvm-svn: 61042
* eliminate the isCXXNamedOperator function and some string compares andChris Lattner2008-12-131-8/+2
| | | | | | use identifierinfo instead. Patch by Chris Goller! llvm-svn: 60992
* PTH: Added minor 'sibling jumping' optimization for iterating over the side ↵Ted Kremenek2008-12-121-9/+37
| | | | | | table used for fast preprocessor block skipping. This has a minor performance improvement when preprocessing Cocoa.h, but can have some wins in pathologic cases. llvm-svn: 60966
* Added PTH optimization to not process entire blocks of tokens that appear in ↵Ted Kremenek2008-12-122-13/+176
| | | | | | skipped preprocessor blocks. This improves PTH speed by 6%. The code for this optimization itself is not very optimized, and will get cleaned up. llvm-svn: 60956
* rdar://6060752 - don't warn about trigraphs in bcpl-style commentsChris Lattner2008-12-121-1/+6
| | | | llvm-svn: 60942
* fix thought-oChris Lattner2008-12-121-1/+1
| | | | llvm-svn: 60937
* PTH:Ted Kremenek2008-12-111-12/+18
| | | | | | | - Added a side-table per each token-cached file with the preprocessor conditional stack. This tracks what #if's are matched with what #endifs and where their respective tokens are in the PTH file. This will allow for quick skipping of excluded conditional branches in the Preprocessor. - Performance testing shows the addition of this information (without actually utilizing it) leads to no performance regressions. llvm-svn: 60911
* PTHLexer: Keep track of the location of the last '#' token and provide the ↵Ted Kremenek2008-12-111-6/+9
| | | | | | means to jump ahead in the token stream. llvm-svn: 60905
* Remove unused ivar CurTokenIdx.Ted Kremenek2008-12-111-1/+1
| | | | llvm-svn: 60896
* 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
* Declare PerIDCache as IdentifierInfo** instead of void*. This is just ↵Ted Kremenek2008-12-101-2/+2
| | | | | | cleaner. No performance change. llvm-svn: 60843
* Remove unneeded assertion.Ted Kremenek2008-12-041-1/+1
| | | | llvm-svn: 60559
* Use 'free' to release PerIDCache since it was allocated using calloc().Ted Kremenek2008-12-041-1/+1
| | | | llvm-svn: 60556
* PTH:Ted Kremenek2008-12-031-13/+23
| | | | | | Use an array instead of a DenseMap to cache persistent IDs -> IdentifierInfo*. This leads to a 4% speedup at -fsyntax-only using PTH. llvm-svn: 60452
* - Remove PTHManager.cpp. Move all of its functions to PTHLexer.cpp since ↵Ted Kremenek2008-12-032-255/+241
| | | | | | | | some of the internal methods are used by PTHLexer (their implementations are intertwined.) This enables some important inlining opportunities at -O3. - Don't construct an std::vector<Token> prior to feeding PTH tokens to the Preprocessor. Stream them off the PTH file directly. llvm-svn: 60447
* 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
* Added PTHManager, a utility class that will be used by Preprocessor to ↵Ted Kremenek2008-12-021-0/+248
| | | | | | lazily create PTHLexer objects for pre-tokenized files. llvm-svn: 60436
* Objective-C keywords are not always identifiers. Some are also C++ keywordsDouglas Gregor2008-12-011-2/+3
| | | | llvm-svn: 60373
* Add LangOptions marker for assembler-with-cpp mode and use to defineDaniel Dunbar2008-12-011-1/+2
| | | | | | | __ASSEMBLER__ properly. Patch from Roman Divacky (with minor formatting changes). Thanks! llvm-svn: 60362
* PTHLexer now owns the Token vector.Ted Kremenek2008-11-272-23/+18
| | | | llvm-svn: 60136
* Comment fix.Daniel Dunbar2008-11-251-1/+1
| | | | llvm-svn: 59997
* make the 'to match this' diagnostic a note.Chris Lattner2008-11-231-3/+3
| | | | llvm-svn: 59921
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* Fix a weird inconsistency with hex floats. Previously the lexer Chris Lattner2008-11-222-5/+3
| | | | | | | | | would not eat the "-1" in "0x0p-1", but LiteralSupport would accept it when extensions are on. This caused strangeness and failures when hexfloats were properly treated as an extension (not error) in LiteralSupport. llvm-svn: 59865
* remove the NumericLiteralParser::Diag helper method, inlining it intoChris Lattner2008-11-221-29/+32
| | | | | | | | its call sites. This makes it more explicit when the hasError flag is getting set and removes a confusing difference in behavior between PP.Diag and Diag in this code. llvm-svn: 59863
* Move the Preprocessor::Diag methods inline. This has the interestingChris Lattner2008-11-221-12/+0
| | | | | | | | | | | | | | | | (and carefully calculated) effect of allowing the compiler to reason about the aliasing properties of DiagnosticBuilder object better, allowing the whole thing to be promoted to registers instead of resulting in a ton of stack traffic. While I'm not very concerned about the performance of the Diag() method invocations, I *am* more concerned about their code size and impact on the non-diagnostic code. This patch shrinks the clang executable (in release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes. This isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o from 31116 to 28868 bytes, etc. llvm-svn: 59862
* inline a method into its only two call sites.Chris Lattner2008-11-221-2/+3
| | | | llvm-svn: 59860
* actually, this version isn't really needed.Chris Lattner2008-11-221-6/+2
| | | | llvm-svn: 59859
* remove a sneaky version of Diag hiding in PreprocessorLexer.Chris Lattner2008-11-222-10/+7
| | | | llvm-svn: 59858
* Change the Lexer::Diag method to not magically silence warnings,Chris Lattner2008-11-222-29/+46
| | | | | | | force the caller to check instead. This eliminates the need (and the risk!) of weird null DiagnosticBuilder's floating around. llvm-svn: 59856
* Split the DiagnosticInfo class into two disjoint classes:Chris Lattner2008-11-222-4/+4
| | | | | | | | | | one for building up the diagnostic that is in flight (DiagnosticBuilder) and one for pulling structured information out of the diagnostic when formatting and presenting it. There is no functionality change with this patch. llvm-svn: 59849
* In PTHLexer::DiscardToEndOfLine() use Lex() instead of AdvanceToken(). This ↵Ted Kremenek2008-11-211-1/+2
| | | | | | handles transitions in the preprocessor state. llvm-svn: 59845
* 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
* PTHLexer:Ted Kremenek2008-11-211-14/+26
| | | | | | - Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class. The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases. llvm-svn: 59768
* PTHLexer:Ted Kremenek2008-11-201-0/+12
| | | | | | | - Move PTHLexer::GetToken() to be inside PTHLexer.cpp. - When lexing in raw mode, null out identifiers. llvm-svn: 59744
* Handle another case where we should use PTHLexer as an alternative to the ↵Ted Kremenek2008-11-201-1/+3
| | | | | | normal Lexer. llvm-svn: 59736
* PTHLexer:Ted Kremenek2008-11-201-19/+11
| | | | | | | | | | - Rename 'CurToken' and 'LastToken' to 'CurTokenIdx' and 'LastTokenIdx' respectively. - Add helper methods GetToken(), AdvanceToken(), AtLastToken() to abstract away details of the token stream. This also allows us to easily replace their implementation later. llvm-svn: 59733
* Rename IsNonPragmaNonMacroLexer to IsFileLexer.Ted Kremenek2008-11-202-7/+7
| | | | llvm-svn: 59731
* Rewrote PTHLexer::Lex by digging through the sources of Lexer again. Now we ↵Ted Kremenek2008-11-201-28/+37
| | | | | | can do basic macro expansion using the PTHLexer. llvm-svn: 59724
* 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
* Just use the SourceLocation of SysHeaderTok when doing a callback to emit #lineTed Kremenek2008-11-201-2/+2
| | | | | | | information. A diff of the -E output for Cocoa.h shows that there is no change in output. llvm-svn: 59693
* Assign the result of getCurrentFileLexer() to a PreprocessorLexer* instead ↵Ted Kremenek2008-11-201-1/+1
| | | | | | of Lexer* (narrower interface). llvm-svn: 59691
* - Default initialize ParsingPreprocessorDirective, ParsingFilename, andTed Kremenek2008-11-202-16/+16
| | | | | | | | LexingRawMode in the ctor of PreprocessorLexer. - PTHLexer: Use "LastToken" instead of "NumToken" llvm-svn: 59690
* Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and ↵Ted Kremenek2008-11-201-4/+14
| | | | | | PTHLexer::DiscardToEndOfLine(). llvm-svn: 59687
* Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is ↵Ted Kremenek2008-11-193-7/+7
| | | | | | an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*. llvm-svn: 59672
* Move more cases of using 'CurLexer' to 'CurPPLexer'.Ted Kremenek2008-11-193-27/+38
| | | | | | Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer. llvm-svn: 59671
OpenPOWER on IntegriCloud