Chris Lattner
59a9ebdb17
refactor header searching stuff out of the main Preprocessor object into
...
it's own HeaderSearch object. This makes Preprocessor simpler and easier
to understand.
llvm-svn: 39012
2006-10-18 05:34:33 +00:00
Chris Lattner
ff777c38dc
silence warning, add hacky patch for framework lookup
...
llvm-svn: 39011
2006-10-18 04:03:13 +00:00
Chris Lattner
720f2700b1
Make the identifier table track objc keywords
...
llvm-svn: 39003
2006-10-17 04:03:44 +00:00
Chris Lattner
87d3bec423
Make preprocessor keywords like 'define' first class citizens in the
...
IdentifierTable, instead of making them resort to strcmp'ing.
llvm-svn: 39002
2006-10-17 03:44:32 +00:00
Chris Lattner
6e5b2a084e
ignore '#line' and '# 123' for now.
...
llvm-svn: 38997
2006-10-17 02:53:32 +00:00
Chris Lattner
063400e46e
Implement the #define_other_target directive.
...
llvm-svn: 38984
2006-10-14 19:54:15 +00:00
Chris Lattner
81278c6356
Implement the #define_target preprocessor directive.
...
llvm-svn: 38980
2006-10-14 19:03:49 +00:00
Chris Lattner
02dffbda3b
Write up TargetInfo so that use of wchar_t strings results in a warning if
...
used in a target set where the size is not identical.
llvm-svn: 38975
2006-10-14 07:50:21 +00:00
Chris Lattner
8c2048710d
Rename LexerToken methods to be more consistent.
...
llvm-svn: 38969
2006-10-14 05:19:21 +00:00
Chris Lattner
d3e9895b9a
Initial support for semantic analysis and AST building for StringExpr nodes.
...
llvm-svn: 38960
2006-10-06 05:22:26 +00:00
Chris Lattner
6d998556de
Fix precedence problem
...
llvm-svn: 38809
2006-08-04 06:11:48 +00:00
Chris Lattner
95a06b34f7
Simplify implementation of varargs macros by adding the __VA_ARGS__ token
...
to the formal argument list of a C99 varargs macro.
llvm-svn: 38800
2006-07-30 08:40:43 +00:00
Chris Lattner
273ddd5c57
The optimized case has to treat __VA_ARGS__ as an argument. This fixes
...
test/Preprocessor/macro_rescan_varargs.c
llvm-svn: 38795
2006-07-29 07:33:01 +00:00
Chris Lattner
f76e62ecad
Implement support for #__VA_ARGS__
...
llvm-svn: 38791
2006-07-29 07:14:41 +00:00
Chris Lattner
457fc15bc5
Implement comment saving mode: the -C and -CC options.
...
llvm-svn: 38783
2006-07-29 06:30:25 +00:00
Chris Lattner
775d832110
Implement the GNU comma swallowing extension. This implements
...
test/Preprocessor/macro_fn_comma_swallow.c
llvm-svn: 38780
2006-07-29 04:39:41 +00:00
Chris Lattner
02f1f4f28b
Fix a bug in previous commit
...
llvm-svn: 38774
2006-07-29 03:52:46 +00:00
Chris Lattner
6d9f8ed3b6
No need for explicit underscore anymore.
...
llvm-svn: 38773
2006-07-29 03:52:06 +00:00
Chris Lattner
7e37483f14
Poison and unpoison __VA_ARGS__ when appropriate
...
llvm-svn: 38770
2006-07-29 03:46:57 +00:00
Chris Lattner
e7a5130dff
If the varargs token is missing, add an empty argument to represent it. This
...
fixes Preprocessor/macro_fn_varargs_named.c
llvm-svn: 38769
2006-07-29 01:25:12 +00:00
Chris Lattner
6e4bf523e6
Implement C99 6.10.3.4p2, testcase here: Preprocessor/macro_disable3.c.
...
llvm-svn: 38760
2006-07-27 06:59:25 +00:00
Chris Lattner
7a4af3b73d
Change Preprocessor::ReadFunctionLikeMacroArgs to use a SmallVector to lex
...
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
2006-07-26 06:26:52 +00:00
Chris Lattner
c1410dc1e6
Change MacroArgs to allocate space for the unexpanded tokens immediately after
...
the MacroArgs object itself. This is a bit more efficient and will be even more
so shortly.
llvm-svn: 38756
2006-07-26 05:22:49 +00:00
Chris Lattner
7021657a0f
Implement a FIXME: don't copy token array into a token vector, instead, macroexpander should expand from an array directly.
...
llvm-svn: 38754
2006-07-26 03:50:40 +00:00
Chris Lattner
36b6e8134e
speed up a brutal macro-expansion torture test by about 30% (1.5 -> 1.0s)
...
by turning vectors of vectors into a single vector, reducing pressure on
malloc. This can still be improved.
llvm-svn: 38753
2006-07-21 06:38:30 +00:00
Chris Lattner
510ab61fd3
Add optimization for identifier##identifier -> identifier, the most common case of token pasting.
...
llvm-svn: 38747
2006-07-20 04:47:30 +00:00
Chris Lattner
538d7f3c27
Simplify "raw lexing mode" even further. Now the preprocessor is only called
...
into when a hard error is found. This simplifies logic and eliminates the need
for the preprocessor to know about raw mode.
llvm-svn: 38746
2006-07-20 04:31:52 +00:00
Chris Lattner
0f1f50517b
Simplify identifier lookup in raw mode, implementing Preprocessor/macro_fn_lparen_scan2.c.
...
llvm-svn: 38744
2006-07-20 04:16:23 +00:00
Chris Lattner
30a2fa14ae
Move LexingRawMode handling of file EOF out of the preprocessor into the
...
lexer. This makes more logical sense and also unbreaks the case when the
lexer hasn't been pushed onto the PP include stack. This is the case when
pasting identifiers. This patch implements macro_paste_bcpl_comment.c.
llvm-svn: 38736
2006-07-19 06:31:49 +00:00
Chris Lattner
2183a6e8f4
Make end-of-file handling much less recursive. This reduces the worst case
...
stack depth sampled by shark from ~34 to ~17 frames when preprocessing <iostream>.
llvm-svn: 38726
2006-07-18 06:36:12 +00:00
Chris Lattner
7667d0d942
Implement support for lexing from a pre-constructed token stream.
...
Use this support to implement function-like macro argument preexpansion.
This implements test/Preprocessor/macro_fn_preexpand.c
llvm-svn: 38724
2006-07-16 18:16:58 +00:00
Chris Lattner
2ada5d3890
More changes from formals -> actuals.
...
llvm-svn: 38717
2006-07-15 07:51:24 +00:00
Chris Lattner
ee8760b21b
Rename macroformalargs -> MacroArgs, as it represents the actual arguments,
...
not the formal arguments, to a macro.
llvm-svn: 38716
2006-07-15 07:42:55 +00:00
Chris Lattner
c653246bfb
Eliminate the IdentifierInfo::IsMacroArg flag.
...
llvm-svn: 38715
2006-07-15 06:55:18 +00:00
Chris Lattner
ecc39e9325
Change Lexer::Stringify to not add ""'s around the string.
...
llvm-svn: 38708
2006-07-15 05:23:31 +00:00
Chris Lattner
b94ec7b668
Add an API so that external clients can create strings in the scratch buffer.
...
llvm-svn: 38706
2006-07-14 06:54:10 +00:00
Chris Lattner
678c880a69
Move Preprocessor::isNextPPTokenLParen to Lexer::isNextPPTokenLParen, where
...
it more rightly belongs.
llvm-svn: 38702
2006-07-11 05:46:12 +00:00
Chris Lattner
3ebcf4e2cd
Change Preprocessor::SkippingContents into Lexer::LexingRawMode. Raw mode
...
is an intra-lexer property, not a inter-lexer property, so it makes sense
for it to be define here. It also makes no sense for macros, and allows us
to define it more carefully in the header.
While I'm at it, improve comments and structuring in Lexer.h
llvm-svn: 38701
2006-07-11 05:39:23 +00:00
Chris Lattner
69f88b883d
Fix a regression on Preprocessor/hash_space.c
...
llvm-svn: 38700
2006-07-11 05:07:29 +00:00
Chris Lattner
d8aee0e81b
Implement "lparen scanning" for lexer buffers, by making "skipping lexing"
...
completely reversible. This implements tests 3/4 of
test/Preprocessor/macro_fn_lparen_scan.c
llvm-svn: 38699
2006-07-11 05:04:55 +00:00
Chris Lattner
a12dd15b56
ext-warn on empty macro arguments if in pre-c99 mode
...
llvm-svn: 38697
2006-07-11 04:09:02 +00:00
Chris Lattner
afe603fa7d
Implement scanning-for-( more correctly. This implements
...
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.
Add some FIXME's about missing diagnostics on empty macro args. Improve some
comments.
llvm-svn: 38694
2006-07-11 04:02:46 +00:00
Chris Lattner
03f83485bd
Only do an expensive walk over the entire identifier table if the diagnostic
...
that needs it is enabled.
llvm-svn: 38690
2006-07-10 06:16:26 +00:00
Chris Lattner
3ce1d1aac9
Trivially expand macros like:
...
#define ENOMEMORYFORYOU ENOMEMORYFORYOU
llvm-svn: 38687
2006-07-09 01:00:18 +00:00
Chris Lattner
c239583433
Make trivial expansion detection more aggressive. Trivially expand macros
...
like: #define IS_BLAH() 1
llvm-svn: 38686
2006-07-09 00:57:04 +00:00
Chris Lattner
7818605f83
Read, remember, and validate the arguments provided the a function-style
...
macro invocation.
llvm-svn: 38685
2006-07-09 00:45:31 +00:00
Chris Lattner
815a1f97f6
Diagnose C99 6.10.3.2p1
...
llvm-svn: 38683
2006-07-08 20:48:04 +00:00
Chris Lattner
6e0d42c6f8
Add identifiers for macro arguments to MacroInfo, check for duplicates,
...
enhance macro equality testing to verify argument lists match.
llvm-svn: 38682
2006-07-08 20:32:52 +00:00
Chris Lattner
cefc768f5b
Start reading/validating the argument list for a function-like macro.
...
llvm-svn: 38681
2006-07-08 08:28:12 +00:00
Chris Lattner
21284dfdd1
Implement checking for macro equality, C99 6.10.3.2
...
llvm-svn: 38680
2006-07-08 07:16:08 +00:00