danielmarjamaki created this revision.
danielmarjamaki added subscribers: cfe-commits, NoQ, zaks.anna, a.sidorin,
xazax.hun.
danielmarjamaki set the repository for this revision to rL LLVM.
This patch fixes false positives for vardecls that are technically unreachable
but they are needed.
```
dcoughlin added a comment.
Sorry, missed this patch.
I think it would good to add a test to make sure we do warn when the var decl
has an initializer, since that will not be executed.
void varDecl(int X) {
switch (X) {
int A = 12; // We do want a warning here, since the variable wil
danielmarjamaki added a comment.
In https://reviews.llvm.org/D24905#557573, @dcoughlin wrote:
> Sorry, missed this patch.
>
> I think it would good to add a test to make sure we do warn when the var decl
> has an initializer, since that will not be executed.
>
> void varDecl(int X) {
> swi
danielmarjamaki updated this revision to Diff 72455.
danielmarjamaki added a comment.
Minor updates of testcase
Repository:
rL LLVM
https://reviews.llvm.org/D24905
Files:
lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
test/Analysis/unreachable-code-path.c
Index: test/Analysis/un
xazax.hun added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp:195
@@ +194,3 @@
+if (Optional S = I->getAs()) {
+ if (isa(S->getStmt()))
+return S->getStmt();
Maybe I would prefer something like !isa which is a
danielmarjamaki removed rL LLVM as the repository for this revision.
danielmarjamaki updated this revision to Diff 72775.
danielmarjamaki added a comment.
Use !isa. Suggestion by Gabor.
https://reviews.llvm.org/D24905
Files:
lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
test/Analys
danielmarjamaki marked an inline comment as done.
Comment at: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp:195
@@ +194,3 @@
+if (Optional S = I->getAs()) {
+ if (!isa(S->getStmt()))
+return S->getStmt();
yes I agree.
https://reviews.ll
danielmarjamaki marked an inline comment as done.
danielmarjamaki added a comment.
https://reviews.llvm.org/D24905
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.
LGTM!
https://reviews.llvm.org/D24905
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinf
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282574: [StaticAnalyzer] Fix false positives for vardecls
that are technically… (authored by danielmarjamaki).
Changed prior to commit:
https://reviews.llvm.org/D24905?vs=72775&id=72793#toc
Repository:
10 matches
Mail list logo