Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 2edf3bd..f3021dc 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -160,17 +160,17 @@
/// isEmptyRecord - Return true iff a structure has no non-empty
/// members. Note that a structure with a flexible array member is not
/// considered empty.
-static bool isEmptyRecord(QualType T) {
+static bool isEmptyRecord(ASTContext &Context, QualType T) {
const RecordType *RT = T->getAsRecordType();
if (!RT)
return 0;
const RecordDecl *RD = RT->getDecl();
if (RD->hasFlexibleArrayMember())
return false;
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(Context),
+ e = RD->field_end(Context); i != e; ++i) {
const FieldDecl *FD = *i;
- if (!isEmptyRecord(FD->getType()))
+ if (!isEmptyRecord(Context, FD->getType()))
return false;
}
return true;
@@ -194,8 +194,8 @@
return 0;
const Type *Found = 0;
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(Context),
+ e = RD->field_end(Context); i != e; ++i) {
const FieldDecl *FD = *i;
QualType FT = FD->getType();
@@ -204,7 +204,7 @@
if (AT->getSize().getZExtValue() == 1)
FT = AT->getElementType();
- if (isEmptyRecord(FT)) {
+ if (isEmptyRecord(Context, FT)) {
// Ignore
} else if (Found) {
return 0;
@@ -230,8 +230,8 @@
static bool areAllFields32Or64BitBasicType(const RecordDecl *RD,
ASTContext &Context) {
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(Context),
+ e = RD->field_end(Context); i != e; ++i) {
const FieldDecl *FD = *i;
if (!is32Or64BitBasicType(FD->getType(), Context))
@@ -273,6 +273,7 @@
/// X86_32ABIInfo - The X86-32 ABI information.
class X86_32ABIInfo : public ABIInfo {
+ ASTContext &Context;
bool IsDarwin;
static bool isRegisterSize(unsigned Size) {
@@ -298,7 +299,8 @@
virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
CodeGenFunction &CGF) const;
- X86_32ABIInfo(bool d) : ABIInfo(), IsDarwin(d) {}
+ X86_32ABIInfo(ASTContext &Context, bool d)
+ : ABIInfo(), Context(Context), IsDarwin(d) {}
};
}
@@ -336,8 +338,8 @@
// Structure types are passed in register if all fields would be
// passed in a register.
- for (RecordDecl::field_iterator i = RT->getDecl()->field_begin(),
- e = RT->getDecl()->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RT->getDecl()->field_begin(Context),
+ e = RT->getDecl()->field_end(Context); i != e; ++i) {
const FieldDecl *FD = *i;
// FIXME: Reject bitfields wholesale for now; this is incorrect.
@@ -345,7 +347,7 @@
return false;
// Empty structures are ignored.
- if (isEmptyRecord(FD->getType()))
+ if (isEmptyRecord(Context, FD->getType()))
continue;
// Check fields recursively.
@@ -756,8 +758,8 @@
// Reset Lo class, this will be recomputed.
Current = NoClass;
unsigned idx = 0;
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i, ++idx) {
+ for (RecordDecl::field_iterator i = RD->field_begin(Context),
+ e = RD->field_end(Context); i != e; ++i, ++idx) {
uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
bool BitField = i->isBitField();
@@ -1391,7 +1393,7 @@
bool IsDarwin = strstr(getContext().Target.getTargetTriple(), "darwin");
switch (getContext().Target.getPointerWidth(0)) {
case 32:
- return *(TheABIInfo = new X86_32ABIInfo(IsDarwin));
+ return *(TheABIInfo = new X86_32ABIInfo(Context, IsDarwin));
case 64:
return *(TheABIInfo = new X86_64ABIInfo());
}
@@ -1424,8 +1426,8 @@
assert(!RD->hasFlexibleArrayMember() &&
"Cannot expand structure with flexible array.");
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(Context),
+ e = RD->field_end(Context); i != e; ++i) {
const FieldDecl *FD = *i;
assert(!FD->isBitField() &&
"Cannot expand structure with bit-field members.");
@@ -1449,8 +1451,8 @@
assert(LV.isSimple() &&
"Unexpected non-simple lvalue during struct expansion.");
llvm::Value *Addr = LV.getAddress();
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(getContext()),
+ e = RD->field_end(getContext()); i != e; ++i) {
FieldDecl *FD = *i;
QualType FT = FD->getType();
@@ -1476,8 +1478,8 @@
RecordDecl *RD = RT->getDecl();
assert(RV.isAggregate() && "Unexpected rvalue during struct expansion");
llvm::Value *Addr = RV.getAggregateAddr();
- for (RecordDecl::field_iterator i = RD->field_begin(),
- e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator i = RD->field_begin(getContext()),
+ e = RD->field_end(getContext()); i != e; ++i) {
FieldDecl *FD = *i;
QualType FT = FD->getType();
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 0d13299..f2fc90c 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -269,8 +269,8 @@
const ASTRecordLayout &RL = M->getContext().getASTRecordLayout(Decl);
unsigned FieldNo = 0;
- for (RecordDecl::field_iterator I = Decl->field_begin(),
- E = Decl->field_end();
+ for (RecordDecl::field_iterator I = Decl->field_begin(M->getContext()),
+ E = Decl->field_end(M->getContext());
I != E; ++I, ++FieldNo) {
FieldDecl *Field = *I;
llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit);
@@ -450,8 +450,9 @@
llvm::SmallVector<llvm::DIDescriptor, 32> Enumerators;
// Create DIEnumerator elements for each enumerator.
- for (EnumDecl::enumerator_iterator Enum = Decl->enumerator_begin(),
- EnumEnd = Decl->enumerator_end();
+ for (EnumDecl::enumerator_iterator
+ Enum = Decl->enumerator_begin(M->getContext()),
+ EnumEnd = Decl->enumerator_end(M->getContext());
Enum != EnumEnd; ++Enum) {
Enumerators.push_back(DebugFactory.CreateEnumerator(Enum->getNameAsString(),
Enum->getInitVal().getZExtValue()));
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 095e224..3b1580c 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -133,7 +133,9 @@
// GCC union extension
if (E->getType()->isUnionType()) {
RecordDecl *SD = E->getType()->getAsRecordType()->getDecl();
- LValue FieldLoc = CGF.EmitLValueForField(DestPtr, *SD->field_begin(), true, 0);
+ LValue FieldLoc = CGF.EmitLValueForField(DestPtr,
+ *SD->field_begin(CGF.getContext()),
+ true, 0);
EmitInitializationToLValue(E->getSubExpr(), FieldLoc);
return;
}
@@ -398,8 +400,8 @@
#ifndef NDEBUG
// Make sure that it's really an empty and not a failure of
// semantic analysis.
- for (RecordDecl::field_iterator Field = SD->field_begin(),
- FieldEnd = SD->field_end();
+ for (RecordDecl::field_iterator Field = SD->field_begin(CGF.getContext()),
+ FieldEnd = SD->field_end(CGF.getContext());
Field != FieldEnd; ++Field)
assert(Field->isUnnamedBitfield() && "Only unnamed bitfields allowed");
#endif
@@ -423,8 +425,8 @@
// Here we iterate over the fields; this makes it simpler to both
// default-initialize fields and skip over unnamed fields.
- for (RecordDecl::field_iterator Field = SD->field_begin(),
- FieldEnd = SD->field_end();
+ for (RecordDecl::field_iterator Field = SD->field_begin(CGF.getContext()),
+ FieldEnd = SD->field_end(CGF.getContext());
Field != FieldEnd; ++Field) {
// We're done once we hit the flexible array member
if (Field->getType()->isIncompleteArrayType())
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 35b3a37..c5f2202 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -196,8 +196,8 @@
unsigned EltNo = 0; // Element no in ILE
int FieldNo = 0; // Field no in RecordDecl
bool RewriteType = false;
- for (RecordDecl::field_iterator Field = RD->field_begin(),
- FieldEnd = RD->field_end();
+ for (RecordDecl::field_iterator Field = RD->field_begin(CGM.getContext()),
+ FieldEnd = RD->field_end(CGM.getContext());
EltNo < ILE->getNumInits() && Field != FieldEnd; ++Field) {
FieldNo++;
if (!Field->getIdentifier())
@@ -267,8 +267,8 @@
// Make sure that it's really an empty and not a failure of
// semantic analysis.
RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl();
- for (RecordDecl::field_iterator Field = RD->field_begin(),
- FieldEnd = RD->field_end();
+ for (RecordDecl::field_iterator Field = RD->field_begin(CGM.getContext()),
+ FieldEnd = RD->field_end(CGM.getContext());
Field != FieldEnd; ++Field)
assert(Field->isUnnamedBitfield() && "Only unnamed bitfields allowed");
#endif
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index fc77c80..cd94290 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -618,8 +618,8 @@
Protocols.push_back((*PI)->getNameAsString());
llvm::SmallVector<llvm::Constant*, 16> InstanceMethodNames;
llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes;
- for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(),
- E = PD->instmeth_end(); iter != E; iter++) {
+ for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(Context),
+ E = PD->instmeth_end(Context); iter != E; iter++) {
std::string TypeStr;
Context.getObjCEncodingForMethodDecl(*iter, TypeStr);
InstanceMethodNames.push_back(
@@ -629,8 +629,9 @@
// Collect information about class methods:
llvm::SmallVector<llvm::Constant*, 16> ClassMethodNames;
llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes;
- for (ObjCProtocolDecl::classmeth_iterator iter = PD->classmeth_begin(),
- endIter = PD->classmeth_end() ; iter != endIter ; iter++) {
+ for (ObjCProtocolDecl::classmeth_iterator
+ iter = PD->classmeth_begin(Context),
+ endIter = PD->classmeth_end(Context) ; iter != endIter ; iter++) {
std::string TypeStr;
Context.getObjCEncodingForMethodDecl((*iter),TypeStr);
ClassMethodNames.push_back(
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 116d8b0..a06959f 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1100,8 +1100,9 @@
// Construct method lists.
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
std::vector<llvm::Constant*> OptInstanceMethods, OptClassMethods;
- for (ObjCProtocolDecl::instmeth_iterator i = PD->instmeth_begin(),
- e = PD->instmeth_end(); i != e; ++i) {
+ for (ObjCProtocolDecl::instmeth_iterator
+ i = PD->instmeth_begin(CGM.getContext()),
+ e = PD->instmeth_end(CGM.getContext()); i != e; ++i) {
ObjCMethodDecl *MD = *i;
llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
@@ -1111,8 +1112,9 @@
}
}
- for (ObjCProtocolDecl::classmeth_iterator i = PD->classmeth_begin(),
- e = PD->classmeth_end(); i != e; ++i) {
+ for (ObjCProtocolDecl::classmeth_iterator
+ i = PD->classmeth_begin(CGM.getContext()),
+ e = PD->classmeth_end(CGM.getContext()); i != e; ++i) {
ObjCMethodDecl *MD = *i;
llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
@@ -1286,8 +1288,8 @@
const ObjCContainerDecl *OCD,
const ObjCCommonTypesHelper &ObjCTypes) {
std::vector<llvm::Constant*> Properties, Prop(2);
- for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(),
- E = OCD->prop_end(); I != E; ++I) {
+ for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(CGM.getContext()),
+ E = OCD->prop_end(CGM.getContext()); I != E; ++I) {
const ObjCPropertyDecl *PD = *I;
Prop[0] = GetPropertyName(PD->getIdentifier());
Prop[1] = GetPropertyTypeString(PD, Container);
@@ -1691,19 +1693,20 @@
/// countInheritedIvars - count number of ivars in class and its super class(s)
///
-static int countInheritedIvars(const ObjCInterfaceDecl *OI) {
+static int countInheritedIvars(const ObjCInterfaceDecl *OI,
+ ASTContext &Context) {
int count = 0;
if (!OI)
return 0;
const ObjCInterfaceDecl *SuperClass = OI->getSuperClass();
if (SuperClass)
- count += countInheritedIvars(SuperClass);
+ count += countInheritedIvars(SuperClass, Context);
for (ObjCInterfaceDecl::ivar_iterator I = OI->ivar_begin(),
E = OI->ivar_end(); I != E; ++I)
++count;
// look into properties.
- for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
- E = OI->prop_end(); I != E; ++I) {
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(Context),
+ E = OI->prop_end(Context); I != E; ++I) {
if ((*I)->getPropertyIvarDecl())
++count;
}
@@ -1719,7 +1722,8 @@
///
static const ObjCInterfaceDecl *getInterfaceDeclForIvar(
const ObjCInterfaceDecl *OI,
- const ObjCIvarDecl *IVD) {
+ const ObjCIvarDecl *IVD,
+ ASTContext &Context) {
if (!OI)
return 0;
assert(isa<ObjCInterfaceDecl>(OI) && "OI is not an interface");
@@ -1728,14 +1732,14 @@
if ((*I)->getIdentifier() == IVD->getIdentifier())
return OI;
// look into properties.
- for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
- E = OI->prop_end(); I != E; ++I) {
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(Context),
+ E = OI->prop_end(Context); I != E; ++I) {
ObjCPropertyDecl *PDecl = (*I);
if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl())
if (IV->getIdentifier() == IVD->getIdentifier())
return OI;
}
- return getInterfaceDeclForIvar(OI->getSuperClass(), IVD);
+ return getInterfaceDeclForIvar(OI->getSuperClass(), IVD, Context);
}
/*
@@ -1768,7 +1772,8 @@
RecordDecl::field_iterator ifield, pfield;
const RecordDecl *RD = GetFirstIvarInRecord(OID, ifield, pfield);
- for (RecordDecl::field_iterator e = RD->field_end(); ifield != e; ++ifield) {
+ for (RecordDecl::field_iterator e = RD->field_end(CGM.getContext());
+ ifield != e; ++ifield) {
FieldDecl *Field = *ifield;
uint64_t Offset = GetIvarBaseOffset(Layout, Field);
if (Field->getIdentifier())
@@ -2611,7 +2616,8 @@
const RecordType *RT = FQT->getAsRecordType();
const RecordDecl *RD = RT->getDecl();
// FIXME - Find a more efficiant way of passing records down.
- TmpRecFields.append(RD->field_begin(), RD->field_end());
+ TmpRecFields.append(RD->field_begin(CGM.getContext()),
+ RD->field_end(CGM.getContext()));
// FIXME - Is Layout correct?
BuildAggrIvarLayout(OI, Layout, RD, TmpRecFields,
BytePos + GetFieldBaseOffset(OI, Layout, Field),
@@ -2643,7 +2649,8 @@
const RecordType *RT = FQT->getAsRecordType();
const RecordDecl *RD = RT->getDecl();
// FIXME - Find a more efficiant way of passing records down.
- TmpRecFields.append(RD->field_begin(), RD->field_end());
+ TmpRecFields.append(RD->field_begin(CGM.getContext()),
+ RD->field_end(CGM.getContext()));
BuildAggrIvarLayout(OI, Layout, RD,
TmpRecFields,
@@ -3075,10 +3082,11 @@
const ObjCInterfaceDecl *OID,
RecordDecl::field_iterator &FIV,
RecordDecl::field_iterator &PIV) {
- int countSuperClassIvars = countInheritedIvars(OID->getSuperClass());
+ int countSuperClassIvars = countInheritedIvars(OID->getSuperClass(),
+ CGM.getContext());
const RecordDecl *RD = CGM.getContext().addRecordToClass(OID);
- RecordDecl::field_iterator ifield = RD->field_begin();
- RecordDecl::field_iterator pfield = RD->field_end();
+ RecordDecl::field_iterator ifield = RD->field_begin(CGM.getContext());
+ RecordDecl::field_iterator pfield = RD->field_end(CGM.getContext());
while (countSuperClassIvars-- > 0) {
pfield = ifield;
++ifield;
@@ -3194,10 +3202,10 @@
RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct, 0,
SourceLocation(),
&Ctx.Idents.get("_objc_super"));
- RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.getObjCIdType(), 0, false));
- RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.getObjCClassType(), 0, false));
+ RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.getObjCIdType(), 0, false));
+ RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.getObjCClassType(), 0, false));
RD->completeDefinition(Ctx);
SuperCTy = Ctx.getTagDeclType(RD);
@@ -3819,10 +3827,10 @@
RecordDecl *RD = RecordDecl::Create(Ctx, TagDecl::TK_struct, 0,
SourceLocation(),
&Ctx.Idents.get("_message_ref_t"));
- RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.VoidPtrTy, 0, false));
- RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
- Ctx.getObjCSelType(), 0, false));
+ RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.VoidPtrTy, 0, false));
+ RD->addDecl(Ctx, FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
+ Ctx.getObjCSelType(), 0, false));
RD->completeDefinition(Ctx);
MessageRefCTy = Ctx.getTagDeclType(RD);
@@ -4273,17 +4281,17 @@
RecordDecl::field_iterator firstField, lastField;
const RecordDecl *RD = GetFirstIvarInRecord(OID, firstField, lastField);
- for (RecordDecl::field_iterator e = RD->field_end(),
+ for (RecordDecl::field_iterator e = RD->field_end(CGM.getContext()),
ifield = firstField; ifield != e; ++ifield)
lastField = ifield;
- if (lastField != RD->field_end()) {
+ if (lastField != RD->field_end(CGM.getContext())) {
FieldDecl *Field = *lastField;
const llvm::Type *FieldTy =
CGM.getTypes().ConvertTypeForMem(Field->getType());
unsigned Size = CGM.getTargetData().getTypePaddedSize(FieldTy);
InstanceSize = GetIvarBaseOffset(Layout, Field) + Size;
- if (firstField == RD->field_end())
+ if (firstField == RD->field_end(CGM.getContext()))
InstanceStart = InstanceSize;
else {
Field = *firstField;
@@ -4495,8 +4503,8 @@
const ObjCInterfaceDecl *ID,
const ObjCIvarDecl *Ivar) {
Name += "\01_OBJC_IVAR_$_" +
- getInterfaceDeclForIvar(ID, Ivar)->getNameAsString() + '.'
- + Ivar->getNameAsString();
+ getInterfaceDeclForIvar(ID, Ivar, CGM.getContext())->getNameAsString() +
+ '.' + Ivar->getNameAsString();
llvm::GlobalVariable *IvarOffsetGV =
CGM.getModule().getGlobalVariable(Name);
if (!IvarOffsetGV)
@@ -4585,13 +4593,14 @@
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I)
OIvars.push_back(*I);
- for (ObjCInterfaceDecl::prop_iterator I = OID->prop_begin(),
- E = OID->prop_end(); I != E; ++I)
+ for (ObjCInterfaceDecl::prop_iterator I = OID->prop_begin(CGM.getContext()),
+ E = OID->prop_end(CGM.getContext()); I != E; ++I)
if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
OIvars.push_back(IV);
unsigned iv = 0;
- for (RecordDecl::field_iterator e = RD->field_end(); i != e; ++i) {
+ for (RecordDecl::field_iterator e = RD->field_end(CGM.getContext());
+ i != e; ++i) {
FieldDecl *Field = *i;
uint64_t offset = GetIvarBaseOffset(Layout, Field);
Ivar[0] = EmitIvarOffsetVar(ID->getClassInterface(), OIvars[iv++], offset);
@@ -4693,8 +4702,10 @@
// Construct method lists.
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
std::vector<llvm::Constant*> OptInstanceMethods, OptClassMethods;
- for (ObjCProtocolDecl::instmeth_iterator i = PD->instmeth_begin(),
- e = PD->instmeth_end(); i != e; ++i) {
+ for (ObjCProtocolDecl::instmeth_iterator
+ i = PD->instmeth_begin(CGM.getContext()),
+ e = PD->instmeth_end(CGM.getContext());
+ i != e; ++i) {
ObjCMethodDecl *MD = *i;
llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
@@ -4704,8 +4715,10 @@
}
}
- for (ObjCProtocolDecl::classmeth_iterator i = PD->classmeth_begin(),
- e = PD->classmeth_end(); i != e; ++i) {
+ for (ObjCProtocolDecl::classmeth_iterator
+ i = PD->classmeth_begin(CGM.getContext()),
+ e = PD->classmeth_end(CGM.getContext());
+ i != e; ++i) {
ObjCMethodDecl *MD = *i;
llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 2c1ab1f..eb190c7 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1102,7 +1102,7 @@
cast<llvm::StructType>(getTypes().ConvertType(CFTy));
std::vector<llvm::Constant*> Fields;
- RecordDecl::field_iterator Field = CFRD->field_begin();
+ RecordDecl::field_iterator Field = CFRD->field_begin(getContext());
// Class pointer.
FieldDecl *CurField = *Field++;
@@ -1297,7 +1297,8 @@
/// EmitNamespace - Emit all declarations in a namespace.
void CodeGenModule::EmitNamespace(const NamespaceDecl *ND) {
- for (RecordDecl::decl_iterator I = ND->decls_begin(), E = ND->decls_end();
+ for (RecordDecl::decl_iterator I = ND->decls_begin(getContext()),
+ E = ND->decls_end(getContext());
I != E; ++I)
EmitTopLevelDecl(*I);
}
@@ -1309,7 +1310,8 @@
return;
}
- for (RecordDecl::decl_iterator I = LSD->decls_begin(), E = LSD->decls_end();
+ for (RecordDecl::decl_iterator I = LSD->decls_begin(getContext()),
+ E = LSD->decls_end(getContext());
I != E; ++I)
EmitTopLevelDecl(*I);
}
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index e13a4bc..984e49e 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -482,7 +482,7 @@
} else if (TD->isUnion()) {
// Just use the largest element of the union, breaking ties with the
// highest aligned member.
- if (!RD->field_empty()) {
+ if (!RD->field_empty(getContext())) {
RecordOrganizer RO(*this, *RD);
RO.layoutUnionFields(Context.getASTRecordLayout(RD));
@@ -563,8 +563,8 @@
std::vector<const llvm::Type*> LLVMFields;
unsigned curField = 0;
- for (RecordDecl::field_iterator Field = RD.field_begin(),
- FieldEnd = RD.field_end();
+ for (RecordDecl::field_iterator Field = RD.field_begin(CGT.getContext()),
+ FieldEnd = RD.field_end(CGT.getContext());
Field != FieldEnd; ++Field) {
uint64_t offset = RL.getFieldOffset(curField);
const llvm::Type *Ty = CGT.ConvertTypeForMemRecursive(Field->getType());
@@ -614,8 +614,8 @@
/// all fields are added.
void RecordOrganizer::layoutUnionFields(const ASTRecordLayout &RL) {
unsigned curField = 0;
- for (RecordDecl::field_iterator Field = RD.field_begin(),
- FieldEnd = RD.field_end();
+ for (RecordDecl::field_iterator Field = RD.field_begin(CGT.getContext()),
+ FieldEnd = RD.field_end(CGT.getContext());
Field != FieldEnd; ++Field) {
// The offset should usually be zero, but bitfields could be strange
uint64_t offset = RL.getFieldOffset(curField);