1 // This checks that there's no issue with the preprocessor handling user or built-in macro 2 // expansion during dependency scanning. 3 4 // RUN: rm -rf %t 5 // RUN: split-file %s %t 6 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json 7 8 // RUN: clang-scan-deps -compilation-database %t/cdb.json | FileCheck %s 9 10 // CHECK: test.o: 11 // CHECK-NEXT: test.cpp 12 // CHECK-NEXT: header1.h 13 // CHECK-NEXT: header2.h 14 15 //--- cdb.json.template 16 [{ 17 "directory" : "DIR", 18 "command" : "clang -target x86_64-apple-macosx10.7 -c DIR/test.cpp -o DIR/test.o", 19 "file" : "DIR/test.o" 20 }] 21 22 //--- test.cpp 23 #define FN_MACRO(x) 1 24 #if FN_MACRO(a) 25 #include "header1.h" 26 #endif 27 28 #if __has_cpp_attribute(clang::fallthrough) 29 #include "header2.h" 30 #endif 31 32 //--- header1.h 33 #ifndef _HEADER1_H_ 34 #define _HEADER1_H_ 35 #endif 36 37 //--- header2.h 38 #ifndef _HEADER2_H_ 39 #define _HEADER2_H_ 40 #endif 41