From 4e16d0478407b556c819b5836a3564a9fdee8d5f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 10 Mar 2009 18:11:21 +0000 Subject: [PATCH] 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 --- lib/AST/Type.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; } -- 2.40.0