<div dir="ltr">FWIW: Replacing the call to getName with getNameAsString seems to fix the destructor issue as well (i.e. I can remove the special case for destructors) so I've committed this r307959.<div><br></div><div>If the getName failure for destructors is unexpected it may be worth digging into as a separate issue.<div><br></div><div>Cheers,</div><div>Lang. </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 13, 2017 at 2:00 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sure.<div><br></div><div>Richard - is this likely to be related to your query? Calling getName() on at least one destructor in Sema/ms_class_layout triggers the assertion in NamedDecl::getName():</div><div><br></div><div><div><font face="monospace, monospace">(lldb) </font></div><div><font face="monospace, monospace">frame #4: 0x00000001039600e2 clang`clang::NamedDecl::<wbr>getName(this=<wbr>0x0000000112897490) const at Decl.h:238</font></div><div><font face="monospace, monospace">   235    /// This requires that the declaration have a name and that it be a simple</font></div><div><font face="monospace, monospace">   236    /// identifier.</font></div><div><font face="monospace, monospace">   237    StringRef getName() const {</font></div><div><font face="monospace, monospace">-> 238      assert(Name.isIdentifier() && "Name is not a simple identifier");</font></div><div><font face="monospace, monospace">   239      return getIdentifier() ? getIdentifier()->getName() : "";</font></div><div><font face="monospace, monospace">   240    }</font></div><div><font face="monospace, monospace">   241 </font></div><div><font face="monospace, monospace">(lldb) expr this->dump()</font></div><div><font face="monospace, monospace">CXXDestructorDecl 0x112897490 </Users/lhames/Projects/llvm/<wbr>llvm-svn-tot/llvm/tools/clang/<wbr>test/Sema/ms_class_layout.cpp:<wbr>102:3, col:17> col:11 used ~IA 'void (void) __attribute__((thiscall))' virtual</font></div><div><font face="monospace, monospace">`-CompoundStmt 0x1128977f8 <col:16, col:17></font></div></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Lang.</div></font></span><div><div class="h5"><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Wed, Jul 12, 2017 at 10:36 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanaka@apple.com" target="_blank">ahatanaka@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>Hi Lang,</div><div><br></div><div>clang crashes when I compile the following code with "-Xclang -ast-dump”:</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">class Base {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">public:</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  virtual void operator()() {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">};</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255);min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">class Derived : public Base {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">public:</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  void operator()() override {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">};</span></div></div><div><br></div><div>If I change “OS << D->getName()” to “OS << D->getNameAsString()”, the crash disappears.</div><div><br></div><div>Can you take a look please?</div><div><div class="m_-4580369820118701243gmail-m_4359539713146780686h5"><div><br></div><div><blockquote type="cite"><div>On Jun 20, 2017, at 2:30 PM, Lang Hames via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="m_-4580369820118701243gmail-m_4359539713146780686m_-2650404577340712311Apple-interchange-newline"><div><div>Author: lhames<br>Date: Tue Jun 20 16:30:43 2017<br>New Revision: 305860<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=305860&view=rev" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=305860&view=rev</a><br>Log:<br>Special-case handling of destructors in override lists when dumping ASTs.<br><br>Fixes a bug in r305850: CXXDestructors don't have names, so we need to handle<br>printing of them separately.<br><br><br>Modified:<br>    cfe/trunk/lib/AST/ASTDumper<wbr>.cpp<br><br>Modified: cfe/trunk/lib/AST/ASTDumper.cp<wbr>p<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=305860&r1=305859&r2=305860&view=diff" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/AST/ASTDum<wbr>per.cpp?rev=305860&r1=305859&r<wbr>2=305860&view=diff</a><br>==============================<wbr>==============================<wbr>==================<br>--- cfe/trunk/lib/AST/ASTDumper.cp<wbr>p (original)<br>+++ cfe/trunk/lib/AST/ASTDumper.cp<wbr>p Tue Jun 20 16:30:43 2017<br>@@ -1189,9 +1189,12 @@ void ASTDumper::VisitFunctionDecl(c<wbr>onst<br>       auto dumpOverride =<br>         [=](const CXXMethodDecl *D) {<br>           SplitQualType T_split = D->getType().split();<br>-          OS << D << " " << D->getParent()->getName() << "::"<br>-             << D->getName() << " '"<br>-             << QualType::getAsString(T_split) << "'";<br>+          OS << D << " " << D->getParent()->getName() << "::";<br>+          if (isa<CXXDestructorDecl>(D))<br>+            OS << "~" << D->getParent()->getName();<br>+          else<br>+            OS << D->getName();</div></div></blockquote><blockquote type="cite"><div><div>+          OS << " '" << QualType::getAsString(T_split) << "'";<br>         };<br><br>       dumpChild([=] {<br><br><br>______________________________<wbr>_________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>