diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-11-27 05:50:55 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-11-27 05:50:55 +0000 |
commit | 50126f12591b5958a76ad0ed210c798ffd84ea8b (patch) | |
tree | 54b3b71ee06af09b183fbda18a465d48b6c141eb /clang/test/Index/annotate-tokens.cpp | |
parent | 965f88258843547d8226ec630c4b810a04a06ff4 (diff) | |
download | bcm5719-llvm-50126f12591b5958a76ad0ed210c798ffd84ea8b.tar.gz bcm5719-llvm-50126f12591b5958a76ad0ed210c798ffd84ea8b.zip |
[libclang] Make sure we don't access past the tokens buffer while token annotation.
Also disable crash recovery using 'LIBCLANG_DISABLE_CRASH_RECOVERY' environment variable.
llvm-svn: 195819
Diffstat (limited to 'clang/test/Index/annotate-tokens.cpp')
-rw-r--r-- | clang/test/Index/annotate-tokens.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Index/annotate-tokens.cpp b/clang/test/Index/annotate-tokens.cpp index 16726547a2e..8f2cdeb5643 100644 --- a/clang/test/Index/annotate-tokens.cpp +++ b/clang/test/Index/annotate-tokens.cpp @@ -28,6 +28,11 @@ struct TS { template <bool (*tfn)(X*)> void TS<tfn>::foo() {} +void test4() { + if (int p = 0) + return; +} + // RUN: c-index-test -test-annotate-tokens=%s:1:1:30:1 %s -fno-delayed-template-parsing | FileCheck %s // CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition) // CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition) @@ -173,3 +178,10 @@ void TS<tfn>::foo() {} // CHECK: Punctuation: ")" [29:19 - 29:20] CXXMethod=foo:29:15 (Definition) // CHECK: Punctuation: "{" [29:21 - 29:22] CompoundStmt= // CHECK: Punctuation: "}" [29:22 - 29:23] CompoundStmt= + +// RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 c-index-test -test-annotate-tokens=%s:32:1:32:13 %s | FileCheck %s -check-prefix=CHECK2 +// CHECK2: Keyword: "if" [32:3 - 32:5] IfStmt= +// CHECK2: Punctuation: "(" [32:6 - 32:7] IfStmt= +// CHECK2: Keyword: "int" [32:7 - 32:10] VarDecl=p:32:11 (Definition) +// CHECK2: Identifier: "p" [32:11 - 32:12] VarDecl=p:32:11 (Definition) +// CHECK2: Punctuation: "=" [32:13 - 32:14] VarDecl=p:32:11 (Definition) |