NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

I have no objections. George, this was your idea, does it look good to you?



================
Comment at: 
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp:577-578
+
+    if (FirstAccess->getBeginLoc() < FirstGuard->getBeginLoc())
+      return true;
+  }
----------------
That's quite unreliable, but in a good way. Like, in `if (x) foo(); else 
bar();`, in terms of source locations `bar()` goes after `foo()`, but in 
practice `bar()` never gets called after `foo()` (unless the whole thing is 
also in a loop). But when we're trying to heuristically suppress the specific 
false positive pattern in which statements definitely go in that order, it's 
not the end of the world when the heuristic suppresses a few other patterns.

So i think it's worth pointing out to the reader that this approach is a bit 
wonky, but not necessarily worth improving upon. That said, it should be 
possible to do this sort of stuff with a CFG-based analysis, probably even with 
one of the existing analyses in `lib/Analysis`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51866/new/

https://reviews.llvm.org/D51866



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

Reply via email to