[cfe-commits] r129894 - in /cfe/trunk/lib/CodeGen: CodeGenTypes.cpp CodeGenTypes.h
Anders Carlsson
andersca at mac.com
Wed Apr 20 16:51:44 PDT 2011
Author: andersca
Date: Wed Apr 20 18:51:43 2011
New Revision: 129894
URL: http://llvm.org/viewvc/llvm-project?rev=129894&view=rev
Log:
Don't add type names for enums; they're never used in LLVM IR.
Modified:
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.h
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=129894&r1=129893&r2=129894&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Apr 20 18:51:43 2011
@@ -65,22 +65,22 @@
}
}
-void CodeGenTypes::addTagTypeName(const TagDecl *TD, const llvm::Type *Ty,
- llvm::StringRef suffix) {
+void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, const llvm::Type *Ty,
+ llvm::StringRef suffix) {
llvm::SmallString<256> TypeName;
llvm::raw_svector_ostream OS(TypeName);
- OS << TD->getKindName() << '.';
+ OS << RD->getKindName() << '.';
// Name the codegen type after the typedef name
// if there is no tag type name available
- if (TD->getIdentifier()) {
+ if (RD->getIdentifier()) {
// FIXME: We should not have to check for a null decl context here.
// Right now we do it because the implicit Obj-C decls don't have one.
- if (TD->getDeclContext())
- OS << TD->getQualifiedNameAsString();
+ if (RD->getDeclContext())
+ OS << RD->getQualifiedNameAsString();
else
- TD->printName(OS);
- } else if (const TypedefNameDecl *TDD = TD->getTypedefNameForAnonDecl()) {
+ RD->printName(OS);
+ } else if (const TypedefNameDecl *TDD = RD->getTypedefNameForAnonDecl()) {
// FIXME: We should not have to check for a null decl context here.
// Right now we do it because the implicit Obj-C decls don't have one.
if (TDD->getDeclContext())
@@ -403,8 +403,9 @@
case Type::Enum: {
const TagDecl *TD = cast<TagType>(Ty).getDecl();
const llvm::Type *Res = ConvertTagDeclType(TD);
-
- addTagTypeName(TD, Res, llvm::StringRef());
+
+ if (const RecordDecl *RD = dyn_cast<RecordDecl>(TD))
+ addRecordTypeName(RD, Res, llvm::StringRef());
return Res;
}
@@ -517,7 +518,7 @@
if (layout.getBaseSubobjectLLVMType() != layout.getLLVMType())
suffix = ".base";
- addTagTypeName(RD, layout.getBaseSubobjectLLVMType(), suffix);
+ addRecordTypeName(RD, layout.getBaseSubobjectLLVMType(), suffix);
}
bool CodeGenTypes::isZeroInitializable(QualType T) {
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=129894&r1=129893&r2=129894&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Wed Apr 20 18:51:43 2011
@@ -101,10 +101,10 @@
/// used to handle cyclic structures properly.
void HandleLateResolvedPointers();
- /// addTagTypeName - Compute a name from the given tag decl with an optional
- /// suffix and name the given LLVM type using it.
- void addTagTypeName(const TagDecl *TD, const llvm::Type *Ty,
- llvm::StringRef suffix);
+ /// addRecordTypeName - Compute a name from the given record decl with an
+ /// optional suffix and name the given LLVM type using it.
+ void addRecordTypeName(const RecordDecl *RD, const llvm::Type *Ty,
+ llvm::StringRef suffix);
public:
CodeGenTypes(ASTContext &Ctx, llvm::Module &M, const llvm::TargetData &TD,
More information about the cfe-commits
mailing list