This is an archive of the discontinued LLVM Phabricator instance.

[libclang] Fix cursors for functions with trailing return type
ClosedPublic

Authored by nik on Nov 28 2017, 8:09 AM.

Details

Summary

For the function declaration

auto foo5(Foo) -> Foo;

the parameter tokens were mapped to cursors representing the
FunctionDecl:

Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
Punctuation: ";" [1:19 - 1:20]

Fix this by ensuring that the trailing return type is not visited as
first.

Event Timeline

nik created this revision.Nov 28 2017, 8:09 AM
This revision is now accepted and ready to land.Dec 11 2017, 4:57 AM
nik added a comment.Dec 11 2017, 6:21 AM

Thanks for the review. Please submit as I don't have the permissions for this.

nik added a comment.Dec 14 2017, 6:50 AM

Ping..."Please submit as I don't have the permissions for this."

This revision was automatically updated to reflect the committed changes.