[PATCH] Initial clang-tidy architecture

Sean Silva silvas at purdue.edu
Wed May 29 11:33:51 PDT 2013


  Does it make sense to have all the "tidy checks" be named after the coding style they originate from? I imagine that many will be shared. E.g., instead of `google-explicit-constructor`, it seems like just calling it `explicit-constructor` would be better, since this seems like a fairly general check that a lot of people would want. Then each "coding standard" would mostly just be a set of checks, similar to how clang-format styles are just a group of style settings.

  Some settings are truly project specific, like LLVM's include order (which depends on LLVM's directory layout). For those, I think it makes sense to have them prefixed with the project/coding standard name.


================
Comment at: clang-tidy/llvm/LLVMModule.cpp:88
@@ +87,3 @@
+    StringRef SourceFile = Sources.getFilename(HashLoc);
+    if (!SourceFile.endswith(".cc"))
+      return;
----------------
Shouldn't this be checking LangOptions instead of the extension? e.g. this wouldn't work for LLVM's `.cpp` naming.

================
Comment at: test/clang-tidy/select-checks.cpp:2
@@ +1,3 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-tidy %t.cpp -fix -checks=llvm.* --
+// RUN: FileCheck -input-file=%t.cpp %s
----------------
Why is this `llvm.` when the check names are `llvm-`? Seems confusing.


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



More information about the cfe-commits mailing list