aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-07 23:09:49 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-07 23:09:49 +0000
commit8ffb159441e923322bef6b5dee1aaf24c738d75e (patch)
tree7de360cf9761bbfea545f1ea1f469dc0a9ae7942 /lib/Sema/SemaStmt.cpp
parent2c3352b5d1f5f4546af2f3051a304d84d57c697e (diff)
Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ScopedDecl*.
This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 68b36ba818..f75758ebb0 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -42,7 +42,28 @@ Sema::StmtResult Sema::ActOnDeclStmt(DeclTy *decl, SourceLocation StartLoc,
return true;
ScopedDecl *SD = cast<ScopedDecl>(static_cast<Decl *>(decl));
- return new DeclStmt(SD, StartLoc, EndLoc);
+
+
+ // This is a temporary hack until we are always passing around
+ // DeclGroupRefs.
+ llvm::SmallVector<Decl*, 10> decls;
+ while (SD) {
+ ScopedDecl* d = SD;
+ SD = SD->getNextDeclarator();
+ d->setNextDeclarator(0);
+ decls.push_back(d);
+ }
+
+ assert (!decls.empty());
+
+ if (decls.size() == 1) {
+ DeclGroupOwningRef DG(*decls.begin());
+ return new DeclStmt(DG, StartLoc, EndLoc);
+ }
+ else {
+ DeclGroupOwningRef DG(DeclGroup::Create(Context, decls.size(), &decls[0]));
+ return new DeclStmt(DG, StartLoc, EndLoc);
+ }
}
Action::StmtResult