aaron.ballman added inline comments.

================
Comment at: clang-tidy/utils/Matchers.h:16
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/CFG.h"
 
----------------
This will require linking in the clangAnalysis library as well; are we sure we 
want to take on this dependency here for all matchers?


================
Comment at: clang-tidy/utils/Matchers.h:58-60
+  // We get the first parent, making sure that we're not in a case statement
+  // not in a compound statement directly inside a switch, because this causes
+  // the buildCFG call to crash.
----------------
Why does it cause the crash? Should that crash not be fixed instead of applying 
this workaround?


================
Comment at: clang-tidy/utils/Matchers.h:70
+
+  // We build a Control Flow Graph (CFG) from the parent statement.
+  std::unique_ptr<CFG> StatementCFG =
----------------
No need for the parenthetical. It's generally understood what a CFG is, so you 
can just use the acronym.


================
Comment at: clang-tidy/utils/Matchers.h:74-75
+                  CFG::BuildOptions());
+
+  if (!StatementCFG) {
+    return false;
----------------
Elide braces (here and elsewhere).


================
Comment at: clang-tidy/utils/Matchers.h:81
+  // all the possible branches of the code and therefore cover all statements.
+  for (auto& Block : *StatementCFG) {
+    if (!Block) {
----------------
Formatting (here and elsewhere): you should run the patch through clang-format.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D42624



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

Reply via email to