[cfe-dev] Casting.h:51:16: error: no member named 'classof' in 'clang::ArrayTypeLoc'

Peeter Joot peeter.joot at gmail.com
Fri Feb 22 14:41:12 PST 2013


To avoid reporting an already-fixed issue for a trap that occurs in some
AST internals when I run some ASTvisitor code, I've updated to a current
version of the compiler (Revision: 175922).  Unfortunately this breaks my
visitor source in a way that I'm not sure how to deal with:

In file included from /clangdir/include/clang/AST/RecursiveASTVisitor.h:17:
In file included from /clangdir/include/clang/AST/Decl.h:17:
In file included from /clangdir/include/clang/AST/APValue.h:17:
In file included from /clangdir/include/clang/Basic/LLVM.h:22:
/clangdir/include/llvm/Support/Casting.h:51:16: error: no member named
'classof' in 'clang::ArrayTypeLoc'
    return To::classof(&Val);
           ~~~~^
/clangdir/include/llvm/Support/Casting.h:80:32: note: in instantiation of
member function 'llvm::isa_impl<clang::ArrayTypeLoc, clang::TypeLoc,
      void>::doit' requested here
    return isa_impl<To, From>::doit(*Val);
                               ^
/clangdir/include/llvm/Support/Casting.h:113:36: note: in instantiation of
member function 'llvm::isa_impl_cl<clang::ArrayTypeLoc,
      clang::TypeLoc *>::doit' requested here
    return isa_impl_cl<To,FromTy>::doit(Val);
                                   ^
/clangdir/include/llvm/Support/Casting.h:124:70: note: in instantiation of
member function 'llvm::isa_impl_wrap<clang::ArrayTypeLoc,
      clang::TypeLoc *, clang::TypeLoc *>::doit' requested here
  return isa_impl_wrap<X, Y, typename
simplify_type<Y>::SimpleType>::doit(Val);
                                                                     ^
/clangdir/include/llvm/Support/Casting.h:276:10: note: in instantiation of
function template specialization
      'llvm::isa<clang::ArrayTypeLoc, clang::TypeLoc *>' requested here
  return isa<X>(Val) ? cast<X>(Val) : 0;
         ^
./classvisitor.h:69:51: note: in instantiation of function template
specialization 'llvm::dyn_cast<clang::ArrayTypeLoc, clang::TypeLoc>'
requested here
      if ( const ArrayTypeLoc * pTypeLocIfArray = dyn_cast<ArrayTypeLoc>(
&thisFieldTypeLoc ) )
                                                  ^

The code in question is:

inline QualType getQualTypeForDecl( DeclaratorDecl * f )
{
   TypeSourceInfo * pThisFieldSourceInfo = f->getTypeSourceInfo() ;

   TypeLoc thisFieldTypeLoc = pThisFieldSourceInfo->getTypeLoc() ;

   // don't care if it's an array, just want the basic underlying type of
the array.
   for ( ; ; )
   {
      if ( const ArrayTypeLoc * pTypeLocIfArray = dyn_cast<ArrayTypeLoc>(
&thisFieldTypeLoc ) )
      {
         thisFieldTypeLoc = pTypeLocIfArray->getElementLoc() ;
      }
      else
      {
         break ;
      }
   }

   return thisFieldTypeLoc.getType() ;
}

which was a helper function I used to extract the underlying type in case
it was an array.  I'm assuming that this should now be done differently...
if so, how?

-- 
Peeter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130222/73f509fd/attachment.html>


More information about the cfe-dev mailing list