[PATCH] [clang-tidy] Support for Static Analyzer plugins (clang part)

Alexander Kornienko alexfh at google.com
Thu May 7 06:25:33 PDT 2015


Replaced reviewers with the actual static analyzer code owners.

A few peanut gallery comments as well.


================
Comment at: include/clang/StaticAnalyzer/Core/CheckerRegistry.h:16
@@ -15,2 +15,3 @@
 #include <vector>
+#include <string>
 
----------------
nit: Place this before #include <vector> to maintain the correct order.

================
Comment at: include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h:30
@@ -28,2 +29,3 @@
 
+  std::vector<std::string> getCheckerList(ArrayRef<std::string> plugins);
 } // end ento namespace
----------------
s/plugins/Plugins/

================
Comment at: lib/StaticAnalyzer/Core/CheckerRegistry.cpp:155
@@ +154,3 @@
+std::vector<std::string> CheckerRegistry::getCheckerList() const {
+  std::vector<std::string> result;
+  std::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
----------------
s/result/Result/ to follow the LLVM naming convention.

================
Comment at: lib/StaticAnalyzer/Core/CheckerRegistry.cpp:156
@@ +155,3 @@
+  std::vector<std::string> result;
+  std::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
+
----------------
I'd rather sort `result` than the `Checkers` field. It's weird when a getter method modifies a class field (it's marked mutable for some reason, but I don't think it's good to abuse this).

================
Comment at: lib/StaticAnalyzer/Core/CheckerRegistry.cpp:158
@@ +157,3 @@
+
+  for (CheckerInfoList::const_iterator i = Checkers.begin(), e = Checkers.end();
+       i != e; ++i) {
----------------
Can you use a range-based for loop here?

================
Comment at: lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp:138
@@ +137,3 @@
+
+std::vector<std::string> ento::getCheckerList(ArrayRef<std::string> plugins){
+  return ClangCheckerRegistry(plugins).getCheckerList();
----------------
s/plugins/Plugins/

http://reviews.llvm.org/D9556

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list