Chris Lattner
96c3deb53d
Simplify handling of the ternary operator even more. Now it just looks like
...
any average right-associative operator to most of the code.
llvm-svn: 38880
2006-08-12 17:13:08 +00:00
Chris Lattner
d35c34f44d
Fix incorrect parsing of the ?: middle term, which is supposed to be
...
parsed as 'expression'. This implements test/Parser/statements.c
llvm-svn: 38879
2006-08-12 17:04:50 +00:00
Chris Lattner
eb17652f5f
Check that ?: parses its RHS as 'expression'.
...
llvm-svn: 38878
2006-08-12 17:04:23 +00:00
Chris Lattner
a0927cecb5
Improve diagnostics on cases like:
...
return a ? ` a;
After the expression is diagnosed, skip to the ';', so that the lack of
semicolon is not also diagnosed.
llvm-svn: 38877
2006-08-12 16:59:03 +00:00
Chris Lattner
6c3f05d1d2
Diagnose use of compound literals in C90 code
...
llvm-svn: 38876
2006-08-12 16:54:25 +00:00
Chris Lattner
b7f1fc95d3
cleanups, better comments.
...
llvm-svn: 38875
2006-08-12 16:45:01 +00:00
Chris Lattner
cde626ae9b
Implement a first cut at binary expression parsing using a simple operator
...
precedence-based parser.
llvm-svn: 38874
2006-08-12 08:13:25 +00:00
Chris Lattner
89c50c65af
Return information about whether expression parsing was successful
...
llvm-svn: 38873
2006-08-11 06:41:18 +00:00
Chris Lattner
5bd57e0c73
Significant improvements to error recovery
...
llvm-svn: 38872
2006-08-11 06:40:25 +00:00
Chris Lattner
81b576ee0d
Merge ParsePostfixExpression into ParseCastExpression. This allows us to
...
implement support for compound literals followed by postfix-expr suffixes,
such as:
(struct{ int a;}){ 1}.a
llvm-svn: 38871
2006-08-11 02:13:20 +00:00
Chris Lattner
3401781548
Add another testcase
...
llvm-svn: 38870
2006-08-11 02:12:35 +00:00
Chris Lattner
eaf06598ea
Merge ParseUnaryExpression and ParseCastExpression.
...
llvm-svn: 38869
2006-08-11 02:02:23 +00:00
Chris Lattner
a092cd1f1b
Implement parsing of casts, implementing Parser/statements.c:test6
...
llvm-svn: 38868
2006-08-11 01:38:28 +00:00
Chris Lattner
eddbcb2b12
Add sizeof/cast/compound_expr tests.
...
llvm-svn: 38867
2006-08-11 01:38:08 +00:00
Chris Lattner
4add4e6c12
Simplify paren parsing, finish parsing of sizeof expressions and other cases.
...
llvm-svn: 38866
2006-08-11 01:33:00 +00:00
Chris Lattner
f5fbd7963d
Implement type-name parsing, and simple compound initializer parsing.
...
llvm-svn: 38865
2006-08-10 23:56:11 +00:00
Chris Lattner
4564bc1123
Factor some code into the new Parser::MatchRHSPunctuation method.
...
llvm-svn: 38864
2006-08-10 23:14:52 +00:00
Chris Lattner
b33dd875fe
add note
...
llvm-svn: 38863
2006-08-10 23:01:28 +00:00
Chris Lattner
c2dd85ac9e
Implement most of unary-expression parsing.
...
llvm-svn: 38862
2006-08-10 22:57:16 +00:00
Chris Lattner
f833977a8a
implement postfix-expression parsing.
...
llvm-svn: 38861
2006-08-10 22:01:51 +00:00
Chris Lattner
52a99e5cee
Parse primary expressions, handle string concatenation
...
llvm-svn: 38860
2006-08-10 20:56:00 +00:00
Chris Lattner
36a48b10be
add notes
...
llvm-svn: 38859
2006-08-10 20:00:01 +00:00
Chris Lattner
c5e0d4a6ae
stub out some entry points for the expr parsing code.
...
llvm-svn: 38858
2006-08-10 19:06:03 +00:00
Chris Lattner
ee2cdfdd2d
Move files around
...
llvm-svn: 38857
2006-08-10 19:05:43 +00:00
Chris Lattner
2b18b7faa7
Add some notes
...
llvm-svn: 38856
2006-08-10 18:48:21 +00:00
Chris Lattner
eb8a28f7b7
Rename some files
...
llvm-svn: 38855
2006-08-10 18:43:39 +00:00
Chris Lattner
2f9980ef14
Implement Parser/statements.c:test5: parsing decls that start with identifiers
...
in blocks.
llvm-svn: 38854
2006-08-10 18:39:24 +00:00
Chris Lattner
6dfd97806e
Add support for simple labels.
...
llvm-svn: 38853
2006-08-10 18:31:37 +00:00
Chris Lattner
f8afb62ef9
Add support for parsing declarations in blocks. This implements
...
Parser/statements.c:test4
llvm-svn: 38852
2006-08-10 18:26:31 +00:00
Chris Lattner
d2685cf6bb
Parse case/default labeled-statements.
...
llvm-svn: 38851
2006-08-10 05:59:48 +00:00
Chris Lattner
97353f2327
add test3
...
llvm-svn: 38850
2006-08-10 05:59:30 +00:00
Chris Lattner
503fadc90f
Parse jump-statement: goto, continue, break, return.
...
llvm-svn: 38849
2006-08-10 05:45:44 +00:00
Chris Lattner
ab180365ac
Add a warning
...
llvm-svn: 38848
2006-08-10 05:22:36 +00:00
Chris Lattner
53361ac130
Refactor init-declarator-list parsing code to allow for-statements to have
...
initializers in them.
llvm-svn: 38847
2006-08-10 05:19:57 +00:00
Chris Lattner
9075bd7727
implement switch/while/do/for statement parsing, implementing Parser/statements.c:test2
...
llvm-svn: 38846
2006-08-10 04:59:57 +00:00
Chris Lattner
905caf37a0
add test2
...
llvm-svn: 38845
2006-08-10 04:59:23 +00:00
Chris Lattner
c951dae2a4
Parse if statements
...
llvm-svn: 38844
2006-08-10 04:23:57 +00:00
Chris Lattner
4dfe4b9da1
new testcase
...
llvm-svn: 38843
2006-08-09 05:47:56 +00:00
Chris Lattner
0ccd51ebe2
Start parsing statements and function bodies. This implements
...
Parser/statements.c:test1.
llvm-svn: 38842
2006-08-09 05:47:47 +00:00
Chris Lattner
fff824fe14
Simplify and fill out parsing of function bodies.
...
llvm-svn: 38841
2006-08-07 06:31:38 +00:00
Chris Lattner
2534b877b4
add some accessor methods.
...
llvm-svn: 38840
2006-08-07 05:50:47 +00:00
Chris Lattner
bf320c84a5
better comments, infrastructure for parsing function bodies.
...
llvm-svn: 38839
2006-08-07 05:05:30 +00:00
Chris Lattner
d5d0a6c2b5
Capture function information, provide a place to validate Declarator information.
...
llvm-svn: 38838
2006-08-07 00:58:14 +00:00
Chris Lattner
a350722189
comment cleanup
...
llvm-svn: 38837
2006-08-07 00:33:37 +00:00
Chris Lattner
6c7416c382
Start capturing pointer and array declarator info.
...
llvm-svn: 38836
2006-08-07 00:19:33 +00:00
Chris Lattner
14776b9501
Implement some more error recovery
...
llvm-svn: 38835
2006-08-06 22:27:40 +00:00
Chris Lattner
0ef405cdb9
MAke the default be to stop at ;'s
...
llvm-svn: 38834
2006-08-06 22:00:57 +00:00
Chris Lattner
eec40f9990
Start implementing error recovery, this implements test/Parser/recovery-1.c
...
llvm-svn: 38833
2006-08-06 21:55:29 +00:00
Chris Lattner
944bde95ef
new testcase
...
llvm-svn: 38832
2006-08-06 21:55:13 +00:00
Chris Lattner
1906f8087d
Improve handling of [*]
...
llvm-svn: 38831
2006-08-06 19:14:46 +00:00
Chris Lattner
8a39edc931
Warn for c99-specific array use
...
llvm-svn: 38830
2006-08-06 18:33:32 +00:00
Chris Lattner
cc211add25
Make this testcase pass the right arg.
...
llvm-svn: 38829
2006-08-06 18:31:20 +00:00
Chris Lattner
e8074e65dd
Parse array declarators, tested by Parser/declarators.c
...
llvm-svn: 38828
2006-08-06 18:30:15 +00:00
Chris Lattner
eecc5b53ae
Add a -fsyntax-only argument
...
llvm-svn: 38827
2006-08-06 18:29:56 +00:00
Chris Lattner
c697e028c6
Run tests in a specific order
...
llvm-svn: 38826
2006-08-06 18:29:35 +00:00
Chris Lattner
df89dd42d7
new testcase
...
llvm-svn: 38825
2006-08-06 18:22:00 +00:00
Chris Lattner
acd58a3c33
Parse parenthesized and function declarators now, allowing us to parse things
...
like: "void (*signal(int, void (*)(int)))(int);"
llvm-svn: 38824
2006-08-06 17:24:14 +00:00
Chris Lattner
15356a7065
Start capturing declarator information in a new Declarator object.
...
llvm-svn: 38823
2006-08-06 00:02:28 +00:00
Chris Lattner
2df305abfa
New file
...
llvm-svn: 38822
2006-08-05 23:08:14 +00:00
Chris Lattner
971c6b681a
Add scaffolding for scopes.
...
llvm-svn: 38821
2006-08-05 22:46:42 +00:00
Chris Lattner
2d4f2c3ebe
Update comment
...
llvm-svn: 38820
2006-08-05 22:09:17 +00:00
Chris Lattner
d286488c5f
Make error recovery "better"
...
llvm-svn: 38819
2006-08-05 08:09:44 +00:00
Chris Lattner
d9c3c59fc0
Continue work on declspecs and declarations
...
llvm-svn: 38818
2006-08-05 06:26:47 +00:00
Chris Lattner
8e90ef6ccc
add some notes
...
llvm-svn: 38817
2006-08-05 03:30:45 +00:00
Chris Lattner
f63f89acc2
Handle __thread and storage-class-specifiers
...
llvm-svn: 38816
2006-08-05 03:28:50 +00:00
Chris Lattner
fe533e3ecd
make error message more useful
...
llvm-svn: 38815
2006-08-05 02:54:06 +00:00
Chris Lattner
158ede8e44
Add a citation
...
llvm-svn: 38814
2006-08-04 06:42:38 +00:00
Chris Lattner
1ae23294fb
C99 requires at least one type specifier.
...
llvm-svn: 38813
2006-08-04 06:42:31 +00:00
Chris Lattner
fef9d2bba7
Diagnose specifiers with invalid _Complex/_Imaginary components.
...
llvm-svn: 38812
2006-08-04 06:36:52 +00:00
Chris Lattner
839713c085
Emit diagnostics for things like 'signed _Bool' and 'short float'
...
llvm-svn: 38811
2006-08-04 06:15:52 +00:00
Chris Lattner
494f27a0b8
Enable _Bool as an extension in C++
...
llvm-svn: 38810
2006-08-04 06:12:13 +00:00
Chris Lattner
6d998556de
Fix precedence problem
...
llvm-svn: 38809
2006-08-04 06:11:48 +00:00
Chris Lattner
deb42f5a96
Add some missing assignments.
...
llvm-svn: 38808
2006-08-04 05:26:52 +00:00
Chris Lattner
da48a8e66b
Parse and validate cvr type-qualifiers
...
llvm-svn: 38807
2006-08-04 05:25:55 +00:00
Chris Lattner
22dc378630
Split LangOptions out into its own header
...
llvm-svn: 38806
2006-08-04 04:44:06 +00:00
Chris Lattner
b9093cd1d0
Add an initial cut at a datastructure for holding declspec's.
...
llvm-svn: 38805
2006-08-04 04:39:53 +00:00
Chris Lattner
c0acd3d621
Split declaration parsing out into Declarations.cpp
...
llvm-svn: 38804
2006-07-31 05:13:43 +00:00
Chris Lattner
70f32b7d68
Add initial very-incomplete support for parsing declarations. We just manage
...
to be able to parse "int x;" now.
llvm-svn: 38803
2006-07-31 05:09:04 +00:00
Chris Lattner
0bb5f835e4
initial support for parsing, right now just ;'s at the top level, but this
...
adds most simple scaffolding.
llvm-svn: 38802
2006-07-31 01:59:18 +00:00
Chris Lattner
34dfaee634
Misc cleanups
...
llvm-svn: 38801
2006-07-31 01:57:54 +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
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
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
b63d9de243
new tests
...
llvm-svn: 38698
2006-07-11 05:03:43 +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
370c135dce
improve comment
...
llvm-svn: 38696
2006-07-11 04:03:32 +00:00
Chris Lattner
2acdac4200
Implement scanning-for-( more correctly. This implements
...
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.
llvm-svn: 38695
2006-07-11 04:02:48 +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
53ede2a826
new testcase
...
llvm-svn: 38693
2006-07-11 04:00:23 +00:00
Chris Lattner
db878cde8e
Add an interesting observation :)
...
llvm-svn: 38692
2006-07-10 06:34:50 +00:00
Chris Lattner
eb54b5973e
Add simple optimization: check for (and skip) spaces and tabs immediately
...
before lexing a token. This speeds the common case where tokens are
separated by small amount of whitespace. This makes a slight but
reproducible positive effect lexing a preprocessed carbon.h.
llvm-svn: 38691
2006-07-10 06:34:27 +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
d0a96ba38a
Add a simple but useful optimization for identifier lookup. Each time we
...
query the hash table, when we look up an identifier that isn't at the head
of it's bucket's list, move it there. This reduces the number of list
traversals in the common case where identifiers are used in bursts.
llvm-svn: 38689
2006-07-10 06:10:51 +00:00
Chris Lattner
9e220173e6
add some notes about MS extensions
...
llvm-svn: 38688
2006-07-10 02:49:22 +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
8eede3e6c0
Remove pointless comments.
...
llvm-svn: 38684
2006-07-08 23:24:05 +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