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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61994 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index fe61001..489c67b 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -43,7 +43,7 @@
// 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/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index a9b01aa..a57ee1d 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -205,7 +205,7 @@
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 @@
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 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 @@
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/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 3fdfb5e..da1966f 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -938,7 +938,7 @@
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/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 873f21e..218886f 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -2143,7 +2143,7 @@
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/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 47e41e9..760e381 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -455,8 +455,8 @@
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 @@
/// 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);