[PATCH] D99262: [analyzer] Fix dead store checker false positive
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 24 11:46:56 PDT 2021
steakhal added a comment.
I see your point.
Would it report this issue?
int test() {
struct Foo foo = {0, 0}; // I would expect a warning here, that 'foo' was initialized but never read.
(void)foo;
return 0;
}
Only nits besides this.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp:25
#include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
----------------
I don't see any new code that would depend on this header.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp:420-425
+ if (const auto *ILE =
+ dyn_cast<InitListExpr>(E->IgnoreParenCasts()))
+ if (llvm::all_of(ILE->inits(), [this](const Expr *Init) {
+ return Init->isEvaluatable(Ctx);
+ }))
+ return;
----------------
Eh, the indentation looks horrible.
It would be probably better to use braces here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99262/new/
https://reviews.llvm.org/D99262
More information about the cfe-commits
mailing list