Steve Naroff
9992bbab14
Bug #:
...
Submitted by:
Reviewed by:
- ParseForStatement(): Put back a test/assignment. My removal of
ParseExprStmt() was a bit over zealous:-(thanks to Chris for pointing it out)
- Add assert to VisitDeclStmt().
- Removed an out-of-date FIXME
- Added some curlies for a couple multi-line calls to Diag().
llvm-svn: 39528
2007-05-30 16:27:15 +00:00
Steve Naroff
2a8ad18e71
Bug #:
...
Submitted by:
Reviewed by:
Implement some FIXME's that stand in the way of fully typechecking "for"
statements. This involved:
- Adding a DeclStmt AST node (with statement visitor). The DeclStmt
printer is preliminary.
- Added a ParseDeclStmt action, called from Parser::ParseForStatement()
and Parser::ParseStatementOrDeclaration(). DID NOT add to
Parser::ParseIdentifierStatement()...probably could have, however didn't
really understand the context of this rule (will speak with Chris).
- Removed ParseExprStmt (and it's clients)...it was vestigial.
llvm-svn: 39518
2007-05-29 22:59:26 +00:00
Chris Lattner
010015a11e
Add a note about an unimplemented gnu extension.
...
llvm-svn: 39511
2007-05-28 07:23:54 +00:00
Chris Lattner
eefa10e78a
implement full sema support for the GCC address-of-label extension.
...
llvm-svn: 39510
2007-05-28 06:56:27 +00:00
Chris Lattner
ac4471c963
Improve the parsers resilience to sematic errors. This allows us to turn:
...
void foo() {
if (0) break;
abc:
def:
hij:
break;
into:
void foo() {
if ((0)')
;
abc:
def:
hij:
;
instead of dropping the if and labels (due to break not being in a loop).
llvm-svn: 39508
2007-05-28 05:38:24 +00:00
Chris Lattner
0f203a7c1c
add action for null stmt, create ast node.
...
llvm-svn: 39506
2007-05-28 01:45:28 +00:00
Chris Lattner
49252eb303
Implement a FIXME: when a typedef is seen at statement scope, make sure to
...
actually add it into the declspec for the type being parsed. This allows us
to do correct semantic analysis on:
typedef int bar;
int foo() {
bar a;
return a;
}
This reduces # errors parsing carbon.h from 731 to 654.
llvm-svn: 39321
2007-01-27 19:04:39 +00:00
Chris Lattner
f297880ff9
Split code out of ParseCompoundStatement into ParseCompoundStatementBody.
...
This fixes a bug where a missing } could cause the scope stacks to get
unbalanced and will be used for function body parsing.
llvm-svn: 39249
2007-01-21 06:52:16 +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
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
eaafe122b6
move semantic analysis of break/continue out of the parser into the sema class.
...
llvm-svn: 39157
2006-11-10 05:17:58 +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
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
301cd76b8c
silence warning
...
llvm-svn: 39115
2006-11-04 20:32:01 +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
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
0ba3dc4ec3
Start removing LexerToken from the actions interface.
...
llvm-svn: 39043
2006-10-25 03:38:23 +00:00
Chris Lattner
64408c7107
Compoundstmts imply a scope, track it. This implements
...
test/Parser/CompoundStmtScope.c
llvm-svn: 39042
2006-10-25 03:15:33 +00:00
Chris Lattner
1f496804d5
silence a warning
...
llvm-svn: 39007
2006-10-18 04:02:28 +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
af63531ac3
Make ConsumeToken return the loc of the consumed token to simplify clients
...
llvm-svn: 38994
2006-10-16 06:06:51 +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
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
e550a4ea12
Build CastExpr AST nodes
...
llvm-svn: 38950
2006-08-24 06:37:51 +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
e37e2336b4
Parse attributes in all places allowed.
...
llvm-svn: 38925
2006-08-15 04:50:22 +00:00
Chris Lattner
3b4fdda3d8
Fix the last remaining FIXME's in the parser by asking the actions module
...
whether or not an identifier is a typedef name.
llvm-svn: 38915
2006-08-14 00:45:39 +00:00
Chris Lattner
476c3adb69
implement the GNU case-range extension. Add todo's for other missing gnu extensions.
...
llvm-svn: 38902
2006-08-13 22:09:58 +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
0c6c034c48
Two fixes:
...
1. Allow argument list of a call to be empty.
2. Handle expressions in a statement context that start with an identifier.
These are nasty to handle due to the 'label:' production which requires
having two tokens of look-ahead, or by having tricky code (which we
choose to do).
llvm-svn: 38887
2006-08-12 18:12:45 +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
89c50c65af
Return information about whether expression parsing was successful
...
llvm-svn: 38873
2006-08-11 06:41:18 +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
4564bc1123
Factor some code into the new Parser::MatchRHSPunctuation method.
...
llvm-svn: 38864
2006-08-10 23:14:52 +00:00
Chris Lattner
c2dd85ac9e
Implement most of unary-expression parsing.
...
llvm-svn: 38862
2006-08-10 22:57:16 +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
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
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
c951dae2a4
Parse if statements
...
llvm-svn: 38844
2006-08-10 04:23:57 +00:00