diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-31 01:34:06 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-31 01:34:06 +0000 |
commit | a9151a5170e4fbd0b6df2cf99a42f1ef71635e4f (patch) | |
tree | b59bc0df0f5f196b845d315d0853d2bbb381cd07 /clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp | |
parent | 0dbe9b60152da6c6fb8b38db647aecbadcf59ac1 (diff) | |
download | bcm5719-llvm-a9151a5170e4fbd0b6df2cf99a42f1ef71635e4f.tar.gz bcm5719-llvm-a9151a5170e4fbd0b6df2cf99a42f1ef71635e4f.zip |
[arcmt] When fixing the "unassigned init call" ARC error, make sure
to do a nil check for the result of the call.
rdar://10950973
llvm-svn: 153793
Diffstat (limited to 'clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp')
-rw-r--r-- | clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp b/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp index e2aa6ff93cf..60ed32aef4c 100644 --- a/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp +++ b/clang/lib/ARCMigrate/TransUnusedInitDelegate.cpp @@ -54,7 +54,11 @@ public: Transaction Trans(Pass.TA); Pass.TA.clearDiagnostic(diag::err_arc_unused_init_message, ME->getExprLoc()); - Pass.TA.insert(ME->getExprLoc(), "self = "); + SourceRange ExprRange = ME->getSourceRange(); + Pass.TA.insert(ExprRange.getBegin(), "if (!(self = "); + std::string retStr = ")) return "; + retStr += getNilString(Pass.Ctx); + Pass.TA.insertAfterToken(ExprRange.getEnd(), retStr); } return true; } |