<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 2:41 PM, Peeter Joot <span dir="ltr"><<a href="mailto:peeter.joot@gmail.com" target="_blank">peeter.joot@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">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:<br>

<br><div>In file included from /clangdir/include/clang/AST/RecursiveASTVisitor.h:17:</div><div>In file included from /clangdir/include/clang/AST/Decl.h:17:</div><div>In file included from /clangdir/include/clang/AST/APValue.h:17:</div>

<div>In file included from /clangdir/include/clang/Basic/LLVM.h:22:</div><div>/clangdir/include/llvm/Support/Casting.h:51:16: error: no member named 'classof' in 'clang::ArrayTypeLoc'</div><div>    return To::classof(&Val);</div>

<div>           ~~~~^</div><div>/clangdir/include/llvm/Support/Casting.h:80:32: note: in instantiation of member function 'llvm::isa_impl<clang::ArrayTypeLoc, clang::TypeLoc,</div><div>      void>::doit' requested here</div>

<div>    return isa_impl<To, From>::doit(*Val);</div><div>                               ^</div><div>/clangdir/include/llvm/Support/Casting.h:113:36: note: in instantiation of member function 'llvm::isa_impl_cl<clang::ArrayTypeLoc,</div>

<div>      clang::TypeLoc *>::doit' requested here</div><div>    return isa_impl_cl<To,FromTy>::doit(Val);</div><div>                                   ^</div><div>/clangdir/include/llvm/Support/Casting.h:124:70: note: in instantiation of member function 'llvm::isa_impl_wrap<clang::ArrayTypeLoc,</div>

<div>      clang::TypeLoc *, clang::TypeLoc *>::doit' requested here</div><div>  return isa_impl_wrap<X, Y, typename simplify_type<Y>::SimpleType>::doit(Val);</div><div>                                                                     ^</div>

<div>/clangdir/include/llvm/Support/Casting.h:276:10: note: in instantiation of function template specialization</div><div>      'llvm::isa<clang::ArrayTypeLoc, clang::TypeLoc *>' requested here</div><div>  return isa<X>(Val) ? cast<X>(Val) : 0;</div>

<div>         ^</div><div>./classvisitor.h:69:51: note: in instantiation of function template specialization 'llvm::dyn_cast<clang::ArrayTypeLoc, clang::TypeLoc>' requested here</div><div>      if ( const ArrayTypeLoc * pTypeLocIfArray = dyn_cast<ArrayTypeLoc>( &thisFieldTypeLoc ) )</div>

<div>                                                  ^</div><div><br></div><div>The code in question is:<br><br><div>inline QualType getQualTypeForDecl( DeclaratorDecl * f )</div><div>{</div><div>   TypeSourceInfo * pThisFieldSourceInfo = f->getTypeSourceInfo() ;</div>

<div><br></div><div>   TypeLoc thisFieldTypeLoc = pThisFieldSourceInfo->getTypeLoc() ;</div><div><br></div><div>   // don't care if it's an array, just want the basic underlying type of the array.</div><div>   for ( ; ; )</div>

<div>   {</div><div>      if ( const ArrayTypeLoc * pTypeLocIfArray = dyn_cast<ArrayTypeLoc>( &thisFieldTypeLoc ) )</div></div></div></blockquote><div><br></div><div style>See <span style="font-family:monospace">175462 for the change that broke this & contains all the cleanup for this change (so lots of examples)<br>
<br>You should rewrite this code as:<br><br>if (ArrayTypeLoc TypeLocIfArray = thisFieldTypeLoc.getAs<ArrayTypeLoc>())</span></div><div style><span style="font-family:monospace"><br></span></div><div style><span style="font-family:monospace">As per another thread on cfe-commits, this may change in the future to:<br>
<br>if (Optional<ArrayTypeLoc> TypeLocIfArray = thisFieldTypeLoc.getAs<ArrayTypeLoc>())</span></div><div style><span style="font-family:monospace"><br></span></div><div style><span style="font-family:monospace">Hope that helps.</span></div>
<div style><span style="font-family:monospace"><br></span></div><div style><span style="font-family:monospace">- David</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><div>      {</div><div>         thisFieldTypeLoc = pTypeLocIfArray->getElementLoc() ;</div>
<div>      }</div><div>      else</div><div>      {</div><div>         break ;</div><div>      }</div><div>   }</div><div><br></div><div>   return thisFieldTypeLoc.getType() ;</div><div>}</div><div><br>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?</div>
<span class=""><font color="#888888">
</font></span></div><span class=""><font color="#888888"><div><br></div>-- <br>Peeter
</font></span></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>