[PATCH] [analyzer][Review request] Improved checker naming in CFG dump.

Ted Kremenek kremenek at apple.com
Thu Feb 13 21:17:38 PST 2014



================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1741-1742
@@ -1740,3 +1740,4 @@
   if (!Errors.empty()) {
-    static SimpleProgramPointTag Tag("MallocChecker : DeadSymbolsLeak");
+    static SimpleProgramPointTag 
+           Tag(getCheckName().getName() + " : DeadSymbolsLeak");
     N = C.addTransition(C.getState(), C.getPredecessor(), &Tag);
----------------
This is a small improvement, but it is still boilerplate.  It also doesn't enforce regularity.  It would be great if I could write:

  SimpleProgramPointTag Tag(getCheckName(), "DeadSymbolsLeak")

and then just have the constructor do the string formation.  Going one step further, it would be great if I could just write:

  SimpleProgramPointTag Tag(this, "DeadSymbolsLeak")

since "getCheckName()" can easily be called.  That's much simpler and regular. You then don't have to expose string concatenation to the user, and it allows us to change the internal representation of SimpleProgramPointTag later if we should so choose.

================
Comment at: lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp:353
@@ -352,3 +352,3 @@
 
-  Out << Sep << NL << "ObjCSelfInitChecker:" << NL;
+  Out << Sep << NL << getCheckName().getName() << " :" << NL;
 
----------------
This is an aside, but it would be great if we could just write:

  Out << Sep << NL << getCheckName() << " :" << NL;

or better yet:

  Out << Sep << NL << *this << " :" << NL;

This can be done with more operator overloading.  Requiring that we need to do a chained method call for something so basic (that we may do regularly) seems suboptimal.  We've adopted such niceties for other machinery in Clang.


http://llvm-reviews.chandlerc.com/D2793



More information about the cfe-commits mailing list