diff options
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 3 | ||||
-rw-r--r-- | test/Rewriter/rewrite-byref-vars.mm | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 68d9b27c40..df43da7eff 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -4085,8 +4085,7 @@ void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) { void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); //SourceLocation FunLocStart = MD->getLocStart(); - // FIXME: This hack works around a bug in Rewrite.InsertText(). - SourceLocation FunLocStart = MD->getLocStart().getFileLocWithOffset(-1); + SourceLocation FunLocStart = MD->getLocStart(); std::string FuncName = MD->getSelector().getAsString(); // Convert colons to underscores. std::string::size_type loc = 0; diff --git a/test/Rewriter/rewrite-byref-vars.mm b/test/Rewriter/rewrite-byref-vars.mm index 1489c59472..58b925a2b2 100644 --- a/test/Rewriter/rewrite-byref-vars.mm +++ b/test/Rewriter/rewrite-byref-vars.mm @@ -36,9 +36,19 @@ __declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter id list; } - (void) Meth; +// radar 7589385 use before definition +- (void) allObjects; @end @implementation I +// radar 7589385 use before definition +- (void) allObjects { + __attribute__((__blocks__(byref))) id *listp; + + ^(void) { + *listp++ = 0; + }; +} - (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; } @end |