This revision was automatically updated to reflect the committed changes.
Closed by commit rL291757: Avoid multiple -Wunreachable-code diagnostics that
are triggered by (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D28231?vs=83819&id=84094#toc
Repository:
rL LLVM
ahatanak accepted this revision.
ahatanak added a comment.
This revision is now accepted and ready to land.
Thanks, LGTM
Repository:
rL LLVM
https://reviews.llvm.org/D28231
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm
arphaman added inline comments.
Comment at: lib/Analysis/ReachableCode.cpp:229
+ if (SilenceableCondValNotSet && SilenceableCondVal->getBegin().isValid())
+*SilenceableCondVal = UO->getSourceRange();
+ return UO->getOpcode() == UO_LNot && IsSubExprConfigValue;
-
arphaman updated this revision to Diff 83819.
arphaman added a comment.
Fix more issues with FIXIT for unary operators.
Repository:
rL LLVM
https://reviews.llvm.org/D28231
Files:
lib/Analysis/ReachableCode.cpp
lib/Sema/AnalysisBasedWarnings.cpp
test/Sema/warn-unreachable.c
Index: test
ahatanak added inline comments.
Comment at: lib/Analysis/ReachableCode.cpp:229
+ if (SilenceableCondValNotSet && SilenceableCondVal->getBegin().isValid())
+*SilenceableCondVal = UO->getSourceRange();
+ return UO->getOpcode() == UO_LNot && IsSubExprConfigValue;
-
arphaman updated this revision to Diff 83032.
arphaman added a comment.
You're right, the fixit for `if (!s->p || 1)` is wrong, but that was another
existing bug. The updated patch fixes this issue.
Repository:
rL LLVM
https://reviews.llvm.org/D28231
Files:
lib/Analysis/ReachableCode.cpp
ahatanak added a comment.
If I change the condition to the following,
if (!s->p || 1)
clang suggests enclosing !s->p with a parenthesis, but the comment in
ReachableCode.cpp says the parenthesis should enclose the integer literal. It
seems like there is a contradiction here?
Repository:
arphaman created this revision.
arphaman added reviewers: rsmith, bruno, ahatanak.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.
This patch fixes an issue with -Wunreachable-code diagnostic that happens with
the following code sample:
struc