diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-05-14 20:29:16 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-05-14 20:29:16 +0000 |
commit | 098f0080da0497489dfb409337cb433723a610e8 (patch) | |
tree | 5624b0ce8559a26c3cc733c15da4665c6f63ff5f /clang/lib/Sema/SemaExpr.cpp | |
parent | 7129e63bcce96529291b3ffbe596f7f8588bdcc4 (diff) | |
download | bcm5719-llvm-098f0080da0497489dfb409337cb433723a610e8.tar.gz bcm5719-llvm-098f0080da0497489dfb409337cb433723a610e8.zip |
Remove the fixit for the diagnostics regarding capturing autoreleasing variables in a block
The fixit is actively harmful, as it encourages developers to ignore the
warning and to write unsafe code.
It is almost impossible to write safe code while capturing autoreleasing
variables in the block, as in order to check that the block is never
called in the autoreleasing pool the developer has to check the
transitive closure of all potential callers of the block.
Differential Revision: https://reviews.llvm.org/D46778
llvm-svn: 332288
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 8d0de0b66ce..aeedd6b1691 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -14579,30 +14579,6 @@ static bool captureInBlock(BlockScopeInfo *BSI, VarDecl *Var, if (BuildAndDiagnose) { SourceLocation VarLoc = Var->getLocation(); S.Diag(Loc, diag::warn_block_capture_autoreleasing); - { - auto AddAutoreleaseNote = - S.Diag(VarLoc, diag::note_declare_parameter_autoreleasing); - // Provide a fix-it for the '__autoreleasing' keyword at the - // appropriate location in the variable's type. - if (const auto *TSI = Var->getTypeSourceInfo()) { - PointerTypeLoc PTL = - TSI->getTypeLoc().getAsAdjusted<PointerTypeLoc>(); - if (PTL) { - SourceLocation Loc = PTL.getPointeeLoc().getEndLoc(); - Loc = Lexer::getLocForEndOfToken(Loc, 0, S.getSourceManager(), - S.getLangOpts()); - if (Loc.isValid()) { - StringRef CharAtLoc = Lexer::getSourceText( - CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(1)), - S.getSourceManager(), S.getLangOpts()); - AddAutoreleaseNote << FixItHint::CreateInsertion( - Loc, CharAtLoc.empty() || !isWhitespace(CharAtLoc[0]) - ? " __autoreleasing " - : " __autoreleasing"); - } - } - } - } S.Diag(VarLoc, diag::note_declare_parameter_strong); } } |