aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-30 23:25:33 +0000
committerChris Lattner <sabre@nondot.org>2008-03-30 23:25:33 +0000
commitce5605ecf76d8cde6372138f830bb144d174ced9 (patch)
treef3aa9a95602ec48d6fa560d2c4c1599d543a9ed6 /lib/CodeGen/CodeGenTypes.cpp
parent391d77a26382dddf25da73e29fc1fa5aaaea4c6f (diff)
some cleanups on top of David's patch. There are still two
remaining open issues I've communicated to him: 1) self can be assigned to, and his patch didn't handle it correctly. 2) CollectObjCIvarTypes is N^2 (because each subclass reprocesses all parent class ivars) and flattens classes. If A derives from B, and both have an int, I'd expect to get { {i32}, i32}, not { i32, i32}. David, please review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenTypes.cpp')
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index afa20e4110..a16543eebe 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -148,16 +148,14 @@ void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
/// Objective-C object, in the order that they appear. Used to create LLVM
/// structures corresponding to Objective-C objects.
void CodeGenTypes::CollectObjCIvarTypes(ObjCInterfaceDecl *ObjCClass,
- std::vector<const llvm::Type*> &IvarTypes) {
+ std::vector<const llvm::Type*> &IvarTypes) {
ObjCInterfaceDecl *SuperClass = ObjCClass->getSuperClass();
- if(SuperClass) {
+ if (SuperClass)
CollectObjCIvarTypes(SuperClass, IvarTypes);
- }
- for(ObjCInterfaceDecl::ivar_iterator ivar=ObjCClass->ivar_begin() ;
- ivar != ObjCClass->ivar_end() ;
- ivar++) {
- IvarTypes.push_back(ConvertType((*ivar)->getType()));
- ObjCIvarInfo[*ivar] = IvarTypes.size() - 1;
+ for (ObjCInterfaceDecl::ivar_iterator I = ObjCClass->ivar_begin(),
+ E = ObjCClass->ivar_end(); I != E; ++I) {
+ IvarTypes.push_back(ConvertType((*I)->getType()));
+ ObjCIvarInfo[*I] = IvarTypes.size() - 1;
}
}
@@ -420,8 +418,7 @@ const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
/// getLLVMFieldNo - Return llvm::StructType element number
/// that corresponds to the field FD.
unsigned CodeGenTypes::getLLVMFieldNo(const FieldDecl *FD) {
- llvm::DenseMap<const FieldDecl *, unsigned>::iterator
- I = FieldInfo.find(FD);
+ llvm::DenseMap<const FieldDecl*, unsigned>::iterator I = FieldInfo.find(FD);
assert (I != FieldInfo.end() && "Unable to find field info");
return I->second;
}
@@ -429,7 +426,7 @@ unsigned CodeGenTypes::getLLVMFieldNo(const FieldDecl *FD) {
unsigned CodeGenTypes::getLLVMFieldNo(const ObjCIvarDecl *OID) {
llvm::DenseMap<const ObjCIvarDecl*, unsigned>::iterator
I = ObjCIvarInfo.find(OID);
- assert (I != ObjCIvarInfo.end() && "Unable to find field info");
+ assert(I != ObjCIvarInfo.end() && "Unable to find field info");
return I->second;
}