From: Douglas Gregor Date: Tue, 10 Mar 2009 18:11:21 +0000 (+0000) Subject: When pretty-printing an anonymous tag type that is associated with a typedef, use... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e16d0478407b556c819b5836a3564a9fdee8d5f;p=clang When pretty-printing an anonymous tag type that is associated with a typedef, use the name of the typedef rather than git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66559 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 412b0cf834..f9cf847ee9 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1388,8 +1388,15 @@ void TagType::getAsStringInternal(std::string &InnerString) const { const char *ID; if (const IdentifierInfo *II = getDecl()->getIdentifier()) ID = II->getName(); - else + else if (TypedefDecl *Typedef = getDecl()->getTypedefForAnonDecl()) { + Kind = 0; + assert(Typedef->getIdentifier() && "Typedef without identifier?"); + ID = Typedef->getIdentifier()->getName(); + } else ID = ""; - InnerString = std::string(Kind) + " " + ID + InnerString; + if (Kind) + InnerString = std::string(Kind) + " " + ID + InnerString; + else + InnerString = ID + InnerString; }