diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-08 19:27:23 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-02-08 19:27:23 +0000 |
commit | 5a56e1bdfbf57787314dd44a27318964eaa2cf39 (patch) | |
tree | ae7eb44f1bd4a61e5d355242aba755ed68ed1d5b /test/Index/annotate-tokens-cxx0x.cpp | |
parent | 19df705c75ba341b3ae8f2ff3e3f411d5f49887c (diff) |
[libclang] Add a test to make sure annotation works fine in the presence of
'override' on the method.
This was fixed in a previous commit, generally handling attributes that are at the
end of the declaration.
rdar://13140589
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/annotate-tokens-cxx0x.cpp')
-rw-r--r-- | test/Index/annotate-tokens-cxx0x.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Index/annotate-tokens-cxx0x.cpp b/test/Index/annotate-tokens-cxx0x.cpp index a126b85127..49f7efb285 100644 --- a/test/Index/annotate-tokens-cxx0x.cpp +++ b/test/Index/annotate-tokens-cxx0x.cpp @@ -13,6 +13,17 @@ void test() { bool b2 = __is_trivially_constructible(Integer, Float, Bool); } +typedef int Int; + +class B { + virtual void foo(Int); +}; + +class S : public B { + virtual void foo(Int) override; +}; + + // RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -fno-delayed-template-parsing -std=c++11 %s | FileCheck %s // CHECK: Identifier: "args" [3:20 - 3:24] SizeOfPackExpr=args:2:15 // CHECK: Identifier: "Args" [3:38 - 3:42] TypeRef=Args:1:22 @@ -25,3 +36,19 @@ void test() { // CHECK-TRAIT: Identifier: "Float" [13:51 - 13:56] TypeRef=Float:11:17 // CHECK-TRAIT: Identifier: "Bool" [13:58 - 13:62] TypeRef=Bool:12:16 +// RUN: c-index-test -test-annotate-tokens=%s:16:1:24:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-WITH-OVERRIDE %s +// CHECK-WITH-OVERRIDE: Keyword: "virtual" [19:2 - 19:9] CXXMethod=foo:19:15 (virtual) +// CHECK-WITH-OVERRIDE: Keyword: "void" [19:10 - 19:14] CXXMethod=foo:19:15 (virtual) +// CHECK-WITH-OVERRIDE: Identifier: "foo" [19:15 - 19:18] CXXMethod=foo:19:15 (virtual) +// CHECK-WITH-OVERRIDE: Punctuation: "(" [19:18 - 19:19] CXXMethod=foo:19:15 (virtual) +// CHECK-WITH-OVERRIDE: Identifier: "Int" [19:19 - 19:22] TypeRef=Int:16:13 +// CHECK-WITH-OVERRIDE: Punctuation: ")" [19:22 - 19:23] ParmDecl=:19:22 (Definition) +// CHECK-WITH-OVERRIDE: Punctuation: ";" [19:23 - 19:24] ClassDecl=B:18:7 (Definition) +// CHECK-WITH-OVERRIDE: Keyword: "virtual" [23:3 - 23:10] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] +// CHECK-WITH-OVERRIDE: Keyword: "void" [23:11 - 23:15] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] +// CHECK-WITH-OVERRIDE: Identifier: "foo" [23:16 - 23:19] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] +// CHECK-WITH-OVERRIDE: Punctuation: "(" [23:19 - 23:20] CXXMethod=foo:23:16 (virtual) [Overrides @19:15] +// CHECK-WITH-OVERRIDE: Identifier: "Int" [23:20 - 23:23] TypeRef=Int:16:13 +// CHECK-WITH-OVERRIDE: Punctuation: ")" [23:23 - 23:24] ParmDecl=:23:23 (Definition) +// CHECK-WITH-OVERRIDE: Keyword: "override" [23:25 - 23:33] attribute(override)= +// CHECK-WITH-OVERRIDE: Punctuation: ";" [23:33 - 23:34] ClassDecl=S:22:7 (Definition) |