[PATCH] D25475: [analyzer] Add a new SVal to support pointer-to-member operations.

Devin Coughlin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 14:42:47 PST 2016


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

Looks good to me, other than some super tiny nits! Thanks for iterating on this -- it is awesome that the analyzer will be able to model this now!!



================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:463
 
+class PointerToMember : public NonLoc {
+  friend class ento::SValBuilder;
----------------
I think this deserves a comment about why it is a NonLoc and why it needs to keep the PointerToMemberData with the list of CXXBaseSpecifiers.


================
Comment at: lib/StaticAnalyzer/Core/ExprEngineC.cpp:269
+    StmtNodeBuilder &Bldr, ExplodedNode* Pred) {
+  // Recover some path-sensitivty by conjuring a new value.
+  QualType resultType = CastE->getType();
----------------
While we're here we might as well correct the misspelling --> "path sensitivity".


================
Comment at: test/Analysis/pointer-to-member.cpp:74
 
-  // FIXME: Should emit a null dereference.
-  return obj.*member; // no-warning
+  return obj.*member; // expected-warning{{}}
+}
----------------
Can you include the warning text in the expected-warning directive? This will ensure we keep emitting the correct warning in the future.


https://reviews.llvm.org/D25475





More information about the cfe-commits mailing list