[llvm-branch-commits] [cfe-branch] r134790 - /cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp
Chris Lattner
sabre at nondot.org
Fri Jul 8 22:02:25 PDT 2011
Author: lattner
Date: Sat Jul 9 00:02:25 2011
New Revision: 134790
URL: http://llvm.org/viewvc/llvm-project?rev=134790&view=rev
Log:
rearrange things a bit so that RecordTypes don't end up in TypeCache. They have their own RecordDeclTypes map anyway.
Modified:
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp?rev=134790&r1=134789&r2=134790&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp Sat Jul 9 00:02:25 2011
@@ -148,8 +148,12 @@
llvm::Type *CodeGenTypes::ConvertType(QualType T) {
T = Context.getCanonicalType(T);
- const clang::Type *Ty = T.getTypePtr();
+ const Type *Ty = T.getTypePtr();
+ // RecordTypes are cached and processed specially.
+ if (const RecordType *RT = dyn_cast<RecordType>(Ty))
+ return ConvertRecordDeclType(RT->getDecl());
+
// See if type is already cached.
llvm::DenseMap<const Type *, llvm::Type *>::iterator TCI = TypeCache.find(Ty);
// If type is found in map then use it. Otherwise, convert type T.
@@ -159,6 +163,7 @@
// If we don't have it in the cache, convert it now.
llvm::Type *ResultType = 0;
switch (Ty->getTypeClass()) {
+ case Type::Record: // Handled above.
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
@@ -345,11 +350,7 @@
break;
}
- case Type::Record:
- ResultType = ConvertRecordDeclType(cast<RecordType>(Ty)->getDecl());
- break;
-
- case Type::Enum: {
+ case Type::Enum: {
const EnumDecl *ED = cast<EnumType>(Ty)->getDecl();
if (ED->isDefinition() || ED->isFixed())
return ConvertType(ED->getIntegerType());
More information about the llvm-branch-commits
mailing list