
Summary: This change moves tests for checkers and infrastructure into separate directories, making it easier to find infrastructure tests. Tests for checkers are already easy to find because they are named after the checker. Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers. Now they are in a separate directory. Reviewers: jfb, jdoerfert, lebedev.ri Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68807 llvm-svn: 374540
26 lines
702 B
C++
26 lines
702 B
C++
// REQUIRES: static-analyzer
|
|
// RUN: clang-tidy -checks='-*,clang-analyzer-core.NullDereference' %s -- | FileCheck %s
|
|
|
|
struct NoReturnDtor {
|
|
~NoReturnDtor() __attribute__((noreturn));
|
|
};
|
|
|
|
extern bool check(const NoReturnDtor &);
|
|
|
|
// CHECK-NOT: warning
|
|
void testNullPointerDereferencePositive() {
|
|
int *value = 0;
|
|
// CHECK: [[@LINE+1]]:10: warning: Dereference of null pointer (loaded from variable 'value') [clang-analyzer-core.NullDereference]
|
|
*value = 1;
|
|
}
|
|
|
|
// CHECK-NOT: warning
|
|
void testNullPointerDereference() {
|
|
int *value = 0;
|
|
if (check(NoReturnDtor())) {
|
|
// This unreachable code causes a warning if analysis of temporary
|
|
// destructors is not enabled.
|
|
*value = 1;
|
|
}
|
|
}
|