[PATCH] D31982: [analyzer] Improve suppression for inlined defensive checks when operator& is involved.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 13 03:14:55 PDT 2017


xazax.hun added inline comments.


================
Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:975
+      if (Op->getOpcode() == UO_AddrOf)
+        if (Op->getSubExpr()->isLValue()) {
+          Ex = Op->getSubExpr()->IgnoreParenCasts();
----------------
Maybe you could move this condition one level up with &&?


================
Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:977
+          Ex = Op->getSubExpr()->IgnoreParenCasts();
+          while (true) {
+            if (const auto *ME = dyn_cast<MemberExpr>(Ex)) {
----------------
Can't you writhe this like:

```
while (const auto *ME = dyn_cast<MemberExpr>(Ex)) {
              Ex = ME->getBase()->IgnoreParenCasts();
      }
```

?




https://reviews.llvm.org/D31982





More information about the cfe-commits mailing list