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;
----------------
Thanks, that fixed the incorrect fixit. The patch looks good to me, but there 
are still cases in which the suggestions clang makes are not accurate. Perhaps 
you can leave a FIXME somewhere so that we don't forget to fix it later?

For example, if we change the condition in the test case to this,

```
if (!(s->p && 0))
```

, clang suggests enclosing the entire expression with a parenthesis (caret 
points to "!"), but the warning will not go away unless the parenthesis is 
around "0".

The second example is in function unaryOpFixit in warn-unreachable.c. clang 
suggests enclosing "-1" with a parenthesis, but it still warns after putting 
the parenthesis around "-1" or "1".


Repository:
  rL LLVM

https://reviews.llvm.org/D28231



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to