Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 1 | namespace ns { |
| 2 | int bar; |
| 3 | } |
| 4 | |
| 5 | int main() { return ns:: } |
Sam McCall | abdcc61 | 2018-01-24 17:50:20 +0000 | [diff] [blame] | 6 | int main2() { return ns::foo(). } |
Eric Liu | 88de9f6 | 2018-09-19 09:34:55 +0000 | [diff] [blame] | 7 | int main3() { PREAMBLE_ } |
Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 8 | |
Eric Liu | 88de9f6 | 2018-09-19 09:34:55 +0000 | [diff] [blame] | 9 | // RUN: printf "namespace ns { struct foo { int baz }; }\n#define PREAMBLE_MAC" > %t.h |
Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 10 | // RUN: c-index-test -write-pch %t.h.pch -x c++-header %t.h |
| 11 | // |
| 12 | // RUN: c-index-test -code-completion-at=%s:5:26 -include %t.h %s | FileCheck -check-prefix=WITH-PCH %s |
| 13 | // WITH-PCH: {TypedText bar} |
| 14 | // WITH-PCH: {TypedText foo} |
| 15 | |
Eric Liu | 88de9f6 | 2018-09-19 09:34:55 +0000 | [diff] [blame] | 16 | // RUN: c-index-test -code-completion-at=%s:7:24 -include %t.h %s | FileCheck -check-prefix=WITH-PCH-MACRO %s |
| 17 | // WITH-PCH-MACRO: {TypedText PREAMBLE_MAC} |
| 18 | |
Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 19 | // 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 |
| 20 | // SKIP-PCH-NOT: foo |
| 21 | // SKIP-PCH: {TypedText bar} |
| 22 | // SKIP-PCH-NOT: foo |
| 23 | |
Eric Liu | 88de9f6 | 2018-09-19 09:34:55 +0000 | [diff] [blame] | 24 | // 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 |
| 25 | // SKIP-PCH-MACRO-NOT: {TypedText PREAMBLE_MAC} |
| 26 | |
Sam McCall | 091b1ef | 2018-01-16 12:33:46 +0000 | [diff] [blame] | 27 | // Verify that with *no* preamble (no -include flag) we still get local results. |
| 28 | // SkipPreamble used to break this, by making lookup *too* lazy. |
| 29 | // RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:5:26 %s | FileCheck -check-prefix=NO-PCH %s |
| 30 | // NO-PCH-NOT: foo |
| 31 | // NO-PCH: {TypedText bar} |
| 32 | // NO-PCH-NOT: foo |
| 33 | |
Sam McCall | abdcc61 | 2018-01-24 17:50:20 +0000 | [diff] [blame] | 34 | // Verify that we still get member results from the preamble. |
| 35 | // RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:6:32 -include %t.h %s | FileCheck -check-prefix=MEMBER %s |
| 36 | // MEMBER: {TypedText baz} |
| 37 | |