41 lines · cpp
1// This checks that there's no issue with the preprocessor handling user or built-in macro2// expansion during dependency scanning.3 4// RUN: rm -rf %t5// RUN: split-file %s %t6// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json7 8// RUN: clang-scan-deps -compilation-database %t/cdb.json | FileCheck %s9 10// CHECK: test.o:11// CHECK-NEXT: test.cpp12// CHECK-NEXT: header1.h13// CHECK-NEXT: header2.h14 15//--- cdb.json.template16[{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.cpp23#define FN_MACRO(x) 124#if FN_MACRO(a)25#include "header1.h"26#endif27 28#if __has_cpp_attribute(clang::fallthrough)29#include "header2.h"30#endif31 32//--- header1.h33#ifndef _HEADER1_H_34#define _HEADER1_H_35#endif36 37//--- header2.h38#ifndef _HEADER2_H_39#define _HEADER2_H_40#endif41