[cfe-commits] r44489 - /cfe/trunk/CodeGen/CodeGenTypes.cpp
Christopher Lamb
christopher.lamb at gmail.com
Sat Dec 1 01:08:43 PST 2007
Author: clamb
Date: Sat Dec 1 03:08:41 2007
New Revision: 44489
URL: http://llvm.org/viewvc/llvm-project?rev=44489&view=rev
Log:
When generating the CodeGen type name of a struct, union, enum use the typedef
name if a tag type name is not available for the type. This matches how llvm-gcc
chooses CodeGen type names.
This means that "typedef struct {...} foo" now results in a CodeGen name of
"struct.foo" rather than "struct."
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=44489&r1=44488&r2=44489&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Sat Dec 1 03:08:41 2007
@@ -310,7 +310,14 @@
std::string TypeName(TD->getKindName());
TypeName += '.';
- TypeName += TD->getName();
+
+ // Name the codegen type after the typedef name
+ // if there is no tag type name available
+ if (TD->getName() == "" && T->getTypeClass() == Type::TypeName) {
+ const TypedefType *TdT = cast<TypedefType>(T);
+ TypeName += TdT->getDecl()->getName();
+ } else
+ TypeName += TD->getName();
TheModule.addTypeName(TypeName, ResultType);
return ResultType;
More information about the cfe-commits
mailing list