Chris Lattner
36982e4367
Add support for inserting up to 10 strings in a diagnostic, with %0, %1, %2,
...
etc.
llvm-svn: 39447
2007-05-16 17:49:37 +00:00
Chris Lattner
c24278d9a0
Do not invoke objc parser actions when a top level +/- is seen, unless objc
...
is enabled.
llvm-svn: 39430
2007-05-02 23:45:06 +00:00
Chris Lattner
83b94e0967
Generalize the skipping logic to allow skipping until any one of a set of
...
tokens is found.
llvm-svn: 39419
2007-04-27 19:12:15 +00:00
Chris Lattner
7f58c3dfe4
Do not use ParseCompoundStatement to parse the body of a function. This causes
...
an extra scope stack to be pushed between the function body and arguments, which
causes the parser to incorrectly accept stuff like 'int foo(int A) { int A; }',
which is test/Parser/argument_redef.c.
llvm-svn: 39252
2007-01-21 06:56:16 +00:00
Chris Lattner
29375654b6
Add support for parsing and pretty printing const_cast, dynamic_cast,
...
reinterpret_cast, and static_cast. Patch by Bill!
llvm-svn: 39247
2006-12-04 18:06:35 +00:00
Chris Lattner
2114d5e948
add some comments
...
llvm-svn: 39242
2006-12-04 07:40:24 +00:00
Chris Lattner
5c5fbccc96
Scrutinize K&R parameter declarations. This implements C99 6.9.1p6, correctly
...
diagnosing malformed K&R function definitions.
llvm-svn: 39241
2006-12-03 08:41:30 +00:00
Chris Lattner
cbc426d4f7
Next step of retaining information about function prototypes: actually retain
...
the info. Also, call Actions.ParseParamDeclaratorType instead of
Actions.ParseDeclarator for parameter type lists: we don't want declaration
objects created when parsing a function declarator, we just want type info.
llvm-svn: 39230
2006-12-02 06:43:02 +00:00
Chris Lattner
edc9e39d88
First step towards accurately retaining information about function
...
parameters: build an array of ParamInfo structures and pass it to the
declarator for safe keeping (it owns the list).
Next step: actually populate the arg array with useful stuff.
llvm-svn: 39229
2006-12-02 06:21:46 +00:00
Chris Lattner
b20e89449f
capture sourcelocation info for type specifiers. This improves diagnostics
...
for things like 'short _Complex'.
llvm-svn: 39227
2006-11-28 05:30:29 +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
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
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
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
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
288e86ff15
Rename SemaDeclSpec.{h|cpp} back to DeclSpec.{h|cpp} now that the distinction
...
between sema and parse is clear.
llvm-svn: 39167
2006-11-11 23:03:42 +00:00
Chris Lattner
bd638926e2
remove diag helper that implicitly reports the diagnostic at the current
...
token: it is better for the code to be explicit.
llvm-svn: 39158
2006-11-10 05:19:25 +00:00
Chris Lattner
697e5d692b
Change courses on how we do semantic analysis. Semantic analysis
...
fundamentally requires having an AST around, so move all sema to the
AST library. This is the first step, later steps will be needed to
clean up libast.
llvm-svn: 39150
2006-11-09 06:32:27 +00:00
Chris Lattner
289ab7bb1d
rename SemaDecl.cpp/h to SemaDeclSpec.cpp/h
...
llvm-svn: 39149
2006-11-08 06:54:53 +00:00
Chris Lattner
b26b665742
rename these methods so that they read correctly.
...
llvm-svn: 39148
2006-11-08 06:10:32 +00:00
Chris Lattner
b6a0e1781f
implement trivial scope caching. This reduces malloc traffic in the common
...
case, speeding up parsing of this contrived example:
#define A {{}}
#define B A A A A A A A A A A
#define C B B B B B B B B B B
#define D C C C C C C C C C C
#define E D D D D D D D D D D
#define F E E E E E E E E E E
#define G F F F F F F F F F F
#define H G G G G G G G G G G
void foo() {
H
}
from 7.478s to 4.321s. GCC requires 8.2s.
llvm-svn: 39138
2006-11-06 00:22:42 +00:00
Chris Lattner
33ad2cacc9
Make Scope keep track of the kind of scope it is. Properly scope loop and
...
switch statements. Make break/continue check that they are inside of an
appropriate control-flow construct. This implements Parser/bad-control.c.
llvm-svn: 39136
2006-11-05 23:47:55 +00:00
Chris Lattner
0663d2afd9
start factoring actions into two flavors: minimal and semantic actions.
...
llvm-svn: 39133
2006-11-05 18:39:59 +00:00
Chris Lattner
7ad0fbe1f2
rename a bunch of files for better consistency
...
llvm-svn: 39126
2006-11-05 07:46:30 +00:00
Chris Lattner
7014fb8f07
need to add scope for arguments, but now is not the right time.
...
llvm-svn: 39125
2006-11-05 07:36:23 +00:00
Chris Lattner
da59c2f161
Move objc productions to their own .cpp file.
...
llvm-svn: 39124
2006-11-05 02:08:13 +00:00
Chris Lattner
40f16b5d26
improve objc comments
...
llvm-svn: 39123
2006-11-05 02:05:37 +00:00
Chris Lattner
71e23ce2e1
Add AST node, AST building, actions, and printing for 'for' stmts.
...
llvm-svn: 39113
2006-11-04 20:18:38 +00:00
Chris Lattner
70058dda70
Emit:
...
test.m:2:14: error: expected ';' after @class
@ class foo int x;
^
instead of silently accepting the malformed input.
llvm-svn: 39100
2006-11-03 07:32:21 +00:00
Chris Lattner
aacc5af2c0
Fix case stmts to not fall through, rename methods, assert on unimplemented
...
pieces, emit a diagnostic like this:
test.m:4:1: error: unexpected '@' in program
@ foo;
^
llvm-svn: 39099
2006-11-03 07:21:07 +00:00
Steve Naroff
b419d3a80e
- Added basic structure for parsing top level Objective-C forms.
...
- Extended the typedef mechanism for classes, improved performance of the common case.
- Implemented @class in the parser.
llvm-svn: 39074
2006-10-27 23:18:49 +00:00
Chris Lattner
04132371bb
Make ConsumeFoo methods return the location of the consumed token.
...
llvm-svn: 38995
2006-10-16 06:12:55 +00:00
Chris Lattner
30f910e88e
implement action callbacks for almost all the stmts.
...
llvm-svn: 38993
2006-10-16 05:52:41 +00:00
Chris Lattner
2dacc3ff2e
Changes through out the parser and actions/ast interface to return top-level
...
declarations through the asm streamer. For a testcase like:
int G;
int H, I, *J;
int func() {}
'clang -parse-print-ast' prints:
Read top-level decl: G
Read top-level decl: H
Read top-level decl: I
Read top-level decl: J
Read top-level decl: func
llvm-svn: 38992
2006-10-16 00:33:54 +00:00
Chris Lattner
a11999d83a
start creating proper ast nodes for variables and functions
...
llvm-svn: 38991
2006-10-15 22:34:45 +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
38ba3363ef
Hook up more of the ASTStreamer
...
llvm-svn: 38936
2006-08-17 07:04:37 +00:00
Chris Lattner
0116c478e6
Implement asm statement parsing.
...
llvm-svn: 38929
2006-08-15 06:03:28 +00:00
Chris Lattner
04f8019616
Make MatchRHSPunctuation smarter, allowing its clients to be simpler.
...
llvm-svn: 38926
2006-08-15 04:55:54 +00:00
Chris Lattner
15a00da679
Allow ExpectAndConsume to be used with any token.
...
llvm-svn: 38923
2006-08-15 04:10:31 +00:00
Chris Lattner
6d7e634399
Parse asm specifiers on init declarators. Add __builtin_va_list to the
...
symbol table at startup time.
llvm-svn: 38922
2006-08-15 03:41:14 +00:00
Chris Lattner
685ed1e9ee
Rename Parse/ParserActions.h -> Parse/Action.h
...
llvm-svn: 38913
2006-08-14 00:22:04 +00:00
Chris Lattner
e4e38595b0
Add methods for scope manipulation.
...
llvm-svn: 38909
2006-08-14 00:15:05 +00:00
Chris Lattner
8693a519d4
Implement initializer parsering.
...
llvm-svn: 38900
2006-08-13 21:54:02 +00:00
Chris Lattner
0e89462b08
Parse things like 'struct X;'
...
llvm-svn: 38898
2006-08-13 19:58:17 +00:00
Chris Lattner
dbb2a46915
Add a new ExpectAndConsume method to make parsing easier, and add a new
...
ConsumeAnyToken method.
llvm-svn: 38894
2006-08-12 19:26:13 +00:00
Chris Lattner
6259172911
Implement parsing of array declarators like:
...
int Array[*(int*)P+A];
llvm-svn: 38890
2006-08-12 18:40:58 +00:00
Chris Lattner
5bd57e0c73
Significant improvements to error recovery
...
llvm-svn: 38872
2006-08-11 06:40:25 +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
eb8a28f7b7
Rename some files
...
llvm-svn: 38855
2006-08-10 18:43:39 +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
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
bf320c84a5
better comments, infrastructure for parsing function bodies.
...
llvm-svn: 38839
2006-08-07 05:05:30 +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
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
971c6b681a
Add scaffolding for scopes.
...
llvm-svn: 38821
2006-08-05 22:46:42 +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
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