diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-10 18:11:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-10 18:11:21 +0000 |
commit | 4e16d0478407b556c819b5836a3564a9fdee8d5f (patch) | |
tree | c47f95d3a1f51a34674ad3b254d8432b184b4751 | |
parent | ee1828a6b5ae1bc4ea300e48f3840ac1ec5be295 (diff) |
When pretty-printing an anonymous tag type that is associated with a typedef, use the name of the typedef rather than <anonymous>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66559 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Type.cpp | 11 |
1 files 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 = "<anonymous>"; - InnerString = std::string(Kind) + " " + ID + InnerString; + if (Kind) + InnerString = std::string(Kind) + " " + ID + InnerString; + else + InnerString = ID + InnerString; } |