diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-09 17:18:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-09 17:18:27 +0000 |
commit | ffca3a21f10173ff7fa093fe54b799279e5f960f (patch) | |
tree | 5effae47663b04d346553051081f65d66c8792dd /clang/lib/CodeGen | |
parent | 93215eca9b4dbbb2554a0a4587c7ddc183fb2c3c (diff) | |
download | bcm5719-llvm-ffca3a21f10173ff7fa093fe54b799279e5f960f.tar.gz bcm5719-llvm-ffca3a21f10173ff7fa093fe54b799279e5f960f.zip |
Provide a new kind of iterator, the specific_decl_iterator, that
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.
llvm-svn: 61994
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 8 |
5 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index fe61001709e..489c67bc6b7 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -43,7 +43,7 @@ static void mangleDeclContextInternal(const DeclContext *D, std::string &S) // FIXME: This should really use GetNameForMethod from CGObjCMac. std::string Name; - Name += MD->isInstance() ? '-' : '+'; + Name += MD->isInstanceMethod() ? '-' : '+'; Name += '['; Name += MD->getClassInterface()->getNameAsString(); Name += ' '; diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index a9b01aad006..a57ee1de0d6 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -205,7 +205,7 @@ static bool isEmptyStruct(QualType T) { const RecordDecl *RD = RT->getDecl(); if (RD->hasFlexibleArrayMember()) return false; - for (RecordDecl::field_const_iterator i = RD->field_begin(), + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { const FieldDecl *FD = *i; if (!isEmptyStruct(FD->getType())) @@ -232,7 +232,7 @@ static const FieldDecl *isSingleElementStruct(QualType T) { return 0; const FieldDecl *Found = 0; - for (RecordDecl::field_const_iterator i = RD->field_begin(), + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { const FieldDecl *FD = *i; QualType FT = FD->getType(); @@ -263,7 +263,7 @@ static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) { static bool areAllFields32Or64BitBasicType(const RecordDecl *RD, ASTContext &Context) { - for (RecordDecl::field_const_iterator i = RD->field_begin(), + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { const FieldDecl *FD = *i; @@ -441,7 +441,7 @@ void CodeGenTypes::GetExpandedTypes(QualType Ty, assert(!RD->hasFlexibleArrayMember() && "Cannot expand structure with flexible array."); - for (RecordDecl::field_const_iterator i = RD->field_begin(), + for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { const FieldDecl *FD = *i; assert(!FD->isBitField() && diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 3fdfb5e197e..da1966f77c4 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -938,7 +938,7 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD) { std::string CategoryName = OCD ? OCD->getNameAsString() : ""; std::string ClassName = OMD->getClassInterface()->getNameAsString(); std::string MethodName = OMD->getSelector().getAsString(); - bool isClassMethod = !OMD->isInstance(); + bool isClassMethod = !OMD->isInstanceMethod(); const llvm::FunctionType *MethodTy = CGM.getTypes().GetFunctionType(CGFunctionInfo(OMD, CGM.getContext())); diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 873f21ebcb2..218886fec73 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2143,7 +2143,7 @@ llvm::Constant *CGObjCMac::GetPropertyTypeString(const ObjCPropertyDecl *PD, void CGObjCMac::GetNameForMethod(const ObjCMethodDecl *D, std::string &NameOut) { // FIXME: Find the mangling GCC uses. - NameOut = (D->isInstance() ? "-" : "+"); + NameOut = (D->isInstanceMethod() ? "-" : "+"); NameOut += '['; NameOut += D->getClassInterface()->getNameAsString(); NameOut += ' '; diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 47e41e97224..760e381603e 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -455,8 +455,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { std::vector<const llvm::Type*> LLVMFields; unsigned curField = 0; - for (RecordDecl::field_const_iterator Field = RD.field_begin(), - FieldEnd = RD.field_end(); + for (RecordDecl::field_iterator Field = RD.field_begin(), + FieldEnd = RD.field_end(); Field != FieldEnd; ++Field) { uint64_t offset = RL.getFieldOffset(curField); const llvm::Type *Ty = CGT.ConvertTypeRecursive(Field->getType()); @@ -506,8 +506,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) { /// all fields are added. void RecordOrganizer::layoutUnionFields(const ASTRecordLayout &RL) { unsigned curField = 0; - for (RecordDecl::field_const_iterator Field = RD.field_begin(), - FieldEnd = RD.field_end(); + for (RecordDecl::field_iterator Field = RD.field_begin(), + FieldEnd = RD.field_end(); Field != FieldEnd; ++Field) { // The offset should usually be zero, but bitfields could be strange uint64_t offset = RL.getFieldOffset(curField); |