summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-cc
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/clang-cc')
-rw-r--r--clang/tools/clang-cc/RewriteBlocks.cpp5
-rw-r--r--clang/tools/clang-cc/RewriteObjC.cpp10
2 files changed, 9 insertions, 6 deletions
diff --git a/clang/tools/clang-cc/RewriteBlocks.cpp b/clang/tools/clang-cc/RewriteBlocks.cpp
index a9324e66669..f9ed0ecc095 100644
--- a/clang/tools/clang-cc/RewriteBlocks.cpp
+++ b/clang/tools/clang-cc/RewriteBlocks.cpp
@@ -1091,8 +1091,9 @@ void RewriteBlocks::HandleDeclInMainFile(Decl *D) {
// prototype. This enables us to rewrite function declarations and
// definitions using the same code.
RewriteFunctionProtoType(FD->getType(), FD);
-
- if (CompoundStmt *Body = FD->getBody(*Context)) {
+
+ // FIXME: Handle CXXTryStmt
+ if (CompoundStmt *Body = FD->getCompoundBody(*Context)) {
CurFunctionDef = FD;
FD->setBody(cast_or_null<CompoundStmt>(RewriteFunctionBody(Body)));
// This synthesizes and inserts the block "impl" struct, invoke function,
diff --git a/clang/tools/clang-cc/RewriteObjC.cpp b/clang/tools/clang-cc/RewriteObjC.cpp
index 5b8fd5268cd..95b50b832e4 100644
--- a/clang/tools/clang-cc/RewriteObjC.cpp
+++ b/clang/tools/clang-cc/RewriteObjC.cpp
@@ -980,8 +980,8 @@ void RewriteObjC::RewriteImplementationDecl(Decl *OID) {
ObjCMethodDecl *OMD = *I;
RewriteObjCMethodDecl(OMD, ResultStr);
SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getBody(*Context)->getLocStart();
-
+ SourceLocation LocEnd = OMD->getCompoundBody(*Context)->getLocStart();
+
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
ReplaceText(LocStart, endBuf-startBuf,
@@ -996,7 +996,7 @@ void RewriteObjC::RewriteImplementationDecl(Decl *OID) {
ObjCMethodDecl *OMD = *I;
RewriteObjCMethodDecl(OMD, ResultStr);
SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getBody(*Context)->getLocStart();
+ SourceLocation LocEnd = OMD->getCompoundBody(*Context)->getLocStart();
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
@@ -1426,6 +1426,7 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
buf += "}\n";
// Insert all these *after* the statement body.
+ // FIXME: If this should support Obj-C++, support CXXTryStmt
if (isa<CompoundStmt>(S->getBody())) {
SourceLocation endBodyLoc = OrigEnd.getFileLocWithOffset(1);
InsertText(endBodyLoc, buf.c_str(), buf.size());
@@ -4489,7 +4490,8 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
// definitions using the same code.
RewriteBlocksInFunctionProtoType(FD->getType(), FD);
- if (CompoundStmt *Body = FD->getBody(*Context)) {
+ // FIXME: If this should support Obj-C++, support CXXTryStmt
+ if (CompoundStmt *Body = FD->getCompoundBody(*Context)) {
CurFunctionDef = FD;
CollectPropertySetters(Body);
CurrentBody = Body;
OpenPOWER on IntegriCloud