[PATCH] D40671: [clang-tidy] Support specific checks for NOLINT directive

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 02:45:39 PST 2017


alexfh added inline comments.


================
Comment at: clang-tidy/ClangTidyDiagnosticConsumer.cpp:294
 
-static bool LineIsMarkedWithNOLINT(SourceManager &SM, SourceLocation Loc) {
+static bool IsNOLINTFound(StringRef NolintMacro, StringRef Line,
+                          unsigned DiagID, const ClangTidyContext &Context) {
----------------
"NOLINT" is not a "macro". Maybe `NolintDirective`, `NolintSpelling`, `NolintWord` or something like this?


================
Comment at: clang-tidy/ClangTidyDiagnosticConsumer.cpp:297
+  const size_t NolintIndex = Line.find(NolintMacro);
+  if (NolintIndex != StringRef::npos) {
+    size_t BracketIndex = NolintIndex + NolintMacro.size();
----------------
Please use early returns instead of nested `if`s. http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code


https://reviews.llvm.org/D40671





More information about the cfe-commits mailing list