API fix: All "bodies" for functions, Objective-C methods, blocks, are assumed to
be CompoundStmts. I think this is a valid assumption, and felt that the API
should reflect it. Others please validate this assumption to make sure I didn't
break anything.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66814 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 9bc07d5..5786c56 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -306,11 +306,11 @@
}
-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);
}
}