[PATCH] Extend the check to detect patterns like 'ptr.get() == nullptr'

Alexander Kornienko alexfh at google.com
Tue Apr 8 07:20:28 PDT 2014


  Thanks! Another couple of comments, though.


================
Comment at: test/clang-tidy/check_clang_tidy_output.sh:8
@@ +7,3 @@
+
+clang-tidy --checks=${CHECK_TO_RUN} --disable-checks="" ${INPUT_FILE} \
+  -- --std=c++11 | FileCheck ${INPUT_FILE}
----------------
nit: I'd format this still a bit differently (where's my sh-format? ;), four spaces on the continuation line, and each pipe component from a new line with 2 spaces indentation:

  clang-tidy --checks=${CHECK_TO_RUN} --disable-checks="" ${INPUT_FILE} \
      -- --std=c++11 \
    | FileCheck ${INPUT_FILE}

================
Comment at: test/clang-tidy/check_clang_tidy_fix.sh:9
@@ +8,3 @@
+
+grep -v CHECK ${INPUT_FILE} > ${TEMPORARY_FILE} \
+  && clang-tidy ${TEMPORARY_FILE} -fix --checks=${CHECK_TO_RUN} \
----------------
I'd leave the grep as it was in the test, so that it filters out RUN: lines as well, and it only filters out comments:

  grep -Ev "// *[A-Z-]+:" ...

We'll have some checks for comments, so filtering out special comments can be important there.


http://reviews.llvm.org/D3294

BRANCH
  get_==

ARCANIST PROJECT
  clang-tools-extra






More information about the cfe-commits mailing list