[PATCH] Extend the check to detect patterns like 'ptr.get() == nullptr'
Daniel Jasper
djasper at google.com
Tue Apr 8 01:49:49 PDT 2014
Two minor comments, otherwise looks good!
================
Comment at: clang-tidy/misc/RedundantSmartptrGet.cpp:81
@@ -56,2 +80,3 @@
bool allReturnTypesMatch(const MatchFinder::MatchResult &Result) {
+ if (Result.Nodes.getNodeAs<Decl>("duck_typing") == nullptr) return true;
// Verify that the types match.
----------------
Always add a line break after the "if (...)" in LLVM style.
================
Comment at: test/clang-tidy/check_clang_tidy_output.sh:11
@@ +10,3 @@
+$(dirname $0)/make_compile_commands_json.sh ${INPUT_FILE} ${TEMPORARY_DIR}
+clang-tidy --checks=${CHECK_TO_RUN} ${INPUT_FILE} -p ${TEMPORARY_DIR} |
+FileCheck ${INPUT_FILE}
----------------
Also set --disable_checks=''.
And same in the other wrapper script.
(I think we might also want to change how those flags behave, but until then, this is the right thing to do..)
================
Comment at: test/clang-tidy/check_clang_tidy_fix.sh:3
@@ +2,3 @@
+#
+# Run clang-tidy in fix mode and verify the result.
+
----------------
I think with this we can get rid of the unit tests entirely. (I will prepare a follow up patch).
Nice!
http://reviews.llvm.org/D3294
BRANCH
get_==
ARCANIST PROJECT
clang-tools-extra
More information about the cfe-commits
mailing list