diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-01-12 14:51:47 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-01-12 14:51:47 +0000 |
commit | 3ee4cc4acfa675c8cace6b05f2b41ed45a6a1033 (patch) | |
tree | eafc3fc139c8fdbb56ec595c61ed608af8af505b /test/Index | |
parent | 780143bbd516aa39d754e5cab50955321b71fba0 (diff) |
[CodeComplete] Add an option to omit results from the preamble.
Summary:
Enumerating the contents of a namespace or global scope will omit any
decls that aren't already loaded, instead of deserializing them from the
PCH.
This allows a fast hybrid code completion where symbols from headers are
provided by an external index. (Sema already exposes the information
needed to do a reasonabl job of filtering them).
Clangd plans to implement this hybrid.
This option is just a hint - callers still need to postfilter results if
they want to *avoid* completing decls outside the main file.
Reviewers: bkramer, ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41989
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index')
-rw-r--r-- | test/Index/complete-pch-skip.cpp | 18 | ||||
-rw-r--r-- | test/Index/complete-pch-skip.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/Index/complete-pch-skip.cpp b/test/Index/complete-pch-skip.cpp new file mode 100644 index 0000000000..866976f990 --- /dev/null +++ b/test/Index/complete-pch-skip.cpp @@ -0,0 +1,18 @@ +namespace ns { +int bar; +} + +int main() { return ns:: } + +// RUN: echo "namespace ns { int foo; }" > %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: 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 + diff --git a/test/Index/complete-pch-skip.h b/test/Index/complete-pch-skip.h new file mode 100644 index 0000000000..f7422af773 --- /dev/null +++ b/test/Index/complete-pch-skip.h @@ -0,0 +1,3 @@ +namespace ns { +int foo; +} |