[cfe-commits] r66549 - in /cfe/trunk: include/clang/AST/Decl.h lib/CodeGen/Mangle.cpp lib/Sema/SemaDecl.cpp test/CodeGenCXX/mangle.cpp

Douglas Gregor dgregor at apple.com
Tue Mar 10 10:11:13 PDT 2009


On Mar 10, 2009, at 10:07 AM, Anders Carlsson wrote:
> void CXXNameMangler::mangleType(const TagType *T) {
>   //  <class-enum-type> ::= <name>
> -  mangleName(T->getDecl());
> +
> +  if (!T->getDecl()->getIdentifier())
> +    mangleName(T->getDecl()->getTypedefForAnonDecl());
> +  else
> +    mangleName(T->getDecl());
> }

Looks great!

> void CXXNameMangler::mangleType(const ArrayType *T) {
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=66549&r1=66548&r2=66549&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Mar 10 12:07:44 2009
> @@ -2867,6 +2867,16 @@
>                                            D.getIdentifierLoc(),
>                                            D.getIdentifier(),
>                                            T);
> +
> +  if (TagType *TT = dyn_cast<TagType>(T)) {
> +    TagDecl *TD = TT->getDecl();
> +
> +    // If the TagDecl that the TypedefDecl points to is an  
> anonymous decl
> +    // keep track of the TypedefDecl.
> +    if (!TD->getIdentifier() && !TD->getTypedefForAnonDecl())
> +      TD->setTypedefForAnonDecl(NewTD);
> +  }
> +
>   NewTD->setNextDeclarator(LastDeclarator);
>   if (D.getInvalidType())
>     NewTD->setInvalidDecl();

Good, good.

Thanks!

	- Doug



More information about the cfe-commits mailing list