diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-04 19:18:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-04 19:18:44 +0000 |
commit | 88a35862fbe473f2a4f0c19f24dbe536937e1dc6 (patch) | |
tree | 26566bd2b4332e7f9ac6209ad3d2ef10b4e20958 /test/CodeCompletion | |
parent | 5be028f84243e0f6906c259e67cbdaf9bee431b2 (diff) |
Teach Preprocessor::macro_begin/macro_end to lazily load all macro
definitions from a precompiled header. This ensures that
code-completion with macro names behaves the same with or without
precompiled headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeCompletion')
-rw-r--r-- | test/CodeCompletion/Inputs/macros.h | 4 | ||||
-rw-r--r-- | test/CodeCompletion/macros.c | 15 |
2 files changed, 12 insertions, 7 deletions
diff --git a/test/CodeCompletion/Inputs/macros.h b/test/CodeCompletion/Inputs/macros.h new file mode 100644 index 0000000000..98b5ac6510 --- /dev/null +++ b/test/CodeCompletion/Inputs/macros.h @@ -0,0 +1,4 @@ +#define FOO +#define BAR(X, Y) X, Y +#define IDENTITY(X) X +#define WIBBLE(...) diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c index 0ba2f065c4..f8861e912b 100644 --- a/test/CodeCompletion/macros.c +++ b/test/CodeCompletion/macros.c @@ -1,8 +1,3 @@ -#define FOO -#define BAR(X, Y) X, Y -#define IDENTITY(X) X -#define WIBBLE(...) - enum Color { Red, Green, Blue }; @@ -13,11 +8,17 @@ struct Point { }; void test(struct Point *p) { - // RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s + // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s switch (p->IDENTITY(color)) { - // RUN: %clang_cc1 -fsyntax-only -code-completion-macros -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s + // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s case } + + // Run the same tests, this time with macros loaded from the PCH file. + // RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/macros.h + // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s + // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s + // CC1: color // CC1: x // CC1: y |