if statements. This implements Sema/if-empty-body.c:f3, silencing
a bogus secondary warning. It also improve the location info for
the nullstmts created for recovery purposes.
llvm-svn: 43440
warn about the last stmt in a stmtexpr, f.e. there should be no warning for:
int maxval_stmt_expr(int x, int y) {
return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}
llvm-svn: 41655
hold declarations. Instead, introduce a new "DeclScope" scope type that
holds them explicitly. For now, all scopes have this bit, but in the
future we can use them to fix some issues Neil noticed.
llvm-svn: 41431
typedef float float4 __attribute__((vector_size (16)));
void addFloat4(float4 a, float4 b) {
float4 temp;
}
make sure to add 'temp' to the stmt tree as a declstmt.
llvm-svn: 39722
out of the llvm namespace. This makes the clang namespace be a sibling of
llvm instead of being a child.
The good thing about this is that it makes many things unambiguous. The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.
llvm-svn: 39659
after the expr along with the expr. If we don't do this, the semicolon
gets parsed as a nullstmt, which makes the generated AST very strange.
llvm-svn: 39600
Submitted by:
Reviewed by:
Implement support for GCC __attribute__.
- Implement "TODO" in Parser::ParseAttributes. Changed the return type from
void to Parser::DeclTy. Changed all call sites to accept the return value.
- Added Action::ParseAttribute and Sema::ParseAttribute to return an
appropriate AST node. Added new node AttributeDecl to Decl.h.
Still to do...hook up to the Decl...
llvm-svn: 39539
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
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
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
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