Chris Lattner
60809f5aaf
record location info for const/volatile/restrict
...
llvm-svn: 39226
2006-11-28 05:18:46 +00:00
Chris Lattner
1b22eed03c
add loc info for the inline specifier, fix some fixme's by using it.
...
llvm-svn: 39225
2006-11-28 05:12:07 +00:00
Chris Lattner
4d8f873b5b
record accurate sourceloc info for storage class specs, so we can report
...
things like:
t.c:4:10: error: invalid storage class specifier in function declarator
int foo2(auto int Aaslfkasdflkj, register B);
^
instead of:
t.c:4:19: error: invalid storage class specifier in function declarator
int foo2(auto int Aaslfkasdflkj, register B);
^
llvm-svn: 39224
2006-11-28 05:05:08 +00:00
Chris Lattner
353f5740b1
Finish converting DeclSpec to use accessors.
...
llvm-svn: 39223
2006-11-28 04:50:12 +00:00
Chris Lattner
a925dc66e4
Convert more code to use DeclSpec accessors
...
llvm-svn: 39222
2006-11-28 04:33:46 +00:00
Chris Lattner
f055d43211
add accessors to DeclSpec, start moving clients over to use them.
...
llvm-svn: 39221
2006-11-28 04:28:12 +00:00
Chris Lattner
0d0111b8e4
Group declspec ivars together.
...
llvm-svn: 39220
2006-11-28 04:10:07 +00:00
Chris Lattner
43e956c3b7
verify C99 6.7.5.3p2
...
llvm-svn: 39219
2006-11-28 04:05: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
bb233fe3aa
add some comments.
...
llvm-svn: 39217
2006-11-21 23:13:27 +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
c5b966f893
check minutia of the standard.
...
llvm-svn: 39215
2006-11-21 17:31:32 +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
058b4b6b41
run .cpp files as tests
...
llvm-svn: 39213
2006-11-21 17:22:28 +00:00
Chris Lattner
d6775fa217
add note in the output
...
llvm-svn: 39212
2006-11-21 06:36:58 +00:00
Chris Lattner
00348acace
clear file info after processing one file, it shouldn't carry over to the
...
next.
llvm-svn: 39211
2006-11-21 06:34:57 +00:00
Chris Lattner
2ea9dd7fc0
ProcessInputFile no longer mutates LangInfo.
...
llvm-svn: 39210
2006-11-21 06:18:11 +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
96327eaa52
first step refactoring driver so that it can process multiple input files
...
at once.
llvm-svn: 39207
2006-11-21 05:52:55 +00:00
Chris Lattner
a92809b1ab
add an accessor
...
llvm-svn: 39206
2006-11-21 05:52:33 +00:00
Chris Lattner
87f267ef4e
eliminate global variables now that PPCallbacks can have state
...
llvm-svn: 39205
2006-11-21 05:02:33 +00:00
Chris Lattner
09d5804683
Make it easier to run tests from the top level with a helper target
...
llvm-svn: 39204
2006-11-21 05:01:56 +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
38495cb2e7
-fsyntax-only is synonym for -parse-ast for now.
...
llvm-svn: 39202
2006-11-21 04:07:21 +00:00
Chris Lattner
017865fb62
adjust test
...
llvm-svn: 39201
2006-11-21 04:06:06 +00:00
Chris Lattner
b0e7a06e53
Add some standard include paths for C++.
...
llvm-svn: 39200
2006-11-21 03:40:37 +00:00
Chris Lattner
d8702cd845
Implement a TODO: properly invoke actions for the * in things like:
...
where P is a pointer.
int A[*P];
llvm-svn: 39199
2006-11-21 03:12:15 +00:00
Chris Lattner
a966bf6ebf
fix a variable shadowing issue that caused us to misparse:
...
void B() {
memcpy (3, 2, 1);
}
where memcpy is undeclared.
llvm-svn: 39198
2006-11-21 01:40:01 +00:00
Chris Lattner
740b2f30c7
When a decl is popped from its current scope, link it to the decl chain for
...
the containing function. This avoids leaking decls.
llvm-svn: 39197
2006-11-21 01:32:20 +00:00
Chris Lattner
229ce60fc9
split the ParseFunctionDefinition action into two actions, one which is
...
called before and one which is called after function definition parsing.
llvm-svn: 39196
2006-11-21 01:21:07 +00:00
Chris Lattner
eda517e456
new testcase
...
llvm-svn: 39195
2006-11-20 07:03:41 +00:00
Chris Lattner
ac18be9ad2
Add support for C90 implicitly defined functions, e.g.:
...
int A() {
return X();
}
llvm-svn: 39194
2006-11-20 06:49:47 +00:00
Chris Lattner
5efbb33a6b
remember referenced decls in our AST's
...
llvm-svn: 39193
2006-11-20 05:01:40 +00:00
Chris Lattner
17ed487947
parse identifier expressions properly. This allows us diagnose this:
...
typedef int X;
int A() {
return X;
}
int B() {
return Y;
}
as:
/Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression
return X;
^
/Users/sabre/test.c:9:10: error: use of undeclared 'Y' value
return Y;
^
llvm-svn: 39192
2006-11-20 04:58:19 +00:00
Chris Lattner
0d8b1a1eff
remember and pretty-print cast types
...
llvm-svn: 39191
2006-11-20 04:34:45 +00:00
Chris Lattner
f0a40e7ef4
correctly handle stuff like:
...
typedef int G;
X = sizeof(const G);
X = sizeof(restrict G);
llvm-svn: 39190
2006-11-20 04:17:27 +00:00
Chris Lattner
d0342e5989
Create a new TypeNameType class, which represents typedefs as types. This
...
allows us to handle stuff like:
typedef int G;
..
X = sizeof(G);
llvm-svn: 39189
2006-11-20 04:02:15 +00:00
Chris Lattner
2ebe4bb64d
when a typedef name is parsed as part of declspecs, remember the decl for the
...
typedef.
llvm-svn: 39188
2006-11-20 01:29:42 +00:00
Chris Lattner
5ca17df626
decls should all have types
...
llvm-svn: 39187
2006-11-19 23:32:49 +00:00
Chris Lattner
591a675b1c
remove #include of clang/Parse/DeclSpec.h from clang/AST/Decl.h
...
llvm-svn: 39186
2006-11-19 23:16:18 +00:00
Chris Lattner
da8aa7b3a8
implement RTTI for Decl objects, eliminate some hokey virtual methods.
...
llvm-svn: 39185
2006-11-19 23:12:30 +00:00
Chris Lattner
200bdc3b90
add an action method for declspecs without declarators, like "struct foo;".
...
llvm-svn: 39184
2006-11-19 02:43:37 +00:00
Chris Lattner
94c22cd5b9
rename ParsedClassDeclaration -> ParsedObjcClassDeclaration.
...
llvm-svn: 39183
2006-11-19 02:35:21 +00:00
Chris Lattner
302b4be4c2
build TypedefDecl objects when parsing typedefs.
...
Add a parsing fastpath for when we see typedef at the top-level.
llvm-svn: 39182
2006-11-19 02:31:38 +00:00
Chris Lattner
33e8a55ed0
Parse and remember types enough that we can pretty print:
...
void foo(int X) {
X = __alignof(int);
X = sizeof(const int** restrict ** volatile*);
}
as:
x = __alignof(int)
x = sizeof(int const **restrict **volatile *)
llvm-svn: 39181
2006-11-19 01:48:02 +00:00
Chris Lattner
558cb292da
add an action for parsing type names.
...
llvm-svn: 39180
2006-11-19 01:31:06 +00:00
Chris Lattner
52f3dc1ee3
add a note
...
llvm-svn: 39179
2006-11-19 01:17:45 +00:00
Chris Lattner
9dfdb3c70d
rearrange the type printing code so that we can do the horrible C "inside out"
...
thing properly. This allows us to print types like:
int (*A)[restrict static 4][6];
properly, in addition to representing them properly. :)
llvm-svn: 39178
2006-11-13 07:38:09 +00:00
Chris Lattner
d235d162d0
change print methods to render into a string, which is more useful for diagnostics
...
and for handling precedence of types more accurately
llvm-svn: 39177
2006-11-13 06:22:30 +00:00