summaryrefslogtreecommitdiffstats
path: root/test/Index
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-09-19 09:34:55 +0000
committerEric Liu <ioeric@google.com>2018-09-19 09:34:55 +0000
commit51d76e9ec38a972a7cdf883ef4f24de3a4cd4dcd (patch)
tree71538fd0ba458bd152a1e48b97cb04f733c4b718 /test/Index
parent2282e12e22aaacce2c76666e953b2612333b3f5c (diff)
[Sema] Do not load macros from preamble when LoadExternal is false.
Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52079 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342528 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index')
-rw-r--r--test/Index/complete-pch-skip.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/Index/complete-pch-skip.cpp b/test/Index/complete-pch-skip.cpp
index 6abf40df36..38ba228ba2 100644
--- a/test/Index/complete-pch-skip.cpp
+++ b/test/Index/complete-pch-skip.cpp
@@ -4,19 +4,26 @@ int bar;
int main() { return ns:: }
int main2() { return ns::foo(). }
+int main3() { PREAMBLE_ }
-// RUN: echo "namespace ns { struct foo { int baz }; }" > %t.h
+// RUN: printf "namespace ns { struct foo { int baz }; }\n#define PREAMBLE_MAC" > %t.h
// RUN: c-index-test -write-pch %t.h.pch -x c++-header %t.h
//
// RUN: c-index-test -code-completion-at=%s:5:26 -include %t.h %s | FileCheck -check-prefix=WITH-PCH %s
// WITH-PCH: {TypedText bar}
// WITH-PCH: {TypedText foo}
+// RUN: c-index-test -code-completion-at=%s:7:24 -include %t.h %s | FileCheck -check-prefix=WITH-PCH-MACRO %s
+// WITH-PCH-MACRO: {TypedText PREAMBLE_MAC}
+
// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:5:26 -include %t.h %s | FileCheck -check-prefix=SKIP-PCH %s
// SKIP-PCH-NOT: foo
// SKIP-PCH: {TypedText bar}
// SKIP-PCH-NOT: foo
+// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:7:24 -include %t.h %s | FileCheck -check-prefix=SKIP-PCH-MACRO %s
+// SKIP-PCH-MACRO-NOT: {TypedText PREAMBLE_MAC}
+
// Verify that with *no* preamble (no -include flag) we still get local results.
// SkipPreamble used to break this, by making lookup *too* lazy.
// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:5:26 %s | FileCheck -check-prefix=NO-PCH %s