diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-10-07 23:09:49 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-10-07 23:09:49 +0000 |
commit | 9bb286ff4327ae06363cdaa8e4b91240cff48300 (patch) | |
tree | 37ab5215f6d85c6ac60671de1e77262b348e80ef /clang/lib/Sema/SemaStmt.cpp | |
parent | 5ee6292e325b24ae0d83198626bf58416a2ef8e5 (diff) | |
download | bcm5719-llvm-9bb286ff4327ae06363cdaa8e4b91240cff48300.tar.gz bcm5719-llvm-9bb286ff4327ae06363cdaa8e4b91240cff48300.zip |
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*.
llvm-svn: 57275
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 68b36ba8184..f75758ebb0a 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/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 |