aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorFred Tingaud <frederic.tingaud@sonarsource.com>2022-08-23 18:33:26 +0200
committerBalazs Benics <benicsbalazs@gmail.com>2022-08-23 18:33:26 +0200
commit16cb3be62600621361644ebd15d071c711d6aa86 (patch)
tree8a208ccbcd2595fd1fad8c787e95202d47c9d246 /clang/lib/Frontend/CompilerInvocation.cpp
parent552b59b9e69fe1cb2b1ee0cb49cf8376a3dc0869 (diff)
downloadllvm-16cb3be62600621361644ebd15d071c711d6aa86.zip
llvm-16cb3be62600621361644ebd15d071c711d6aa86.tar.gz
llvm-16cb3be62600621361644ebd15d071c711d6aa86.tar.bz2
[analyzer] Deadstore static analysis: Fix false positive on C++17 assignments
Dead store detection automatically checks that an expression is a CXXConstructor and skips it because of potential side effects. In C++17, with guaranteed copy elision, this check can fail because we actually receive the implicit cast of a CXXConstructor. Most checks in the dead store analysis were already stripping all casts and parenthesis and those that weren't were either forgotten (like the constructor) or would not suffer from it, so this patch proposes to factorize the stripping. It has an impact on where the dead store warning is reported in the case of an explicit cast, from auto a = static_cast<B>(A()); ^~~~~~~~~~~~~~~~~~~ to auto a = static_cast<B>(A()); ^~~ which we think is an improvement. Patch By: frederic-tingaud-sonarsource Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D126534
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions