[PATCH] Add a clang-tidy flag to support temporary destructor-aware analysis (workaround for bug 15599).
Alexander Kornienko
alexfh at google.com
Wed Apr 30 04:41:52 PDT 2014
Looks good modulo comments. Thanks for working on this!
================
Comment at: clang-tidy/ClangTidy.h:116
@@ -114,2 +115,3 @@
std::unique_ptr<ClangTidyCheckFactories> CheckFactories;
+ const ClangTidyOptions &Options;
};
----------------
I'd not make any assumptions about the life-time of Options. Please just copy it here, not store a reference.
================
Comment at: test/clang-tidy/temporaries.cpp:1
@@ +1,2 @@
+// RUN: clang-tidy -checks=clang-analyzer-core.NullDereference -analyze-temporary-dtors %s -- > %t.log
+// FileCheck complains if the input file is empty, so add a dummy line.
----------------
Add -disable-checks='', so that we don't rely on its default value.
================
Comment at: test/clang-tidy/temporaries.cpp:2
@@ +1,3 @@
+// RUN: clang-tidy -checks=clang-analyzer-core.NullDereference -analyze-temporary-dtors %s -- > %t.log
+// FileCheck complains if the input file is empty, so add a dummy line.
+// RUN: echo foo >> %t.log
----------------
Could you instead add test code which actually generates a core.NullDereference warning, so that we can be sure it's not just completely disabled.
// CHECK-NOT: warning
void testNullPointerDereferencePositive() {
int *value = 0;
// CHECK: :[[@LINE+1]]:3: warning: .....
*value = 1;
}
// CHECK-NOT: warning
<the rest of your test case>
http://reviews.llvm.org/D3556
More information about the cfe-commits
mailing list