summaryrefslogtreecommitdiffstats
path: root/clang/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* work around bugs and missing features in apfloat.Chris Lattner2007-09-221-1/+8
| | | | llvm-svn: 42235
* Use APFloat for the representation of FP immediates, ask the targetChris Lattner2007-09-221-3/+3
| | | | | | for *which* apfloat to use for a particular type. llvm-svn: 42234
* Remove SelectorTable/SelectorInfo, simply store all selectors in the central ↵Steve Naroff2007-09-191-31/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 42139
* Add support for ObjC keyword selectors.Steve Naroff2007-09-171-0/+31
| | | | | | | | | | - 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. llvm-svn: 42023
* Silence VC++ warnings, patch by Hartmut KaiserChris Lattner2007-09-041-2/+2
| | | | llvm-svn: 41693
* Add #include required on win32.Chris Lattner2007-09-031-0/+1
| | | | llvm-svn: 41686
* Eliminate some VC++ warnings, patch by Hartmut Kaiser!Chris Lattner2007-09-032-5/+5
| | | | llvm-svn: 41685
* Spaces not tabs.Neil Booth2007-08-291-1/+1
| | | | llvm-svn: 41582
* Ensure we diagnose long long literals in C90 mode.Neil Booth2007-08-291-0/+5
| | | | llvm-svn: 41581
* 1.0 is double, 1.0F is a float.Chris Lattner2007-08-262-5/+5
| | | | llvm-svn: 41412
* 1) refactor some code.Chris Lattner2007-08-261-56/+54
| | | | | | | | | | | | | | | | | | | | | | 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; ^ llvm-svn: 41411
* Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().Steve Naroff2007-08-231-0/+16
| | | | | | Convert all clients to the new cleaner, more robust API. llvm-svn: 41330
* Update to match the API from LLVM mainline.Chris Lattner2007-08-231-2/+2
| | | | llvm-svn: 41312
* Use a smallstring instead of an std::string in FileChanged to avoid some ↵Chris Lattner2007-07-241-0/+11
| | | | | | | | malloc traffic. This speeds up -E on xalancbmk by 2.4% llvm-svn: 40461
* Fix a scoping bug that apple gcc doesn't catch for some reason.Chris Lattner2007-07-231-1/+2
| | | | llvm-svn: 40450
* implement a missing feature in the #include handler, whereChris Lattner2007-07-231-9/+81
| | | | | | | | 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. llvm-svn: 40418
* refactor the interface to Preprocessor::GetIncludeFilenameSpelling,Chris Lattner2007-07-232-11/+13
| | | | | | no functionality changes. llvm-svn: 40414
* fix a bug getting the spelling of an identifier tokenChris Lattner2007-07-221-1/+7
| | | | | | | that required cleaning. If the token required cleaning, don't include the cleaned tokens in the returned length. llvm-svn: 40410
* Change hte lexer to start a start pointer to the underlying Chris Lattner2007-07-221-5/+11
| | | | | | | | 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% llvm-svn: 40394
* split the slow path out of Lexer::getSourceLocation and do not let theChris Lattner2007-07-221-14/+27
| | | | | | compiler inline it. This speeds up -Eonly on 483.xalancbmk by about 1% llvm-svn: 40393
* Implement a simple cache in headersearch. This speeds upChris Lattner2007-07-221-1/+25
| | | | | | | preprocessing 483.xalancbmk by about 10%, reducing the number of file lookup queries from 2139411 to 199466 (over 10x) llvm-svn: 40390
* avoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:Chris Lattner2007-07-221-24/+22
| | | | | | | | | | | // foo // bar // baz we'd get two levels of call (bcpl & whitespace) for each line, leading to some seriously deep stacks in some cases. llvm-svn: 40384
* Fix a really subtle bug in the macro expander caching code, whereChris Lattner2007-07-221-1/+6
| | | | | | | redefinition of a macro could cause invalid memory to be deleted. Found preprocessing 253.perlbmk. llvm-svn: 40380
* Fix a lexer bug where we incorrectly rejectedChris Lattner2007-07-211-1/+12
| | | | | | | | int i = /*/ */ 1; Thanks to Neil for pointing this out. llvm-svn: 40379
* At one point there were going to be lexer and parser tokens.Chris Lattner2007-07-207-149/+149
| | | | | | | Since that point is now long gone, we should rename LexerToken to Token, as it is the only kind of token we have. llvm-svn: 40105
* simplify the lexer ctor to take a SLoc instead of a sloc and a redundant ↵Chris Lattner2007-07-204-22/+15
| | | | | | buffer*. llvm-svn: 40104
* Reimplement SourceLocation. Instead of having a Chris Lattner2007-07-205-43/+67
| | | | | | | | | | | | | | | | | 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. llvm-svn: 40103
* Fix a stringizing bug that Neil noticed. We should preprocess this:Chris Lattner2007-07-192-3/+5
| | | | | | | | | | #define t(x) #x t(a c) to "a c", not "ac". llvm-svn: 40060
* Make sure to initialize an ivar, patch by Benoit Boissinot.Chris Lattner2007-07-191-0/+1
| | | | llvm-svn: 40027
* Correctly respect C99 5.1.1.2p4 when searching for the first '(' ofChris Lattner2007-07-191-3/+13
| | | | | | a function-like macro invocation. Patch contributed by Neil Booth. llvm-svn: 40026
* strtod is more portable than strtof apparently. Instead of making this ↵Chris Lattner2007-07-171-7/+1
| | | | | | | | conditional, just always use strtod. This is temporary code anyway. llvm-svn: 39972
* cheap change to fix solaris compilation. I can make this a static inline if ↵Gabor Greif2007-07-171-0/+6
| | | | | | desired llvm-svn: 39970
* Make octal constant lexing use AdvanceToTokenCharacter to give moreChris Lattner2007-07-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 39906
* Add a new Preprocessor::AdvanceToTokenCharacter method which, given a slocChris Lattner2007-07-161-0/+37
| | | | | | | specifying the start of a token and a logical (phase 3) character number, returns a sloc representing the input character corresponding to it. llvm-svn: 39905
* Add support for C++'0x keywords, patch by Doug GregorChris Lattner2007-07-161-6/+12
| | | | llvm-svn: 39897
* remove obsolete comment.Chris Lattner2007-07-151-3/+0
| | | | llvm-svn: 39868
* Change SourceManager::getInstantiationLoc to take virtual locations, doing itsChris Lattner2007-07-151-2/+2
| | | | | | virtual->physical mapping explicitly. llvm-svn: 39867
* Cache macro expander objects to avoid thrashing malloc in heavy expansion ↵Chris Lattner2007-07-152-20/+60
| | | | | | | | | situations. This doesn't significantly improve carbon.h, but it does speed up INPUTS/macro_pounder_obj.c by 48% llvm-svn: 39864
* switch function-like macros from using a vector for their arguments to anChris Lattner2007-07-142-5/+17
| | | | | | | explicitly new'd array. The array never mutates once created, so a vector is overkill. llvm-svn: 39862
* expose an iterator interface to getReplacementTokens instead of the ↵Chris Lattner2007-07-142-4/+5
| | | | | | datastructure itself. llvm-svn: 39860
* split function-like and object-like macro body parsing to make theChris Lattner2007-07-141-24/+36
| | | | | | code more obvious. llvm-svn: 39859
* remove use of alloca.Chris Lattner2007-07-131-2/+3
| | | | llvm-svn: 39815
* Solaris needs an included header for allocaGabor Greif2007-07-131-0/+1
| | | | llvm-svn: 39797
* Bug #:Steve Naroff2007-07-091-0/+7
| | | | | | | | Submitted by: Reviewed by: Added primitive support for 32-bit floating point literals. llvm-svn: 39719
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-1510-65/+53
| | | | | | | | | | | | | out of the llvm namespace. This makes the clang namespace be a sibling of llvm instead of being a child. The good thing about this is that it makes many things unambiguous. The bad things is that many things in the llvm namespace (notably data structures like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport should be split out of llvm into their own namespace in the future, which will fix this issue. llvm-svn: 39659
* Implement support for formal arguments. We can now compile this:Chris Lattner2007-06-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | int test(int X, short Y, float Z) { return (int)(X*Y+Z); } to: define i32 @test(i32 %X, i16 %Y, float %Z) { entry: %promote = sext i16 %Y to i32 ; <i32> [#uses=1] %mul = mul i32 %promote, %X ; <i32> [#uses=1] %promote3 = sitofp i32 %mul to float ; <float> [#uses=1] %add = add float %promote3, %Z ; <float> [#uses=1] %conv = fptosi float %add to i32 ; <i32> [#uses=1] ret i32 %conv } with: $ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis llvm-svn: 39652
* Bug #:Steve Naroff2007-06-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Implement semantic analysis for vector_size attribute! We now produce the following diagnostics... [administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang vector.c vector.c:2:29: error: attribute requires precisely 1 argument typedef int __attribute__(( vector_size )) tVecp; ^ vector.c:7:32: error: attribute requires precisely 1 argument extern int foo __attribute__(( vector_size )); ^ vector.c:8:34: error: attribute requires precisely 1 argument extern float bar __attribute__(( vector_size(16,18) )); ^ vector.c:11:34: error: vector_size requires integer constant (attribute ignored) extern char foo2 __attribute__(( vector_size(16.2) )); ^ ~~~~ vector.c:21:47: error: invalid vector type 'struct s' struct s { int a; } structVar __attribute__(( vector_size(16) )); llvm-svn: 39643
* Fix lexing octal escapes like:Chris Lattner2007-06-091-0/+1
| | | | | | | | void foo() { "\0"; } llvm-svn: 39638
* Don't warn about escaped newlines in // comments if the next line is alsoChris Lattner2007-06-091-2/+13
| | | | | | a // comment, this reduces noise in the llvm testsuite. llvm-svn: 39636
* Add support for binary literals:Chris Lattner2007-06-081-0/+14
| | | | | | http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html#Binary-constants llvm-svn: 39621
OpenPOWER on IntegriCloud