[cfe-commits] r69648 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGObjC.cpp lib/CodeGen/CGObjCGNU.cpp lib/CodeGen/CGObjCMac.cpp lib/CodeGen/CGObjCRuntime.h lib/CodeGen/CodeGenFunction.h lib/Sema/SemaExpr.cpp
Daniel Dunbar
daniel at zuster.org
Mon Apr 20 18:19:29 PDT 2009
Author: ddunbar
Date: Mon Apr 20 20:19:28 2009
New Revision: 69648
URL: http://llvm.org/viewvc/llvm-project?rev=69648&view=rev
Log:
Kill ASTContext::[gs]etFieldForDecl, instead we just lookup things
when we need them -- which is exactly what some code was already
doing!
- No intended functionality change.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGObjCRuntime.h
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Apr 20 20:19:28 2009
@@ -102,7 +102,6 @@
// FIXME: ASTRecordForInterface/ASTFieldForIvarRef and addRecordToClass and
// getFieldDecl be part of the backend (i.e. CodeGenTypes)?
llvm::DenseMap<const ObjCInterfaceDecl*, RecordDecl*> ASTRecordForInterface;
- llvm::DenseMap<const ObjCIvarRefExpr*, const FieldDecl*> ASTFieldForIvarRef;
/// BuiltinVaListType - built-in va list type.
/// This is initially null and set by Sema::LazilyCreateBuiltin when
@@ -507,15 +506,7 @@
const RecordDecl *addRecordToClass(const ObjCInterfaceDecl *D);
void CollectObjCIvars(const ObjCInterfaceDecl *OI,
llvm::SmallVectorImpl<FieldDecl*> &Fields);
- const FieldDecl *getFieldDecl(const ObjCIvarRefExpr *MRef) {
- llvm::DenseMap<const ObjCIvarRefExpr *, const FieldDecl*>::iterator I
- = ASTFieldForIvarRef.find(MRef);
- assert (I != ASTFieldForIvarRef.end() && "Unable to find field_decl");
- return I->second;
- }
- void setFieldDecl(const ObjCInterfaceDecl *OI,
- const ObjCIvarDecl *Ivar,
- const ObjCIvarRefExpr *MRef);
+
//===--------------------------------------------------------------------===//
// Type Operators
//===--------------------------------------------------------------------===//
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Apr 20 20:19:28 2009
@@ -18,7 +18,6 @@
#include "clang/AST/Expr.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/RecordLayout.h"
-#include "clang/AST/ExprObjC.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/StringExtras.h"
@@ -680,15 +679,6 @@
return RD;
}
-/// setFieldDecl - maps a field for the given Ivar reference node.
-//
-void ASTContext::setFieldDecl(const ObjCInterfaceDecl *OI,
- const ObjCIvarDecl *Ivar,
- const ObjCIvarRefExpr *MRef) {
- assert(MRef->getDecl() == Ivar);
- ASTFieldForIvarRef[MRef] = OI->lookupFieldDeclForIvar(*this, Ivar);
-}
-
/// getASTObjcInterfaceLayout - Get or compute information about the layout of
/// the specified Objective C, which indicates its size and ivar
/// position information.
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Apr 20 20:19:28 2009
@@ -1137,10 +1137,9 @@
LValue CodeGenFunction::EmitLValueForIvar(QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers) {
return CGM.getObjCRuntime().EmitObjCValueForIvar(*this, ObjectTy, BaseValue,
- Ivar, Field, CVRQualifiers);
+ Ivar, CVRQualifiers);
}
LValue CodeGenFunction::EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E) {
@@ -1162,8 +1161,7 @@
CVRQualifiers = ObjectTy.getCVRQualifiers();
}
- return EmitLValueForIvar(ObjectTy, BaseValue, E->getDecl(),
- getContext().getFieldDecl(E), CVRQualifiers);
+ return EmitLValueForIvar(ObjectTy, BaseValue, E->getDecl(), CVRQualifiers);
}
LValue
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Mon Apr 20 20:19:28 2009
@@ -195,10 +195,7 @@
Types.ConvertType(PD->getType())));
EmitReturnOfRValue(RV, PD->getType());
} else {
- const FieldDecl *Field =
- IMP->getClassInterface()->lookupFieldDeclForIvar(getContext(), Ivar);
- LValue LV = EmitLValueForIvar(TypeOfSelfObject(),
- LoadObjCSelf(), Ivar, Field, 0);
+ LValue LV = EmitLValueForIvar(TypeOfSelfObject(), LoadObjCSelf(), Ivar, 0);
if (hasAggregateLLVMType(Ivar->getType())) {
EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType());
}
@@ -290,7 +287,6 @@
ObjCInterfaceDecl *OI = IMP->getClassInterface();
ObjCIvarRefExpr IvarRef(Ivar, Ivar->getType(), Loc, &Base,
true, true);
- getContext().setFieldDecl(OI, Ivar, &IvarRef);
BinaryOperator Assign(&IvarRef, &Arg, BinaryOperator::Assign,
Ivar->getType(), Loc);
EmitStmt(&Assign);
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Apr 20 20:19:28 2009
@@ -146,7 +146,6 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers);
virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
ObjCInterfaceDecl *Interface,
@@ -1081,9 +1080,9 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers) {
- assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
+ const ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+ const FieldDecl *Field = ID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
if (Ivar->isBitField())
return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
CVRQualifiers);
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Apr 20 20:19:28 2009
@@ -701,7 +701,6 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers);
virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
ObjCInterfaceDecl *Interface,
@@ -891,7 +890,6 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers);
virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
ObjCInterfaceDecl *Interface,
@@ -2366,9 +2364,9 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers) {
- assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
+ const ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+ const FieldDecl *Field = ID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
if (Ivar->isBitField())
return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
CVRQualifiers);
@@ -4887,12 +4885,9 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers) {
- assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
- assert(ObjectTy->isObjCInterfaceType() &&
- "CGObjCNonFragileABIMac::EmitObjCValueForIvar");
- ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+ const ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+ const FieldDecl *Field = ID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
llvm::GlobalVariable *IvarOffsetGV = ObjCIvarOffsetVariable(ID, Ivar);
// (char *) BaseValue
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Mon Apr 20 20:19:28 2009
@@ -157,7 +157,6 @@
QualType ObjectTy,
llvm::Value *BaseValue,
const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers) = 0;
virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
ObjCInterfaceDecl *Interface,
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Apr 20 20:19:28 2009
@@ -629,7 +629,6 @@
bool isUnion, unsigned CVRQualifiers);
LValue EmitLValueForIvar(QualType ObjectTy,
llvm::Value* Base, const ObjCIvarDecl *Ivar,
- const FieldDecl *Field,
unsigned CVRQualifiers);
LValue EmitLValueForBitfield(llvm::Value* Base, FieldDecl* Field,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=69648&r1=69647&r2=69648&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Apr 20 20:19:28 2009
@@ -691,11 +691,10 @@
// this into Self->ivar, just return a BareIVarExpr or something.
IdentifierInfo &II = Context.Idents.get("self");
OwningExprResult SelfExpr = ActOnIdentifierExpr(S, Loc, II, false);
- ObjCIvarRefExpr *MRef = new (Context) ObjCIvarRefExpr(IV, IV->getType(),
- Loc, static_cast<Expr*>(SelfExpr.release()),
- true, true);
- Context.setFieldDecl(IFace, IV, MRef);
- return Owned(MRef);
+ return Owned(new (Context)
+ ObjCIvarRefExpr(IV, IV->getType(), Loc,
+ static_cast<Expr*>(SelfExpr.release()),
+ true, true));
}
}
}
@@ -1948,11 +1947,9 @@
Diag(MemberLoc, diag::error_protected_ivar_access) << IV->getDeclName();
}
- ObjCIvarRefExpr *MRef= new (Context) ObjCIvarRefExpr(IV, IV->getType(),
+ return Owned(new (Context) ObjCIvarRefExpr(IV, IV->getType(),
MemberLoc, BaseExpr,
- OpKind == tok::arrow);
- Context.setFieldDecl(IFTy->getDecl(), IV, MRef);
- return Owned(MRef);
+ OpKind == tok::arrow));
}
return ExprError(Diag(MemberLoc, diag::err_typecheck_member_reference_ivar)
<< IFTy->getDecl()->getDeclName() << &Member
More information about the cfe-commits
mailing list