summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Decl.cpp4
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 9bc07d5ce3f..5786c562107 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -306,11 +306,11 @@ void FunctionDecl::Destroy(ASTContext& C) {
}
-Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
+CompoundStmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) {
if (FD->Body) {
Definition = FD;
- return FD->Body;
+ return cast<CompoundStmt>(FD->Body);
}
}
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7d3d1c68f2f..bedf05ed35e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2774,11 +2774,11 @@ Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtArg BodyArg) {
Decl *dcl = static_cast<Decl *>(D);
Stmt *Body = static_cast<Stmt*>(BodyArg.release());
if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(dcl)) {
- FD->setBody(Body);
+ FD->setBody(cast<CompoundStmt>(Body));
assert(FD == getCurFunctionDecl() && "Function parsing confused");
} else if (ObjCMethodDecl *MD = dyn_cast_or_null<ObjCMethodDecl>(dcl)) {
assert(MD == getCurMethodDecl() && "Method parsing confused");
- MD->setBody((Stmt*)Body);
+ MD->setBody(cast<CompoundStmt>(Body));
} else {
Body->Destroy(Context);
return 0;
OpenPOWER on IntegriCloud