summaryrefslogtreecommitdiffstats
path: root/clang/Lex/Preprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-231-9/+9
| | | | | | 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
* At one point there were going to be lexer and parser tokens.Chris Lattner2007-07-201-54/+54
| | | | | | | 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-201-5/+2
| | | | | | buffer*. llvm-svn: 40104
* Reimplement SourceLocation. Instead of having a Chris Lattner2007-07-201-28/+35
| | | | | | | | | | | | | | | | | 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-191-2/+4
| | | | | | | | | | #define t(x) #x t(a c) to "a c", not "ac". llvm-svn: 40060
* 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
* 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
* Cache macro expander objects to avoid thrashing malloc in heavy expansion ↵Chris Lattner2007-07-151-6/+33
| | | | | | | | | 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-141-4/+13
| | | | | | | 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-141-1/+2
| | | | | | 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
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-4/+3
| | | | | | | | | | | | | 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
* Add support for inserting up to 10 strings in a diagnostic, with %0, %1, %2,Chris Lattner2007-05-161-1/+5
| | | | | | etc. llvm-svn: 39447
* Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.Chris Lattner2007-04-291-1/+1
| | | | llvm-svn: 39426
* Include the filename being looked up in an error message. This gives us stuffChris Lattner2007-04-101-2/+4
| | | | | | | | | | | | | | | | | like this: t3.c:5:10: error: 'vers2.h' file not found #include xstr(INCFILE(2).h) ^ instead of: t3.c:5:10: error: file not found #include xstr(INCFILE(2).h) ^ which is useful if the #include name is generated through macro expansion. llvm-svn: 39398
* switch to using iterators instead of stringmap visitors.Chris Lattner2007-02-111-16/+8
| | | | llvm-svn: 39336
* CStringMap -> StringMap.Chris Lattner2007-02-081-1/+1
| | | | llvm-svn: 39334
* adjust to CStringMap interface change.Chris Lattner2007-02-081-2/+3
| | | | llvm-svn: 39333
* Produce a nice error message for '#define and' in C++. Patch by Bill!Chris Lattner2006-11-211-4/+14
| | | | llvm-svn: 39218
* eliminate string compares when checking for the 'defined' token.Chris Lattner2006-11-211-2/+1
| | | | llvm-svn: 39216
* Add support for C++ operator keywords. Patch by Bill Wendling.Chris Lattner2006-11-211-0/+6
| | | | llvm-svn: 39214
* Change KeepComments/KeepMacroComments modes to be facets of the preprocessorChris Lattner2006-11-211-7/+11
| | | | | | state, not aspects of the language standard being parsed. llvm-svn: 39209
* simplify the Preprocessor ctor.Chris Lattner2006-11-211-4/+3
| | | | llvm-svn: 39208
* Formalize preprocessor callbacks together into a PPCallbacks structure, insteadChris Lattner2006-11-211-14/+12
| | | | | | | of having a loose collection of function pointers. This also allows clients to maintain state, and reduces the size of the Preprocessor.h interface. llvm-svn: 39203
* silence some warnings when asserts are disabled.Chris Lattner2006-11-051-0/+1
| | | | llvm-svn: 39127
* Refactor the paths used for checking and getting the spelling of #includeChris Lattner2006-10-301-6/+63
| | | | | | | | | filenames (and also '#pragma GCC dependency' of course). Now, assuming no cleaning is needed, we can go all the way from lexing the filename to doing filename lookups with no mallocs. This speeds up user PP time from 0.077 to 0.075s for Cocoa.h (2.6%). llvm-svn: 39092
* Make Preprocessor::LookupFile take a character range instead of a string.Chris Lattner2006-10-301-8/+5
| | | | | | This avoids some copying in its clients. llvm-svn: 39091
* Push strings out of the HeaderSearch interface, it now deals solely withChris Lattner2006-10-301-3/+9
| | | | | | character ranges. llvm-svn: 39090
* Pull the string hashtable out of the IdentifierTable, moving into LLVM'sChris Lattner2006-10-291-2/+3
| | | | | | libsupport. Now it can be used for other things besides identifier hashing. llvm-svn: 39079
* Implement test/Preprocessor/comment_save_if.cChris Lattner2006-10-271-0/+8
| | | | llvm-svn: 39069
* add #includeChris Lattner2006-10-221-0/+1
| | | | llvm-svn: 39034
* Fix a regression introduced when adding subframework supportChris Lattner2006-10-201-2/+2
| | | | llvm-svn: 39022
* Implement test/Preprocessor/macro_arg_keyword.cChris Lattner2006-10-201-4/+8
| | | | llvm-svn: 39021
* Implement subframework lookupChris Lattner2006-10-201-3/+27
| | | | llvm-svn: 39015
* Move keyword setup from the preprocessor into the IdentifierTable class.Chris Lattner2006-10-181-72/+1
| | | | llvm-svn: 39014
* refactor header searching stuff out of the main Preprocessor object intoChris Lattner2006-10-181-160/+21
| | | | | | | it's own HeaderSearch object. This makes Preprocessor simpler and easier to understand. llvm-svn: 39012
* silence warning, add hacky patch for framework lookupChris Lattner2006-10-181-3/+46
| | | | llvm-svn: 39011
* Make the identifier table track objc keywordsChris Lattner2006-10-171-0/+14
| | | | llvm-svn: 39003
* Make preprocessor keywords like 'define' first class citizens in theChris Lattner2006-10-171-68/+99
| | | | | | IdentifierTable, instead of making them resort to strcmp'ing. llvm-svn: 39002
* ignore '#line' and '# 123' for now.Chris Lattner2006-10-171-5/+7
| | | | llvm-svn: 38997
* Implement the #define_other_target directive.Chris Lattner2006-10-141-2/+54
| | | | llvm-svn: 38984
* Implement the #define_target preprocessor directive.Chris Lattner2006-10-141-5/+30
| | | | llvm-svn: 38980
* Write up TargetInfo so that use of wchar_t strings results in a warning ifChris Lattner2006-10-141-2/+3
| | | | | | used in a target set where the size is not identical. llvm-svn: 38975
* Rename LexerToken methods to be more consistent.Chris Lattner2006-10-141-42/+42
| | | | llvm-svn: 38969
OpenPOWER on IntegriCloud