1 // RUN: mkdir -p %T/compilation-database-test/include 2 // RUN: mkdir -p %T/compilation-database-test/a 3 // RUN: mkdir -p %T/compilation-database-test/b 4 // RUN: echo 'int *AA = 0;' > %T/compilation-database-test/a/a.cpp 5 // RUN: echo 'int *AB = 0;' > %T/compilation-database-test/a/b.cpp 6 // RUN: echo 'int *BB = 0;' > %T/compilation-database-test/b/b.cpp 7 // RUN: echo 'int *BC = 0;' > %T/compilation-database-test/b/c.cpp 8 // RUN: echo 'int *HP = 0;' > %T/compilation-database-test/include/header.h 9 // RUN: echo '#include "header.h"' > %T/compilation-database-test/b/d.cpp 10 // RUN: sed 's|test_dir|%/T/compilation-database-test|g' %S/Inputs/compilation-database/template.json > %T/compile_commands.json 11 12 // Regression test: shouldn't crash. 13 // RUN: not clang-tidy --checks=-*,modernize-use-nullptr -p %T %T/compilation-database-test/b/not-exist -header-filter=.* 2>&1 | FileCheck %s -check-prefix=CHECK-NOT-EXIST 14 // CHECK-NOT-EXIST: Error while processing {{.*[/\\]}}not-exist. 15 // CHECK-NOT-EXIST: unable to handle compilation 16 // CHECK-NOT-EXIST: Found compiler error 17 18 // RUN: clang-tidy --checks=-*,modernize-use-nullptr -p %T %T/compilation-database-test/a/a.cpp %T/compilation-database-test/a/b.cpp %T/compilation-database-test/b/b.cpp %T/compilation-database-test/b/c.cpp %T/compilation-database-test/b/d.cpp -header-filter=.* -fix 19 // RUN: FileCheck -input-file=%T/compilation-database-test/a/a.cpp %s -check-prefix=CHECK-FIX1 20 // RUN: FileCheck -input-file=%T/compilation-database-test/a/b.cpp %s -check-prefix=CHECK-FIX2 21 // RUN: FileCheck -input-file=%T/compilation-database-test/b/b.cpp %s -check-prefix=CHECK-FIX3 22 // RUN: FileCheck -input-file=%T/compilation-database-test/b/c.cpp %s -check-prefix=CHECK-FIX4 23 // RUN: FileCheck -input-file=%T/compilation-database-test/include/header.h %s -check-prefix=CHECK-FIX5 24 25 // CHECK-FIX1: int *AA = nullptr; 26 // CHECK-FIX2: int *AB = nullptr; 27 // CHECK-FIX3: int *BB = nullptr; 28 // CHECK-FIX4: int *BC = nullptr; 29 // CHECK-FIX5: int *HP = nullptr; 30