[cfe-dev] Casting.h:51:16: error: no member named 'classof' in 'clang::ArrayTypeLoc'
David Blaikie
dblaikie at gmail.com
Fri Feb 22 14:55:50 PST 2013
On Fri, Feb 22, 2013 at 2:41 PM, Peeter Joot <peeter.joot at gmail.com> wrote:
> 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 ) )
>
See 175462 for the change that broke this & contains all the cleanup for
this change (so lots of examples)
You should rewrite this code as:
if (ArrayTypeLoc TypeLocIfArray = thisFieldTypeLoc.getAs<ArrayTypeLoc>())
As per another thread on cfe-commits, this may change in the future to:
if (Optional<ArrayTypeLoc> TypeLocIfArray =
thisFieldTypeLoc.getAs<ArrayTypeLoc>())
Hope that helps.
- David
> {
> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130222/39f256f4/attachment.html>
More information about the cfe-dev
mailing list