get identifier end SourceLocation of CXXRecordDecl


I have a bit stupid question about getting SourceLocation from clang ast.

CXXRecordDecl has getLocation() member function that returns SourceLocation of first character of identifier. That is for code

struct test {};

getLocation() points to first letter of "test" identifier. CXXRecordDecl also has getLocStart() and getLocEnd() that return SourceLocation of first letter of "struct" keyword and closing bracket "}" correspondingly.

But how can I get position of last letter of "test" identifier, position of last letter of "struct" keyword and position of open bracket "{". I can use SourceManager::getCharacterData() and skip over letters and digits until I find end of "test" identifier, but this is silly. What is canonical way to do this?

docs/InternalsManual.html did not help me.

Preprocessor::getLocForEndOfToken() returns a location one character past the end of the source location it is given.

  - Doug