aboutsummaryrefslogtreecommitdiff
path: root/Lex
AgeCommit message (Collapse)Author
2007-09-22work around bugs and missing features in apfloat.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42235 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-22Use APFloat for the representation of FP immediates, ask the targetChris Lattner
for *which* apfloat to use for a particular type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42234 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19Remove SelectorTable/SelectorInfo, simply store all selectors in the central ↵Steve Naroff
IdentifierTable. Rationale: We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually). It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data: Two tables: *** Selector/Identifier Stats: # Selectors/Identifiers: 51635 Bytes allocated: 1999824 One table: *** Identifier Table Stats: # Identifiers: 49500 Bytes allocated: 1990316 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42139 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Add support for ObjC keyword selectors.Steve Naroff
- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable. - Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo(). - Add SelectorInfo slot to ObjcMethodDecl. - Add helper function to derive a SelectorInfo from ObjcKeywordInfo. Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04Silence VC++ warnings, patch by Hartmut KaiserChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41693 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-03Add #include required on win32.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41686 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-03Eliminate some VC++ warnings, patch by Hartmut Kaiser!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41685 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-29Spaces not tabs.Neil Booth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-29Ensure we diagnose long long literals in C90 mode.Neil Booth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41581 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-261.0 is double, 1.0F is a float.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41412 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-261) refactor some code.Chris Lattner
2) Add support for lexing imaginary constants (a GCC extension): t.c:5:10: warning: imaginary constants are an extension A = 1.0iF; ^ 3) Make the 'invalid suffix' diagnostic pointer more accurate: t.c:6:10: error: invalid suffix 'qF' on floating constant A = 1.0qF; ^ instead of: t.c:6:10: error: invalid suffix 'qF' on floating constant A = 1.0qF; ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().Steve Naroff
Convert all clients to the new cleaner, more robust API. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41330 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23Update to match the API from LLVM mainline.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41312 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24Use a smallstring instead of an std::string in FileChanged to avoid some ↵Chris Lattner
malloc traffic. This speeds up -E on xalancbmk by 2.4% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23Fix a scoping bug that apple gcc doesn't catch for some reason.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23implement a missing feature in the #include handler, whereChris Lattner
it did not handle <xyz> headers coming from macro expansions. This requires special treatment, as the include name is lexed as multiple tokens, which require reassembly before processing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23refactor the interface to Preprocessor::GetIncludeFilenameSpelling,Chris Lattner
no functionality changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22fix a bug getting the spelling of an identifier tokenChris Lattner
that required cleaning. If the token required cleaning, don't include the cleaned tokens in the returned length. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22Change hte lexer to start a start pointer to the underlying Chris Lattner
memorybuffer instead of a pointer to the memorybuffer itself. This reduces coupling and eliminates a pointer dereference on a hot path. This speeds up -Eonly on 483.xalancbmk by 2.1% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22split the slow path out of Lexer::getSourceLocation and do not let theChris Lattner
compiler inline it. This speeds up -Eonly on 483.xalancbmk by about 1% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40393 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22Implement a simple cache in headersearch. This speeds upChris Lattner
preprocessing 483.xalancbmk by about 10%, reducing the number of file lookup queries from 2139411 to 199466 (over 10x) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40390 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22avoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:Chris Lattner
// foo // bar // baz we'd get two levels of call (bcpl & whitespace) for each line, leading to some seriously deep stacks in some cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40384 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22Fix a really subtle bug in the macro expander caching code, whereChris Lattner
redefinition of a macro could cause invalid memory to be deleted. Found preprocessing 253.perlbmk. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40380 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21Fix a lexer bug where we incorrectly rejectedChris Lattner
int i = /*/ */ 1; Thanks to Neil for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40379 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20At one point there were going to be lexer and parser tokens.Chris Lattner
Since that point is now long gone, we should rename LexerToken to Token, as it is the only kind of token we have. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40105 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20simplify the lexer ctor to take a SLoc instead of a sloc and a redundant ↵Chris Lattner
buffer*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40104 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20Reimplement SourceLocation. Instead of having a Chris Lattner
fileid/offset pair, it now contains a bit discriminating between mapped locations and file locations. This separates the tables for macros and files in SourceManager, and allows better separation of concepts in the rest of the compiler. This allows us to have *many* macro instantiations before running out of 'addressing space'. This is also more efficient, because testing whether something is a macro expansion is now a bit test instead of a table lookup (which also used to require having a srcmgr around, now it doesn't). This is fully functional, but there are several refinements and optimizations left. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40103 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19Fix a stringizing bug that Neil noticed. We should preprocess this:Chris Lattner
#define t(x) #x t(a c) to "a c", not "ac". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40060 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19Make sure to initialize an ivar, patch by Benoit Boissinot.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40027 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19Correctly respect C99 5.1.1.2p4 when searching for the first '(' ofChris Lattner
a function-like macro invocation. Patch contributed by Neil Booth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40026 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-17strtod is more portable than strtof apparently. Instead of making this ↵Chris Lattner
conditional, just always use strtod. This is temporary code anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39972 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-17cheap change to fix solaris compilation. I can make this a static inline if ↵Gabor Greif
desired git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16Make octal constant lexing use AdvanceToTokenCharacter to give moreChris Lattner
accurate diagnostics. For test/Lexer/comments.c we now emit: int x = 000000080; /* expected-error {{invalid digit}} */ ^ constants.c:7:4: error: invalid digit '8' in octal constant 00080; /* expected-error {{invalid digit}} */ ^ The last line is due to an escaped newline. The full line looks like: int y = 0000\ 00080; /* expected-error {{invalid digit}} */ Previously, we emitted: constants.c:4:9: error: invalid digit '8' in octal constant int x = 000000080; /* expected-error {{invalid digit}} */ ^ constants.c:6:9: error: invalid digit '8' in octal constant int y = 0000\ ^ which isn't too bad, but the new way is better for the user, regardless of whether there is an escaped newline or not. All the other lexer-related diagnostics should switch over to using AdvanceToTokenCharacter where appropriate. Help wanted :). This implements test/Lexer/constants.c. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39906 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16Add a new Preprocessor::AdvanceToTokenCharacter method which, given a slocChris Lattner
specifying the start of a token and a logical (phase 3) character number, returns a sloc representing the input character corresponding to it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16Add support for C++'0x keywords, patch by Doug GregorChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15remove obsolete comment.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15Change SourceManager::getInstantiationLoc to take virtual locations, doing itsChris Lattner
virtual->physical mapping explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39867 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15Cache macro expander objects to avoid thrashing malloc in heavy expansion ↵Chris Lattner
situations. This doesn't significantly improve carbon.h, but it does speed up INPUTS/macro_pounder_obj.c by 48% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14switch function-like macros from using a vector for their arguments to anChris Lattner
explicitly new'd array. The array never mutates once created, so a vector is overkill. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39862 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14expose an iterator interface to getReplacementTokens instead of the ↵Chris Lattner
datastructure itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14split function-like and object-like macro body parsing to make theChris Lattner
code more obvious. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39859 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13remove use of alloca.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39815 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13Solaris needs an included header for allocaGabor Greif
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11Stage two of getting CFE top correct.Reid Spencer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8