Chris Lattner
54d032bb76
CStringMap -> StringMap.
...
llvm-svn: 39334
2007-02-08 19:24:25 +00:00
Chris Lattner
34d1f5a8de
adjust to CStringMap interface change.
...
llvm-svn: 39333
2007-02-08 19:08:49 +00:00
Chris Lattner
9561a0b3e7
Add support for target-independent builtin functions (like __builtin_abs),
...
whose decl objects are lazily created the first time they are referenced.
Builtin functions are described by the clang/AST/Builtins.def file, which
makes it easy to add new ones.
This is missing two important pieces:
1. Support for the rest of the gcc builtins.
2. Support for target-specific builtins (e.g. __builtin_ia32_emms).
Just adding this builtins reduces the number of implicit function definitions
by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h.
I need to add all the i386-specific ones to eliminate several hundred more.
ugh.
llvm-svn: 39327
2007-01-28 08:20:04 +00:00
Chris Lattner
3e7592ea78
Add support for -fno-operator-names, patch by Bill.
...
llvm-svn: 39245
2006-12-04 07:48:37 +00:00
Chris Lattner
652c16924e
Produce a nice error message for '#define and' in C++. Patch by Bill!
...
llvm-svn: 39218
2006-11-21 23:47:30 +00:00
Chris Lattner
2bb8a95389
eliminate string compares when checking for the 'defined' token.
...
llvm-svn: 39216
2006-11-21 22:24:17 +00:00
Chris Lattner
5b9f4891d7
Add support for C++ operator keywords. Patch by Bill Wendling.
...
llvm-svn: 39214
2006-11-21 17:23:33 +00:00
Chris Lattner
b352e3edb5
Change KeepComments/KeepMacroComments modes to be facets of the preprocessor
...
state, not aspects of the language standard being parsed.
llvm-svn: 39209
2006-11-21 06:17:10 +00:00
Chris Lattner
ad7cdd37b3
simplify the Preprocessor ctor.
...
llvm-svn: 39208
2006-11-21 06:08:20 +00:00
Chris Lattner
b8d6d5a81d
Formalize preprocessor callbacks together into a PPCallbacks structure, instead
...
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
2006-11-21 04:09:30 +00:00
Chris Lattner
c95c8f2356
Fix a bug
...
llvm-svn: 39128
2006-11-05 07:59:22 +00:00
Chris Lattner
cf6bc66421
silence some warnings when asserts are disabled.
...
llvm-svn: 39127
2006-11-05 07:59:08 +00:00
Chris Lattner
57dd8360f6
implement FIXME: replace use of alloca with use of SmallVector.
...
llvm-svn: 39102
2006-11-03 07:45:04 +00:00
Chris Lattner
7cee11f078
Export the ASTBuilder class from the AST module.
...
llvm-svn: 39095
2006-11-03 06:42:29 +00:00
Chris Lattner
9f6604fa60
Add altivec version of block comment skipping code.
...
llvm-svn: 39093
2006-10-30 20:01:22 +00:00
Chris Lattner
c07ba1fe2f
Refactor the paths used for checking and getting the spelling of #include
...
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
2006-10-30 05:58:32 +00:00
Chris Lattner
b8b94f1e9b
Make Preprocessor::LookupFile take a character range instead of a string.
...
This avoids some copying in its clients.
llvm-svn: 39091
2006-10-30 05:38:06 +00:00
Chris Lattner
7cdbad945d
Push strings out of the HeaderSearch interface, it now deals solely with
...
character ranges.
llvm-svn: 39090
2006-10-30 05:33:15 +00:00
Chris Lattner
ee7bf89cd6
Change framework cache map from map to CStringMap. This speeds up PP user
...
time on Cocoa.h from 0.078 to 0.077s.
llvm-svn: 39089
2006-10-30 05:19:23 +00:00
Chris Lattner
b201d9b13d
Eliminate string use in DoFrameworkLookup. This speeds up pp of Cocoa.h
...
marginally from 0.079 to 0.078s.
llvm-svn: 39088
2006-10-30 05:09:49 +00:00
Chris Lattner
cf8ddac4bc
Use SmallString instead of string in HeaderSearch::LookupFile. This avoids
...
malloc traffic, speeding up user time preprocessing Carbon.h 5% (0.083s to
0.079s).
llvm-svn: 39087
2006-10-30 04:42:33 +00:00
Chris Lattner
43fd42e4d9
Wean LookupSubframeworkHeader off std::strings, use the new SmallString
...
class instead. SmallString allows to code to avoid hitting malloc in
the normal case (or will, when some other stuff is converted over).
llvm-svn: 39084
2006-10-30 03:40:58 +00:00
Chris Lattner
da933aac0c
remove some temporary testing code
...
llvm-svn: 39080
2006-10-29 23:49:15 +00:00
Chris Lattner
2b9e19be87
Pull the string hashtable out of the IdentifierTable, moving into LLVM's
...
libsupport. Now it can be used for other things besides identifier hashing.
llvm-svn: 39079
2006-10-29 23:43:13 +00:00
Chris Lattner
ec659fce46
move memory allocation abstraction stuff out into LLVM's libsupport
...
llvm-svn: 39078
2006-10-29 22:09:44 +00:00
Chris Lattner
3bc804ed3d
genericize IdentifierInfo interface to make it work more naturally.
...
llvm-svn: 39076
2006-10-28 23:46:24 +00:00
Chris Lattner
bcb416bbd5
Implement test/Preprocessor/comment_save_if.c
...
llvm-svn: 39069
2006-10-27 05:43:50 +00:00
Chris Lattner
9916c5ca7e
Remove GNU C++ min/max operator extension support, they have been removed
...
from gcc mainline.
llvm-svn: 39067
2006-10-27 05:24:37 +00:00
Chris Lattner
ffda89611f
Change DirectoryEntry::getName() to return a const char *
...
llvm-svn: 39066
2006-10-27 05:15:55 +00:00
Chris Lattner
480434865d
change FileEntry::getName to return a const char*.
...
llvm-svn: 39065
2006-10-27 05:12:36 +00:00
Chris Lattner
56bdb9a9a1
Remove identifier length field from IdentifierInfo, it is now dead.
...
llvm-svn: 39063
2006-10-27 05:06:38 +00:00
Chris Lattner
a883116ece
fix bug reprobing.
...
llvm-svn: 39062
2006-10-27 04:54:47 +00:00
Chris Lattner
089e51923e
remove todo
...
llvm-svn: 39061
2006-10-27 04:53:38 +00:00
Chris Lattner
aded4a977d
Implement an sse2 version of the block comment scanner.
...
llvm-svn: 39060
2006-10-27 04:42:31 +00:00
Chris Lattner
6cc3e36cd7
Speed up block comment skipping by 35%.
...
llvm-svn: 39059
2006-10-27 04:12:35 +00:00
Chris Lattner
f2e3ac3b54
reimplement identifier hash table in terms of a probed table instead of a chained
...
table. This is about 25% faster for identifier lookup. This also implements
resizing of the hash table.
llvm-svn: 39058
2006-10-27 03:59:10 +00:00
Chris Lattner
341fd06d3c
Use the full hash as a filter to reduce # strcmps
...
llvm-svn: 39057
2006-10-26 05:18:38 +00:00
Chris Lattner
893f272c39
Track the full (not mod the hash table size) hash value for each token.
...
This lets us find interesting properties of the hash distribution.
llvm-svn: 39056
2006-10-26 05:12:31 +00:00
Chris Lattner
05646c7f0e
Fix these to allow clang to be in any dir.
...
llvm-svn: 39055
2006-10-26 04:56:55 +00:00
Chris Lattner
b19f796e97
llvm has no EH by default, no need for these flags.
...
llvm-svn: 39047
2006-10-25 05:09:05 +00:00
Chris Lattner
0ba3dc4ec3
Start removing LexerToken from the actions interface.
...
llvm-svn: 39043
2006-10-25 03:38:23 +00:00
Chris Lattner
3c98fd3af3
Switch to using a bitwise and instead of modulus.
...
llvm-svn: 39038
2006-10-22 17:48:27 +00:00
Chris Lattner
07b019a1bc
add #include
...
llvm-svn: 39034
2006-10-22 07:28:56 +00:00
Chris Lattner
5ed76da296
Implement framework filesystem caching.
...
llvm-svn: 39031
2006-10-22 07:24:13 +00:00
Chris Lattner
641a0be31b
count # framework lookups
...
llvm-svn: 39026
2006-10-20 06:23:14 +00:00
Chris Lattner
a4271e4a51
rename
...
llvm-svn: 39024
2006-10-20 06:13:26 +00:00
Chris Lattner
5c683b2b4b
Fix a regression introduced when adding subframework support
...
llvm-svn: 39022
2006-10-20 05:12:14 +00:00
Chris Lattner
62aa0d4c9f
Implement test/Preprocessor/macro_arg_keyword.c
...
llvm-svn: 39021
2006-10-20 05:08:24 +00:00
Chris Lattner
577377e847
Speed up [sub]framework searching
...
llvm-svn: 39017
2006-10-20 04:55:45 +00:00
Chris Lattner
63dd32b656
Implement subframework lookup
...
llvm-svn: 39015
2006-10-20 04:42:40 +00:00
Chris Lattner
25e0d54a0e
Move keyword setup from the preprocessor into the IdentifierTable class.
...
llvm-svn: 39014
2006-10-18 06:07:05 +00:00
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
dd0b7cbf0b
Oversight: fixes test/Lexer/number.c
...
llvm-svn: 38998
2006-10-17 02:53:51 +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
07560ed0cf
Fix precedence bug
...
llvm-svn: 38793
2006-07-29 07:26:48 +00:00
Chris Lattner
f76e62ecad
Implement support for #__VA_ARGS__
...
llvm-svn: 38791
2006-07-29 07:14:41 +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
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
479b0af31d
Improve placemarker handling, implementing Preprocessor/macro_fn_placemarker.c
...
llvm-svn: 38778
2006-07-29 04:16:20 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Chris Lattner
e8eef3207b
add infrastructure for warning if redef'd macro bodies differ, but don't
...
fully implement it.
Fix warning on #define __LINE__ to warn about redefinition, not #undef.
llvm-svn: 38679
2006-07-08 07:01:00 +00:00
Chris Lattner
8ff7199e4b
Warn about __VA_ARGS__ when used outside of a macro expansion
...
llvm-svn: 38678
2006-07-06 05:17:39 +00:00
Chris Lattner
bff18d5649
Diagnose erroneous macro definitions where a ## operator is at the start/end of the macro
...
llvm-svn: 38677
2006-07-06 04:49:18 +00:00
Chris Lattner
27746e476a
Fix Preprocessor/macro_space.c, which failed because the ! token had
...
identifier info incorrectly set.
llvm-svn: 38674
2006-07-05 00:07:54 +00:00
Chris Lattner
d3a15f7f4e
Add a fast-path in getSpelling for identifiers.
...
llvm-svn: 38672
2006-07-04 23:01:03 +00:00
Chris Lattner
ef9eae1c44
Change the Preprocessor::getSpelling interface to let it be zero-copy in
...
the common case.
llvm-svn: 38671
2006-07-04 22:33:12 +00:00
Chris Lattner
a3f827e0a6
add a comment explaining why this is written funny
...
llvm-svn: 38670
2006-07-04 22:22:45 +00:00
Chris Lattner
0e1cf1f588
Fix indentation
...
llvm-svn: 38655
2006-07-04 18:53:52 +00:00
Chris Lattner
b9d90f709e
Detect expressions semantically equivalent to !defined(X) for the multiple-include
...
optimization.
llvm-svn: 38654
2006-07-04 18:32:03 +00:00
Chris Lattner
e3519cc948
Change EvaluateValue/EvaluateDirectiveSubExpr to be static functions in
...
PPExpressions.cpp instead of methods.
llvm-svn: 38652
2006-07-04 18:11:39 +00:00
Chris Lattner
8096542744
refactor code a little, no functionality change
...
llvm-svn: 38651
2006-07-04 18:03:19 +00:00
Chris Lattner
c79f6fb108
Rename IdentifierTokenInfo -> IdentifierInfo.
...
llvm-svn: 38650
2006-07-04 17:53:21 +00:00
Chris Lattner
a8654ca2cf
Eliminate MultipleIncludeOpt::ReadDirective and all calls to it. Any directives
...
that are lexed are made up of tokens, so the calls are just ugly and redundant.
Hook up the MIOpt for the #if case. PPCExpressions doesn't currently implement
the hook though, so we still don't handle #if !defined(X) with the MIOpt.
llvm-svn: 38649
2006-07-04 17:42:08 +00:00
Chris Lattner
3665f161ca
Implement the multiple-include file optimization.
...
llvm-svn: 38647
2006-07-04 07:26:10 +00:00
Chris Lattner
371ac8a9b7
Implement the automaton for recognizing files with controlling macros.
...
llvm-svn: 38646
2006-07-04 07:11:10 +00:00
Chris Lattner
d7dfa57efd
cleanup fixme's
...
llvm-svn: 38645
2006-07-04 04:50:35 +00:00
Chris Lattner
01d66cc891
Implement #ident and #sccs
...
llvm-svn: 38643
2006-07-03 22:16:27 +00:00
Chris Lattner
b085f937a0
The location of a _Pragma expanded token is the location of the string, not the
...
_Pragma token
llvm-svn: 38640
2006-07-03 06:10:36 +00:00
Chris Lattner
d7de629c32
Move a method inline
...
llvm-svn: 38639
2006-07-03 06:05:41 +00:00
Chris Lattner
a78a97e82f
#ifdef X, #ifndef X, and #if defined(X) all mark X as used.
...
llvm-svn: 38638
2006-07-03 05:42:18 +00:00
Chris Lattner
2e1553070e
Move a PragmaNamespace method out of line.
...
llvm-svn: 38636
2006-07-03 05:34:41 +00:00
Chris Lattner
83913dde23
remove dead var
...
llvm-svn: 38635
2006-07-03 05:31:31 +00:00
Chris Lattner
f88c53a02f
Fix test/Preprocessor/_Pragma-syshdr2.c.
...
llvm-svn: 38634
2006-07-03 05:26:05 +00:00
Chris Lattner
13044d942d
Implement -Wunused-macros functionality.
...
llvm-svn: 38632
2006-07-03 05:16:44 +00:00
Chris Lattner
4ec473f871
Add support to track the real top-level file.
...
llvm-svn: 38630
2006-07-03 05:16:05 +00:00
Chris Lattner
040a4ab71e
Compile without rtti or exceptions.
...
llvm-svn: 38629
2006-07-03 05:01:42 +00:00
Chris Lattner
91cbf11c10
Add a new IdentifierVisitor class and a new IdentifierTable::VisitIdentifiers
...
method to support iteration over all identifiers.
llvm-svn: 38628
2006-07-03 04:28:52 +00:00
Chris Lattner
44f8a66bcc
Fix test/Preprocessor/macro_defined.c, factor some code.
...
llvm-svn: 38627
2006-07-03 01:27:27 +00:00
Chris Lattner
aaf09115c4
Implement a FIXME: reject '#define defined'.
...
llvm-svn: 38625
2006-07-03 01:17:59 +00:00
Chris Lattner
e3e81ea8aa
Refactor some code into a new Lexer::Stringify method.
...
llvm-svn: 38624
2006-07-03 01:13:26 +00:00
Chris Lattner
0766e592ce
Implement a FIXME: correctly stringify filenames generated by __LINE__.
...
llvm-svn: 38622
2006-07-03 01:07:01 +00:00
Chris Lattner
4d5e1a72f4
Classify fixme's
...
llvm-svn: 38621
2006-07-03 01:01:29 +00:00
Chris Lattner
505c547b8e
Cleanup fixme comments
...
llvm-svn: 38620
2006-07-03 00:55:48 +00:00
Chris Lattner
98a5312478
Give tokens expanded from _Pragma directives correct source locations.
...
This implements test/Preprocessor/_Pragma-location.c
llvm-svn: 38619
2006-07-02 23:00:20 +00:00
Chris Lattner
a37664b3fb
Move a virtual method out-of-line
...
llvm-svn: 38617
2006-07-02 22:45:51 +00:00
Chris Lattner
b694ba7b40
Move some Pragma-related methods from Preprocessor.cpp to Pragma.cpp
...
llvm-svn: 38616
2006-07-02 22:41:36 +00:00
Chris Lattner
1840e491dc
Remove Lexer::BufferStart, an unneeded instance var.
...
llvm-svn: 38615
2006-07-02 22:30:01 +00:00
Chris Lattner
8bbfe46475
Fix Preprocessor/_Pragma-physloc.c, by making sure that the returned location
...
of the token is relative to the start of the buffer, not relative to the start
position of the lexer.
llvm-svn: 38614
2006-07-02 22:27:49 +00:00
Chris Lattner
e4af3ac6b4
Fix some minor issues with _Pragma
...
llvm-svn: 38610
2006-07-02 21:32:47 +00:00
Chris Lattner
ecfeafe3ba
Fix some minor bugs handling _Pragma, including
...
test/Preprocessor/_Pragma_syshdr.c
llvm-svn: 38609
2006-07-02 21:26:45 +00:00
Chris Lattner
69772b026e
Implement the _Pragma-style of pragma handling, implementing
...
test/Preprocessor/_Pragma-poison.c.
This unifies the MacroStack and IncludeStack together into IncludeMacroStack.
llvm-svn: 38606
2006-07-02 20:34:39 +00:00
Chris Lattner
4cca5ba7da
Allow the buffer start/end positions to be optionally specified. Make sure
...
to use them instead of the current buffer start/end when computing diagnostics.
llvm-svn: 38603
2006-07-02 20:05:54 +00:00
Chris Lattner
847e0e4552
Implement __TIMESTAMP__
...
llvm-svn: 38602
2006-07-01 23:49:16 +00:00
Chris Lattner
c1283b90a0
Implement __INCLUDE_LEVEL__ and __BASE_FILE__
...
llvm-svn: 38601
2006-07-01 23:16:30 +00:00
Chris Lattner
630b33c39e
Implement __FILE__
...
llvm-svn: 38600
2006-07-01 22:46:53 +00:00
Chris Lattner
7d1b0062d2
Use a new helper to do this much more simply.
...
llvm-svn: 38598
2006-06-30 06:14:45 +00:00
Chris Lattner
c673f905d8
Implement the __TIME__ and __DATE__ builtin macros.
...
llvm-svn: 38597
2006-06-30 06:10:41 +00:00
Chris Lattner
098dfc5e7e
Expose a new form of the getToken method.
...
llvm-svn: 38595
2006-06-30 06:09:36 +00:00
Chris Lattner
4fb517bea8
Give tokens from the scratch buffer correct source locations.
...
llvm-svn: 38591
2006-06-29 06:34:53 +00:00
Chris Lattner
0b8cfc2e69
Implement the __LINE__ builtin macro.
...
llvm-svn: 38589
2006-06-28 06:49:17 +00:00
Chris Lattner
3690f1513a
Initial implementation of the ScratchBuffer class.
...
llvm-svn: 38588
2006-06-28 06:48:36 +00:00
Chris Lattner
677757a2c0
Remove dead variables.
...
Add initial support for builtin macros, including warning if they are defined or undefined.
Register __LINE__ as a builtin macro.
llvm-svn: 38586
2006-06-28 05:26:32 +00:00
Chris Lattner
78d6734b34
Remove dead variable.
...
llvm-svn: 38584
2006-06-28 05:02:28 +00:00
Chris Lattner
f373a4af56
Refactor HandleIdentifier to pull macro expansion into its own method.
...
llvm-svn: 38583
2006-06-26 06:16:29 +00:00
Chris Lattner
f4449e5da3
Allow expansion to single token identifiers if they are not macros
...
llvm-svn: 38581
2006-06-26 04:55:25 +00:00
Chris Lattner
67b07cb6fe
Implement Preprocessor/macro_expandloc.c by giving the optimized macro
...
expansion case a correct source location.
llvm-svn: 38580
2006-06-26 02:03:42 +00:00
Chris Lattner
236ed5200b
Add a note
...
llvm-svn: 38578
2006-06-26 01:36:29 +00:00
Chris Lattner
269c232e67
implement #pragma GCC dependency
...
llvm-svn: 38574
2006-06-25 06:23:00 +00:00
Chris Lattner
ba6df9122f
Fix Preprocessor/poison_expansion.c
...
llvm-svn: 38573
2006-06-25 05:41:00 +00:00
Chris Lattner
55a60954f9
Implement #pragma GCC system_header
...
llvm-svn: 38569
2006-06-25 04:20:34 +00:00
Chris Lattner
1786217e0b
Finish implementation of #pragma once. Implement #pragma GCC poison.
...
llvm-svn: 38568
2006-06-24 22:12:56 +00:00
Chris Lattner
d2b9b89b92
Remove some inadvertently commited stuff
...
llvm-svn: 38567
2006-06-24 21:33:04 +00:00
Chris Lattner
b876183219
implement the pragma handling infrastructure. The only pragma so far is
...
#pragma once, and it is not completely implemented.
llvm-svn: 38566
2006-06-24 21:31:03 +00:00
Chris Lattner
e60165fdb5
increase the performance of skipping (#if 0) by optimizing lookup of directive names.
...
llvm-svn: 38564
2006-06-22 06:36:29 +00:00
Chris Lattner
40931927af
Speed up directive matching by not using getSpelling(), and not copying std::strings
...
around.
llvm-svn: 38563
2006-06-22 06:14:04 +00:00
Chris Lattner
c899718274
Track which headers are system and non-C++-clean-system headers. Use this
...
information to print the 3/4 flags correctly on #line directives emitted
in -E mode.
llvm-svn: 38562
2006-06-22 05:52:16 +00:00
Chris Lattner
0c885f5581
Improve #line emission in -E mode to include file entry/exits. This is
...
still pretty hacky because it doesn't compute the 3/4 markers correctly.
llvm-svn: 38561
2006-06-21 06:50:18 +00:00
Chris Lattner
30709b038d
Implement a new type of FileID: FileIDInfo::MacroExpansion. For tokens that
...
came from a macro expansion, this allows us to keep track of both where the
character data came from and where the logical position of the token is (at
the expansion site). This implements Preprocessor/indent_macro.c, and
reduces the number of cpp iostream -E diffs vs GCC from 2589 to 2297.
llvm-svn: 38557
2006-06-21 03:01:55 +00:00
Chris Lattner
c5a00067ac
Simplify some code
...
llvm-svn: 38555
2006-06-18 16:41:01 +00:00