47 lines · c
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json4 5// RUN: clang-scan-deps -compilation-database %t/cdb.json | FileCheck %s6// CHECK: t.c7// CHECK: something.h8 9// RUN: sed -e "s|DIR|%/t|g" %t/cdb-error.json.template > %t/cdb-error.json10// RUN: not clang-scan-deps -compilation-database %t/cdb-error.json 2>&1 | FileCheck %s -check-prefix=ERROR11// ERROR: error: expected '>'12// ERROR: error: expected value in expression13 14//--- cdb.json.template15[16 {17 "directory": "DIR",18 "command": "clang -fsyntax-only DIR/t.c -I DIR",19 "file": "DIR/t.c"20 }21]22 23//--- cdb-error.json.template24[25 {26 "directory": "DIR",27 "command": "clang -fsyntax-only DIR/error.c",28 "file": "DIR/error.c"29 }30]31 32//--- t.c33 34#define something35 36// Make sure the include is lexed as a literal, ignoring the macro.37#if __has_include(<something/something.h>)38#include <something/something.h>39#endif40 41//--- something/something.h42 43//--- error.c44#if __has_include(<something/something.h)45#define MAC46#endif47