Chris Lattner
b10969b9b2
new testcase
...
llvm-svn: 38799
2006-07-30 07:33:49 +00:00
Chris Lattner
022b62e941
new testcase
...
llvm-svn: 38798
2006-07-30 07:20:09 +00:00
Chris Lattner
a5722f5a56
add a note
...
llvm-svn: 38797
2006-07-29 17:59:42 +00:00
Chris Lattner
4beb0381ed
Trigraphs are not enabled in -fpreprocessed mode.
...
llvm-svn: 38796
2006-07-29 17:50:10 +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
8d31b5d1aa
new testcase
...
llvm-svn: 38794
2006-07-29 07:32:40 +00:00
Chris Lattner
07560ed0cf
Fix precedence bug
...
llvm-svn: 38793
2006-07-29 07:26:48 +00:00
Chris Lattner
2641bd549c
new testcase
...
llvm-svn: 38792
2006-07-29 07:19:41 +00:00
Chris Lattner
f76e62ecad
Implement support for #__VA_ARGS__
...
llvm-svn: 38791
2006-07-29 07:14:41 +00:00
Chris Lattner
5b123fde96
new testcase
...
llvm-svn: 38790
2006-07-29 07:08:39 +00:00
Chris Lattner
b631d7ce6c
new testcase
...
llvm-svn: 38789
2006-07-29 06:59:47 +00:00
Chris Lattner
232daf6834
testcase from the c99 standard
...
llvm-svn: 38788
2006-07-29 06:48:55 +00:00
Chris Lattner
d97d2e780c
Fix a crash on Preprocessor/macro_paste_none.c
...
llvm-svn: 38787
2006-07-29 06:44:29 +00:00
Chris Lattner
15d6b28f09
new testcase
...
llvm-svn: 38786
2006-07-29 06:44:19 +00:00
Chris Lattner
f35d327a99
Testcases for comment saving modes, -C and -CC.
...
llvm-svn: 38785
2006-07-29 06:41:10 +00:00
Chris Lattner
cd028fc1f6
Fix -E mode to enter the main file *after* -E mode configures the preprocessor.
...
llvm-svn: 38784
2006-07-29 06:35:08 +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
2be4115465
add another missing feature
...
llvm-svn: 38782
2006-07-29 06:29:39 +00:00
Chris Lattner
24691eee6c
this item done
...
llvm-svn: 38781
2006-07-29 04:40:17 +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
d480b9c0ed
new testcase for the GNU comma swallow extension.
...
llvm-svn: 38779
2006-07-29 04:39:12 +00:00
Chris Lattner
479b0af31d
Improve placemarker handling, implementing Preprocessor/macro_fn_placemarker.c
...
llvm-svn: 38778
2006-07-29 04:16:20 +00:00
Chris Lattner
63081842a7
new testcase for placemarker handling.
...
llvm-svn: 38777
2006-07-29 04:09:49 +00:00
Chris Lattner
21c8b8f71e
Implement support for __VA_ARGS__, allowing test/Preprocessor/macro_fn_varargs_iso.c
...
to pass.
llvm-svn: 38776
2006-07-29 04:04:22 +00:00
Chris Lattner
2bc48570b7
new testcase for __VA_ARGS__
...
llvm-svn: 38775
2006-07-29 04:03:59 +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
f9771166ed
add method to unpoison something for __VA_ARGS__.
...
llvm-svn: 38772
2006-07-29 03:47:18 +00:00
Chris Lattner
3ce273025e
Remove __VA_ARGS__ "keyword".
...
llvm-svn: 38771
2006-07-29 03:47:08 +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
f30dcbe07e
new testcase
...
llvm-svn: 38768
2006-07-29 01:24:46 +00:00
Chris Lattner
331ad778b0
Implement paste avoidance, implementing Preprocessor/output_paste_avoid.c
...
llvm-svn: 38767
2006-07-28 06:56:01 +00:00
Chris Lattner
3961e60991
Tweak expected results do to paste avoidance.
...
llvm-svn: 38766
2006-07-28 06:55:35 +00:00
Chris Lattner
341c9a1615
new testcase for paste avoidance
...
llvm-svn: 38765
2006-07-28 06:54:07 +00:00
Chris Lattner
24fad1a82f
update notes. Function-style macros are largely done.
...
llvm-svn: 38764
2006-07-28 05:25:01 +00:00
Chris Lattner
b1d2594456
Add test for pasting empty formals
...
llvm-svn: 38763
2006-07-28 05:13:36 +00:00
Chris Lattner
f3f1c709cf
Use a continue to avoid indentation of a bunch of code
...
llvm-svn: 38762
2006-07-28 05:10:36 +00:00
Chris Lattner
a9dc597fca
Implement pasting of arguments that expand to no tokens. This handles the
...
C99 "placemarker" concept.
llvm-svn: 38761
2006-07-28 05:07:04 +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
fdc0abe619
new testcase
...
llvm-svn: 38759
2006-07-27 06:17:55 +00:00
Chris Lattner
b57aa46e41
Switch ExpandFunctionArguments to use a smallvector instead of a vector,
...
speeding up my macro expansion torture test from .75s to .5s (33%!)
llvm-svn: 38758
2006-07-27 03:42:15 +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
6fc08bc77d
Add a new getArgLength method and refactor some code to use it
...
llvm-svn: 38755
2006-07-26 04:55:32 +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
7fa8c889e2
Add a single-entry cache for macro instantation locations. This significantly
...
reduces the number of FileID's made and tracked.
llvm-svn: 38752
2006-07-20 06:48:52 +00:00
Chris Lattner
a5f4c882e2
disable malformed string/character errors when in raw mode. This fixes
...
test/Lexer/badstring_in_if0.c
llvm-svn: 38751
2006-07-20 06:08:47 +00:00
Chris Lattner
032e6170af
new testcase
...
llvm-svn: 38750
2006-07-20 06:06:55 +00:00
Chris Lattner
5a78a02ea2
If an invalid string or character is read, return the invalid part as a tok::unknown token.
...
llvm-svn: 38749
2006-07-20 06:02:19 +00:00
Chris Lattner
08ba4c015f
fix obvious bug that caused Preprocessor/macro_paste_bad.c to fail.
...
llvm-svn: 38748
2006-07-20 04:52:59 +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
22549fe6a5
With recent simplifications, this check can be removed from a fastpath.
...
llvm-svn: 38745
2006-07-20 04:20:02 +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
9100cff701
new testcase
...
llvm-svn: 38743
2006-07-19 08:13:21 +00:00
Chris Lattner
ae637cd2a9
new testcase from c99 rationale
...
llvm-svn: 38742
2006-07-19 08:04:22 +00:00
Chris Lattner
e11dd370ec
new testcase
...
llvm-svn: 38741
2006-07-19 08:01:28 +00:00
Chris Lattner
4505e89d0f
Make diagnostic message better
...
llvm-svn: 38740
2006-07-19 06:41:46 +00:00
Chris Lattner
85c0e4d780
new testcase
...
llvm-svn: 38739
2006-07-19 06:40:07 +00:00
Chris Lattner
b563379d78
Make this testcase more interesting, actually add a RUN line.
...
llvm-svn: 38738
2006-07-19 06:34:41 +00:00
Chris Lattner
a7e2e74cef
Avoid testing / ## * in the lexer. This will cause an unhelpful error message
...
to be emitted from the lexer. This fixes macro_paste_c_block_comment.c
llvm-svn: 38737
2006-07-19 06:32:35 +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
ab30c0360d
Make this testcase more interesting, actually add run lines :)
...
llvm-svn: 38735
2006-07-19 05:48:15 +00:00
Chris Lattner
e8dcfef324
Fix test/Preprocessor/macro_paste_spacing.c
...
llvm-svn: 38734
2006-07-19 05:45:55 +00:00
Chris Lattner
01ecf835c2
Implement basic token pasting (## operator). This implements
...
test/Preprocessor/macro_paste_simple.c and macro_paste_bad.c. There are
several known bugs still.
llvm-svn: 38733
2006-07-19 05:42:48 +00:00
Chris Lattner
a0d9bf4e83
Fix message in assert to be more accurate.
...
llvm-svn: 38732
2006-07-19 05:42:09 +00:00
Chris Lattner
f918bf71ef
update comment
...
llvm-svn: 38731
2006-07-19 05:01:18 +00:00
Chris Lattner
da63bcdc03
Simplify this by using a higher-level method.
...
llvm-svn: 38730
2006-07-19 04:36:03 +00:00
Chris Lattner
7e2e669080
Handle really simple expansion of ## formals. Do not handle the empty case
...
yet though.
llvm-svn: 38729
2006-07-19 03:51:26 +00:00
Chris Lattner
81500bc3ae
cleanups, add some code for instrumenting stat
...
llvm-svn: 38728
2006-07-19 03:40:07 +00:00
Chris Lattner
c5cd2d6556
Add some notes
...
llvm-svn: 38727
2006-07-19 03:39:58 +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
d945fc80d7
update
...
llvm-svn: 38725
2006-07-16 18:44:57 +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
1e17abb2fd
new testcase
...
llvm-svn: 38723
2006-07-16 18:15:05 +00:00
Chris Lattner
351050bcf5
Add a check that the physloc for a macro instantiation is not another macro.
...
llvm-svn: 38722
2006-07-16 18:05:08 +00:00
Chris Lattner
e1954ac1a3
Fix comment
...
llvm-svn: 38721
2006-07-15 23:40:13 +00:00
Chris Lattner
203b4568e2
Implement basic argument substitution. This implements
...
test/Preprocessor/macro_fn_disable_expand.c
llvm-svn: 38720
2006-07-15 21:07:40 +00:00
Chris Lattner
1b9f17bc6e
new testcase
...
llvm-svn: 38719
2006-07-15 21:06:48 +00:00
Chris Lattner
7c58149107
Clarify assertion
...
llvm-svn: 38718
2006-07-15 07:56:31 +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
6ae37dfba3
new testcase
...
llvm-svn: 38714
2006-07-15 06:53:24 +00:00
Chris Lattner
6016169cb8
The leading space flag of a stringized string matches that of the # operator.
...
llvm-svn: 38713
2006-07-15 06:48:02 +00:00
Chris Lattner
c783d1dff9
Implement the microsoft charize extension #@
...
llvm-svn: 38712
2006-07-15 06:11:25 +00:00
Chris Lattner
2b271db205
Lex the microsoft 'charize' extension.
...
llvm-svn: 38711
2006-07-15 05:41:09 +00:00
Chris Lattner
f2781509f9
Add a comment giving an example of the error
...
llvm-svn: 38710
2006-07-15 05:27:44 +00:00
Chris Lattner
0707bd3042
Implement stringification.
...
llvm-svn: 38709
2006-07-15 05:23:58 +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
b935d8cd90
Set up infrastructure for function-like macro expansion with preexpansion
...
stringizing, etc.
llvm-svn: 38707
2006-07-14 06:54:44 +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
12a8178393
add a note
...
llvm-svn: 38705
2006-07-14 05:26:56 +00:00
Chris Lattner
f69f835398
new testcase
...
llvm-svn: 38704
2006-07-11 05:53:01 +00:00
Chris Lattner
041bef8b32
The lexer should not warn about stray characters, it should just return
...
tok::unknown tokens. This fixes test/Lexer/unknown-char.c
llvm-svn: 38703
2006-07-11 05:52:53 +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