[cfe-dev] getting info about fields in a RecursiveASTVisitor::VisitFieldDecl override

Peeter Joot peeter.joot at gmail.com
Fri Nov 30 16:09:22 PST 2012

I've answered part of my own question, by grepping the clang source tree
for ArrayTypeLoc, and found I can do something like:

      TypeLoc TL = t->getTypeLoc() ;

      // don't care if it's an array, just want the basic underlying type
of the array.
      if ( const ArrayTypeLoc *Arr = dyn_cast<ArrayTypeLoc>(&TL) )
         TL = Arr->getElementLoc() ;

Am guessing I can probably do something similar to see if the type is a
pointer or reference.

Is there any easy way to determine if the underlying type is one of the
fundamental types: char, short, int, long (not caring about
sign/const/volatile/... variations of these)?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121130/30cd4915/attachment.html>

More information about the cfe-dev mailing list