Implement function-try-blocks. However, there's a very subtle bug that I can't track down.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70155 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 1dd7829..aa0fc70 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -321,22 +321,22 @@
}
-CompoundStmt *FunctionDecl::getBody(ASTContext &Context,
- const FunctionDecl *&Definition) const {
+Stmt *FunctionDecl::getBody(ASTContext &Context,
+ const FunctionDecl *&Definition) const {
for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) {
if (FD->Body) {
Definition = FD;
- return cast<CompoundStmt>(FD->Body.get(Context.getExternalSource()));
+ return FD->Body.get(Context.getExternalSource());
}
}
return 0;
}
-CompoundStmt *FunctionDecl::getBodyIfAvailable() const {
+Stmt *FunctionDecl::getBodyIfAvailable() const {
for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) {
if (FD->Body && !FD->Body.isOffset()) {
- return cast<CompoundStmt>(FD->Body.get(0));
+ return FD->Body.get(0);
}
}