diff options
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 23 |
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 |