diff options
Diffstat (limited to 'clang/test/Index')
-rw-r--r-- | clang/test/Index/targeted-cursor.c | 52 | ||||
-rw-r--r-- | clang/test/Index/targeted-fields.h | 3 | ||||
-rw-r--r-- | clang/test/Index/targeted-nested1.h | 2 | ||||
-rw-r--r-- | clang/test/Index/targeted-preamble.h | 2 | ||||
-rw-r--r-- | clang/test/Index/targeted-top.h | 24 |
5 files changed, 83 insertions, 0 deletions
diff --git a/clang/test/Index/targeted-cursor.c b/clang/test/Index/targeted-cursor.c new file mode 100644 index 00000000000..ec03156c61b --- /dev/null +++ b/clang/test/Index/targeted-cursor.c @@ -0,0 +1,52 @@ + +#include "targeted-top.h" +#include "targeted-preamble.h" + +int LocalVar1; +int LocalVar2; + +// RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%s:5:10 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%s:5:10 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-preamble.h:2:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=PREAMBLE-CURSOR1 + +// LOCAL-CURSOR1: VarDecl=LocalVar1:5:5 +// TOP-CURSOR1: VarDecl=TopVar:11:12 +// NESTED-CURSOR1: VarDecl=NestedVar1:2:12 +// PREAMBLE-CURSOR1: VarDecl=PreambleVar:2:12 diff --git a/clang/test/Index/targeted-fields.h b/clang/test/Index/targeted-fields.h new file mode 100644 index 00000000000..7da57f3ef27 --- /dev/null +++ b/clang/test/Index/targeted-fields.h @@ -0,0 +1,3 @@ + + int z; + int w; diff --git a/clang/test/Index/targeted-nested1.h b/clang/test/Index/targeted-nested1.h new file mode 100644 index 00000000000..d5a019b6985 --- /dev/null +++ b/clang/test/Index/targeted-nested1.h @@ -0,0 +1,2 @@ + +extern int NestedVar1; diff --git a/clang/test/Index/targeted-preamble.h b/clang/test/Index/targeted-preamble.h new file mode 100644 index 00000000000..19b953933f1 --- /dev/null +++ b/clang/test/Index/targeted-preamble.h @@ -0,0 +1,2 @@ + +extern int PreambleVar; diff --git a/clang/test/Index/targeted-top.h b/clang/test/Index/targeted-top.h new file mode 100644 index 00000000000..0f3c97586e4 --- /dev/null +++ b/clang/test/Index/targeted-top.h @@ -0,0 +1,24 @@ + +#ifndef TARGETED_TOP_H +#define TARGETED_TOP_H + +#include "targeted-nested1.h" + +enum { + VALUE = 3 +}; + +extern int TopVar; + +typedef struct { + int x; + int y; +#include "targeted-fields.h" +} Vector; + +static inline int vector_get_x(Vector v) { + int x = v.x; + return x; +} + +#endif |