[cfe-dev] TypeLoc SourceRange for builtin types
Erik Schmidt via cfe-dev
cfe-dev at lists.llvm.org
Wed Sep 27 22:01:49 PDT 2017
Greetings,
for getting the written source of the type of a field, I'm using
pFieldDecl->getTypeSourceInfo()->getTypeLoc().getSourceRange();
This works great, it returns "int" for a field like "int foo;" or
even "vector<int>" for a field like "vector<int> bar;", as expected.
However, for built-in types with a space inside, like "unsigned int"
or "signed char", this doesn't work, strangely. For example, for a
field like this:
signed char foo;
the source range returned only contains the first word, namely
"signed". But it should contain "signed char", shouldn't it?
It's the same for all built-in type combinations and happens
everywhere, at parameters, return types of functions and others. Am I
misunderstanding something here? Can't imagine that this is a bug,
since everything else works so nicely. Any hint of what I am doing
wrong?
More information about the cfe-dev
mailing list