| 1 |
// RUN: mkdir -p %t.workdir && cd %t.workdir |
| 2 |
// RUN: %clang -no-canonical-prefixes -fintegrated-as -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 2>&1 | FileCheck %s |
| 3 |
// RUN: not %clang -no-canonical-prefixes -c -x c %s -MJ %s/non-existant 2>&1 | FileCheck --check-prefix=ERROR %s |
| 4 |
// RUN: %clang -fsyntax-only %s -MJ - 2>&1 | FileCheck %s -check-prefix=SYNTAX_ONLY |
| 5 |
|
| 6 |
// CHECK: { "directory": "{{[^"]*}}workdir", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "-o", "compilation_database.o", "-no-canonical-prefixes", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, |
| 7 |
// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "-o", "compilation_database.o", "-no-canonical-prefixes", "-fintegrated-as", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]}, |
| 8 |
// ERROR: error: compilation database '{{.*}}/non-existant' could not be opened: |
| 9 |
|
| 10 |
// SYNTAX_ONLY: { |
| 11 |
// SYNTAX_ONLY-SAME: "directory": "{{[^"]*}}workdir", |
| 12 |
// SYNTAX_ONLY-SAME: "file": "{{[^"]*}}compilation_database.c" |
| 13 |
// SYNTAX_ONLY-NOT: "output" |
| 14 |
// SYNTAX_ONLY-SAME: "arguments": [ |
| 15 |
// SYNTAX_ONLY-NOT: "-o" |
| 16 |
// SYNTAX_ONLY-SAME: ] |
| 17 |
// SYNTAX_ONLY-SAME: } |
| 18 |
|
| 19 |
int main(void) { |
| 20 |
return 0; |
| 21 |
} |