[cfe-commits] r43514 - in /cfe/trunk/CodeGen: CodeGenTypes.cpp CodeGenTypes.h
Devang Patel
dpatel at apple.com
Tue Oct 30 13:46:49 PDT 2007
Author: dpatel
Date: Tue Oct 30 15:46:47 2007
New Revision: 43514
URL: http://llvm.org/viewvc/llvm-project?rev=43514&view=rev
Log:
Use
+ llvm::DenseMap<Type *, llvm::PATypeHolder> TypeHolderMap;
instead of
- llvm::DenseMap<Type *, llvm::PATypeHolder *> TypeHolderMap;
Modified:
cfe/trunk/CodeGen/CodeGenTypes.cpp
cfe/trunk/CodeGen/CodeGenTypes.h
Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=43514&r1=43513&r2=43514&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Tue Oct 30 15:46:47 2007
@@ -75,16 +75,16 @@
/// ConvertType - Convert the specified type to its LLVM form.
const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
// See if type is already cached.
- llvm::DenseMap<Type *, llvm::PATypeHolder *>::iterator
+ llvm::DenseMap<Type *, llvm::PATypeHolder>::iterator
I = TypeHolderMap.find(T.getTypePtr());
if (I != TypeHolderMap.end()) {
- llvm::PATypeHolder *PAT = I->second;
- return PAT->get();
+ llvm::PATypeHolder PAT = I->second;
+ return PAT.get();
}
const llvm::Type *ResultType = ConvertNewType(T);
- llvm::PATypeHolder *PAT = new llvm::PATypeHolder(ResultType);
- TypeHolderMap[T.getTypePtr()] = PAT;
+ TypeHolderMap.insert(std::make_pair(T.getTypePtr(),
+ llvm::PATypeHolder(ResultType)));
return ResultType;
}
@@ -187,7 +187,9 @@
if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
const llvm::Type *RType = llvm::PointerType::get(ResultType);
QualType RTy = Context.getPointerType(FP.getResultType());
- TypeHolderMap[RTy.getTypePtr()] = new llvm::PATypeHolder(RType);
+ TypeHolderMap.insert(std::make_pair(RTy.getTypePtr(),
+ llvm::PATypeHolder(RType)));
+
ArgTys.push_back(RType);
ResultType = llvm::Type::VoidTy;
}
@@ -237,8 +239,8 @@
// Reevaluate this when performance analyis finds tons of opaque types.
llvm::OpaqueType *OpaqueTy = llvm::OpaqueType::get();
RecordTypesToResolve[RD] = OpaqueTy;
- QualType Opq;
- TypeHolderMap[Opq.getTypePtr()] = new llvm::PATypeHolder(OpaqueTy);
+ TypeHolderMap.insert(std::make_pair(T.getTypePtr(),
+ llvm::PATypeHolder(OpaqueTy)));
// Layout fields.
RecordOrganizer RO;
@@ -304,7 +306,9 @@
else {
QualType PTy = Context.getPointerType(FTP.getArgType(i));
const llvm::Type *PtrTy = llvm::PointerType::get(Ty);
- TypeHolderMap[PTy.getTypePtr()] = new llvm::PATypeHolder(PtrTy);
+ TypeHolderMap.insert(std::make_pair(PTy.getTypePtr(),
+ llvm::PATypeHolder(PtrTy)));
+
ArgTys.push_back(PtrTy);
}
}
Modified: cfe/trunk/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.h?rev=43514&r1=43513&r2=43514&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.h Tue Oct 30 15:46:47 2007
@@ -83,7 +83,7 @@
/// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is
/// used instead of llvm::Type because it allows us to bypass potential
/// dangling type pointers due to type refinement on llvm side.
- llvm::DenseMap<Type *, llvm::PATypeHolder *> TypeHolderMap;
+ llvm::DenseMap<Type *, llvm::PATypeHolder> TypeHolderMap;
/// ConvertNewType - Convert type T into a llvm::Type. Do not use this
/// method directly because it does not do any type caching. This method
More information about the cfe-commits
mailing list