[cfe-dev] Help getting source locations for type qualifiers

scott constable via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 28 13:06:23 PDT 2016


Hi all,

Consider the following declaration:

const char *const ptr = 0;

With an ordinary TypeLoc, I can get the SourceRange corresponding to the
"char *" part of the type by calling getSourceRange(), but I would like to
get the SourceRange of the whole qualtype, i.e. "const char *const". The
documentation seems to suggest that this should be possible via the
TypeLoc::findExplicitQualifierLoc() function, which "Find[s] a type with
the location of an explicit type qualifier." The implementation casts the
TypeLoc to a QualifiedTypeLoc and returns the result. However, the
documentation for QualifiedTypeLoc states that "Currently, we intentionally
do not provide source location for type qualifiers."

Does this mean that what I want to do is not possible?

Thanks in advance,

Scott Constable
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160728/12fb268f/attachment.html>


More information about the cfe-dev mailing list