summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-21 00:41:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-21 00:41:40 +0000
commite03f005d30cb03f5154c5ba7fa6f6283b03ed424 (patch)
treeaa43af8894216311b578b002c2cbb45a6c95eb8a
parent712e4dee265e348083175f6361aa9fffebb4c4d3 (diff)
downloadbcm5719-llvm-e03f005d30cb03f5154c5ba7fa6f6283b03ed424.tar.gz
bcm5719-llvm-e03f005d30cb03f5154c5ba7fa6f6283b03ed424.zip
Assert on a few conditions that (I believe) should hold
w.r.t. ASTContext::[gs]etFieldDecl, and the Field argument to EmitObjCValueForIvar). llvm-svn: 69639
-rw-r--r--clang/lib/AST/ASTContext.cpp2
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp1
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp2
3 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 48d9fe4ea9b..e266774ddef 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -18,6 +18,7 @@
#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"
@@ -684,6 +685,7 @@ const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) {
void ASTContext::setFieldDecl(const ObjCInterfaceDecl *OI,
const ObjCIvarDecl *Ivar,
const ObjCIvarRefExpr *MRef) {
+ assert(MRef->getDecl() == Ivar);
ASTFieldForIvarRef[MRef] = OI->lookupFieldDeclForIvar(*this, Ivar);
}
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 2bbb15f0174..b5cd36061f7 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1086,6 +1086,7 @@ LValue CGObjCGNU::EmitObjCValueForIvar(CodeGen::CodeGenFunction &CGF,
const ObjCIvarDecl *Ivar,
const FieldDecl *Field,
unsigned CVRQualifiers) {
+ assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
if (Ivar->isBitField())
return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
CVRQualifiers);
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index d1623075d59..3b5e0c55047 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -2368,6 +2368,7 @@ LValue CGObjCMac::EmitObjCValueForIvar(CodeGen::CodeGenFunction &CGF,
const ObjCIvarDecl *Ivar,
const FieldDecl *Field,
unsigned CVRQualifiers) {
+ assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
if (Ivar->isBitField())
return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
CVRQualifiers);
@@ -4888,6 +4889,7 @@ LValue CGObjCNonFragileABIMac::EmitObjCValueForIvar(
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();
OpenPOWER on IntegriCloud