improve DeclStmt to be able to store SourceRange info correctly.
Set the start of DeclStmt range. Right now the end is meaningless
though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48330 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 2fe54de..fc81781 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -339,7 +339,8 @@
virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
StmtTy **Elts, unsigned NumElts,
bool isStmtExpr);
- virtual StmtResult ActOnDeclStmt(DeclTy *Decl);
+ virtual StmtResult ActOnDeclStmt(DeclTy *Decl, SourceLocation StartLoc,
+ SourceLocation EndLoc);
virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
SourceLocation DotDotDotLoc, ExprTy *RHSVal,
SourceLocation ColonLoc, StmtTy *SubStmt);
diff --git a/Sema/SemaStmt.cpp b/Sema/SemaStmt.cpp
index fe62c8a..14b2fdf 100644
--- a/Sema/SemaStmt.cpp
+++ b/Sema/SemaStmt.cpp
@@ -33,13 +33,13 @@
return new NullStmt(SemiLoc);
}
-Sema::StmtResult Sema::ActOnDeclStmt(DeclTy *decl) {
- if (decl) {
- ScopedDecl *SD = dyn_cast<ScopedDecl>(static_cast<Decl *>(decl));
- assert(SD && "Sema::ActOnDeclStmt(): expected ScopedDecl");
- return new DeclStmt(SD);
- } else
- return true; // error
+Sema::StmtResult Sema::ActOnDeclStmt(DeclTy *decl, SourceLocation StartLoc,
+ SourceLocation EndLoc) {
+ if (decl == 0)
+ return true;
+
+ ScopedDecl *SD = cast<ScopedDecl>(static_cast<Decl *>(decl));
+ return new DeclStmt(SD, StartLoc, EndLoc);
}
Action::StmtResult