aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-21 18:56:50 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-21 18:56:50 +0000
commita6e5a6e60ba744463819c1ee2595539c6055382b (patch)
tree5e10214a339044dda6c9b1de7c8d81fe074aa8d5 /lib
parent377da4c6b78c0130fb6141313636c8fda7b60b72 (diff)
Modern objc translator: Fixes a crash in rewriter when rewriting the API
for structure valued method messaging. // rdar://12142241 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Rewrite/RewriteModernObjC.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index dcd003f501..9c98a7ff2b 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -3140,7 +3140,14 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla
str += "\t"; str += returnType.getAsString(Context->getPrintingPolicy());
str += " s;\n";
str += "};\n\n";
- SourceLocation FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef);
+ SourceLocation FunLocStart;
+ if (CurFunctionDef)
+ FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef);
+ else {
+ assert(CurMethodDef && "SynthMsgSendStretCallExpr - CurMethodDef is null");
+ FunLocStart = CurMethodDef->getLocStart();
+ }
+
InsertText(FunLocStart, str);
++stretCount;