aboutsummaryrefslogtreecommitdiff
path: root/test/Driver/compilation_database.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Driver/compilation_database.c')
-rw-r--r--test/Driver/compilation_database.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Driver/compilation_database.c b/test/Driver/compilation_database.c
new file mode 100644
index 000000000000..d5bafd41a647
--- /dev/null
+++ b/test/Driver/compilation_database.c
@@ -0,0 +1,11 @@
+// RUN: cd "%T"
+// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
+// RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=ERROR %s
+
+// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// CHECK: { "directory": "{{.*}}", "file": "[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": "compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", "[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// ERROR: error: compilation database '{{.*}}/non-existant' could not be opened:
+
+int main(void) {
+ return 0;
+}