[cfe-commits] r46807 - /cfe/trunk/CodeGen/CodeGenTypes.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 5 21:48:30 PST 2008
Author: lattner
Date: Tue Feb 5 23:48:29 2008
New Revision: 46807
URL: http://llvm.org/viewvc/llvm-project?rev=46807&view=rev
Log:
only convert the type name once, not each type it is refined.
Modified:
cfe/trunk/CodeGen/CodeGenTypes.cpp
Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=46807&r1=46806&r2=46807&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Tue Feb 5 23:48:29 2008
@@ -277,8 +277,25 @@
assert(0 && "FIXME: add missing functionality here");
break;
- case Type::Tagged:
- return ConvertTagDeclType(T, cast<TagType>(Ty).getDecl());
+ case Type::Tagged: {
+ const TagDecl *TD = cast<TagType>(Ty).getDecl();
+ const llvm::Type *Res = ConvertTagDeclType(T, TD);
+
+ std::string TypeName(TD->getKindName());
+ TypeName += '.';
+
+ // Name the codegen type after the typedef name
+ // if there is no tag type name available
+ if (TD->getIdentifier())
+ TypeName += TD->getName();
+ else if (const TypedefType *TdT = dyn_cast<TypedefType>(T))
+ TypeName += TdT->getDecl()->getName();
+ else
+ TypeName += "anon";
+
+ TheModule.addTypeName(TypeName, Res);
+ return Res;
+ }
}
// FIXME: implement.
@@ -386,22 +403,6 @@
assert(0 && "FIXME: Unknown tag decl kind!");
}
- std::string TypeName(TD->getKindName());
- TypeName += '.';
-
- // Name the codegen type after the typedef name
- // if there is no tag type name available
- if (TD->getIdentifier() == 0) {
- if (T->getTypeClass() == Type::TypeName) {
- const TypedefType *TdT = cast<TypedefType>(T);
- TypeName += TdT->getDecl()->getName();
- } else
- TypeName += "anon";
- } else {
- TypeName += TD->getName();
- }
-
- TheModule.addTypeName(TypeName, ResultType);
return ResultType;
}
More information about the cfe-commits
mailing list