summaryrefslogtreecommitdiffstats
path: root/test/Index
diff options
context:
space:
mode:
Diffstat (limited to 'test/Index')
-rw-r--r--test/Index/preamble-conditionals-crash.cpp12
-rw-r--r--test/Index/preamble-conditionals.cpp8
2 files changed, 20 insertions, 0 deletions
diff --git a/test/Index/preamble-conditionals-crash.cpp b/test/Index/preamble-conditionals-crash.cpp
new file mode 100644
index 0000000000..6b18c87d19
--- /dev/null
+++ b/test/Index/preamble-conditionals-crash.cpp
@@ -0,0 +1,12 @@
+#ifndef HEADER_GUARD
+
+#define FOO int aba;
+FOO
+
+#endif
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 \
+// RUN: local -std=c++14 %s 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "libclang: crash detected" \
+// RUN: --implicit-check-not "error:"
+// CHECK: macro expansion=FOO:3:9 Extent=[4:1 - 4:4]
+// CHECK: VarDecl=aba:4:1 (Definition) Extent=[4:1 - 4:4]
diff --git a/test/Index/preamble-conditionals.cpp b/test/Index/preamble-conditionals.cpp
new file mode 100644
index 0000000000..81ef8265e8
--- /dev/null
+++ b/test/Index/preamble-conditionals.cpp
@@ -0,0 +1,8 @@
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source local %s 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "error:"
+#ifndef FOO_H
+#define FOO_H
+
+void foo();
+
+#endif