summaryrefslogtreecommitdiffstats
path: root/clang/Lex/MacroExpander.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename MacroExpander.cpp/h -> TokenLexer.cpp/hChris Lattner2008-03-091-695/+0
| | | | llvm-svn: 48072
* rename the MacroExpander class to TokenLexer. It handles bothChris Lattner2008-03-091-18/+19
| | | | | | token streams and macro lexing, so a more generic name is useful. llvm-svn: 48071
* rename MacroTokens -> Tokens. When this is a token stream, there is no macroChris Lattner2008-03-091-30/+30
| | | | | | involved. llvm-svn: 48070
* Implement support for the extremely atrocious MS /##/ extension, Chris Lattner2008-02-071-6/+38
| | | | | | | which pastes together a comment. This is only enabled with -fms-extensions of course. llvm-svn: 46845
* Fix a bug where we would incorrectly emit a "cannot paste" error Chris Lattner2008-01-291-1/+16
| | | | | | | message when handling the GNU ", ## __VA_ARGS__" extension. While I'm at it, flag uses of this as extensions. llvm-svn: 46503
* Don't attribute in file headers anymore. See llvmdev for theChris Lattner2007-12-291-2/+2
| | | | | | discussion of this change. llvm-svn: 45410
* Switch lexer/pp over to new Token::is/isNot apiChris Lattner2007-10-091-25/+24
| | | | llvm-svn: 42799
* improve layering:Chris Lattner2007-10-071-4/+5
| | | | | | | | | Now instead of IdentifierInfo knowing anything about MacroInfo, only the preprocessor knows. This makes MacroInfo truly private to the Lex library (and its direct clients) instead of being accessed in the Basic library. llvm-svn: 42727
* 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
* At one point there were going to be lexer and parser tokens.Chris Lattner2007-07-201-40/+40
| | | | | | | 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-6/+1
| | | | | | buffer*. llvm-svn: 40104
* Reimplement SourceLocation. Instead of having a Chris Lattner2007-07-201-1/+2
| | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | #define t(x) #x t(a c) to "a c", not "ac". llvm-svn: 40060
* 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-151-14/+27
| | | | | | | | | situations. This doesn't significantly improve carbon.h, but it does speed up INPUTS/macro_pounder_obj.c by 48% llvm-svn: 39864
* expose an iterator interface to getReplacementTokens instead of the ↵Chris Lattner2007-07-141-3/+3
| | | | | | datastructure itself. llvm-svn: 39860
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-3/+2
| | | | | | | | | | | | | 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 FIXME: replace use of alloca with use of SmallVector.Chris Lattner2006-11-031-11/+13
| | | | llvm-svn: 39102
* Export the ASTBuilder class from the AST module.Chris Lattner2006-11-031-0/+1
| | | | llvm-svn: 39095
* Rename LexerToken methods to be more consistent.Chris Lattner2006-10-141-19/+19
| | | | llvm-svn: 38969
* Initial support for semantic analysis and AST building for StringExpr nodes.Chris Lattner2006-10-061-2/+3
| | | | llvm-svn: 38960
* Simplify implementation of varargs macros by adding the __VA_ARGS__ tokenChris Lattner2006-07-301-24/+11
| | | | | | to the formal argument list of a C99 varargs macro. llvm-svn: 38800
* Fix precedence bugChris Lattner2006-07-291-1/+1
| | | | llvm-svn: 38793
* Implement support for #__VA_ARGS__Chris Lattner2006-07-291-1/+7
| | | | llvm-svn: 38791
* Fix a crash on Preprocessor/macro_paste_none.cChris Lattner2006-07-291-1/+2
| | | | llvm-svn: 38787
* Implement the GNU comma swallowing extension. This implementsChris Lattner2006-07-291-4/+13
| | | | | | test/Preprocessor/macro_fn_comma_swallow.c llvm-svn: 38780
* Improve placemarker handling, implementing Preprocessor/macro_fn_placemarker.cChris Lattner2006-07-291-2/+30
| | | | llvm-svn: 38778
* Implement support for __VA_ARGS__, allowing ↵Chris Lattner2006-07-291-3/+11
| | | | | | | | test/Preprocessor/macro_fn_varargs_iso.c to pass. llvm-svn: 38776
* Use a continue to avoid indentation of a bunch of codeChris Lattner2006-07-281-72/+72
| | | | llvm-svn: 38762
* Implement pasting of arguments that expand to no tokens. This handles theChris Lattner2006-07-281-3/+17
| | | | | | C99 "placemarker" concept. llvm-svn: 38761
* Switch ExpandFunctionArguments to use a smallvector instead of a vector,Chris Lattner2006-07-271-4/+4
| | | | | | speeding up my macro expansion torture test from .75s to .5s (33%!) llvm-svn: 38758
* Change Preprocessor::ReadFunctionLikeMacroArgs to use a SmallVector to lexChris Lattner2006-07-261-3/+3
| | | | | | | | argument tokens into instead of a real vector. This avoids some malloc traffic in common cases. In an "abusive macro expansion" testcase, this reduced -Eonly time by 25%. llvm-svn: 38757
* Change MacroArgs to allocate space for the unexpanded tokens immediately afterChris Lattner2006-07-261-9/+36
| | | | | | | the MacroArgs object itself. This is a bit more efficient and will be even more so shortly. llvm-svn: 38756
* Add a new getArgLength method and refactor some code to use itChris Lattner2006-07-261-13/+23
| | | | llvm-svn: 38755
* Implement a FIXME: don't copy token array into a token vector, instead, ↵Chris Lattner2006-07-261-29/+28
| | | | | | macroexpander should expand from an array directly. llvm-svn: 38754
* speed up a brutal macro-expansion torture test by about 30% (1.5 -> 1.0s)Chris Lattner2006-07-211-55/+60
| | | | | | | by turning vectors of vectors into a single vector, reducing pressure on malloc. This can still be improved. llvm-svn: 38753
* fix obvious bug that caused Preprocessor/macro_paste_bad.c to fail.Chris Lattner2006-07-201-1/+1
| | | | llvm-svn: 38748
* Add optimization for identifier##identifier -> identifier, the most common ↵Chris Lattner2006-07-201-2/+11
| | | | | | case of token pasting. llvm-svn: 38747
* Simplify identifier lookup in raw mode, implementing ↵Chris Lattner2006-07-201-0/+9
| | | | | | Preprocessor/macro_fn_lparen_scan2.c. llvm-svn: 38744
* Avoid testing / ## * in the lexer. This will cause an unhelpful error messageChris Lattner2006-07-191-30/+35
| | | | | | to be emitted from the lexer. This fixes macro_paste_c_block_comment.c llvm-svn: 38737
* Fix test/Preprocessor/macro_paste_spacing.cChris Lattner2006-07-191-1/+5
| | | | llvm-svn: 38734
* Implement basic token pasting (## operator). This implementsChris Lattner2006-07-191-0/+99
| | | | | | | test/Preprocessor/macro_paste_simple.c and macro_paste_bad.c. There are several known bugs still. llvm-svn: 38733
* Handle really simple expansion of ## formals. Do not handle the empty caseChris Lattner2006-07-191-5/+14
| | | | | | yet though. llvm-svn: 38729
* Make end-of-file handling much less recursive. This reduces the worst caseChris Lattner2006-07-181-5/+8
| | | | | | stack depth sampled by shark from ~34 to ~17 frames when preprocessing <iostream>. llvm-svn: 38726
* Implement support for lexing from a pre-constructed token stream.Chris Lattner2006-07-161-19/+91
| | | | | | | | Use this support to implement function-like macro argument preexpansion. This implements test/Preprocessor/macro_fn_preexpand.c llvm-svn: 38724
* Implement basic argument substitution. This implementsChris Lattner2006-07-151-0/+67
| | | | | | test/Preprocessor/macro_fn_disable_expand.c llvm-svn: 38720
* Clarify assertionChris Lattner2006-07-151-2/+2
| | | | llvm-svn: 38718
* More changes from formals -> actuals.Chris Lattner2006-07-151-7/+5
| | | | llvm-svn: 38717
* Rename macroformalargs -> MacroArgs, as it represents the actual arguments,Chris Lattner2006-07-151-15/+37
| | | | | | not the formal arguments, to a macro. llvm-svn: 38716
OpenPOWER on IntegriCloud