summaryrefslogtreecommitdiffstats
path: root/clang/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-09-13 21:41:19 +0000
committerSteve Naroff <snaroff@apple.com>2007-09-13 21:41:19 +0000
commit9def2b15c1193ee423ffe11125154bd86dd71a1d (patch)
tree8c006647b8f389d9246fccf212784c3cdc84268a /clang/Sema/SemaStmt.cpp
parent011f91b5b24cc27071877f3d75f961c187afc5d4 (diff)
downloadbcm5719-llvm-9def2b15c1193ee423ffe11125154bd86dd71a1d.tar.gz
bcm5719-llvm-9def2b15c1193ee423ffe11125154bd86dd71a1d.zip
Phase 2 of making the Decl class more lightweight...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl. Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later. llvm-svn: 41934
Diffstat (limited to 'clang/Sema/SemaStmt.cpp')
-rw-r--r--clang/Sema/SemaStmt.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index 9cca2c24f02..2e7e7539858 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -33,9 +33,11 @@ Sema::StmtResult Sema::ParseNullStmt(SourceLocation SemiLoc) {
}
Sema::StmtResult Sema::ParseDeclStmt(DeclTy *decl) {
- if (decl)
- return new DeclStmt(static_cast<Decl *>(decl));
- else
+ if (decl) {
+ ScopedDecl *SD = dyn_cast<ScopedDecl>(static_cast<Decl *>(decl));
+ assert(SD && "Sema::ParseDeclStmt(): expected ScopedDecl");
+ return new DeclStmt(SD);
+ } else
return true; // error
}
@@ -57,7 +59,7 @@ Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,
/*empty*/;
if (i != NumElts) {
- Decl *D = cast<DeclStmt>(Elts[i])->getDecl();
+ ScopedDecl *D = cast<DeclStmt>(Elts[i])->getDecl();
Diag(D->getLocation(), diag::ext_mixed_decls_code);
}
}
@@ -484,7 +486,8 @@ Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
if (BVD && !BVD->hasLocalStorage())
BVD = 0;
if (BVD == 0)
- Diag(D->getLocation(), diag::err_non_variable_decl_in_for);
+ Diag(dyn_cast<ScopedDecl>(D)->getLocation(),
+ diag::err_non_variable_decl_in_for);
// FIXME: mark decl erroneous!
}
}
OpenPOWER on IntegriCloud