[cfe-commits] r69639 - in /cfe/trunk/lib: AST/ASTContext.cpp CodeGen/CGObjCGNU.cpp CodeGen/CGObjCMac.cpp

Daniel Dunbar daniel at zuster.org
Mon Apr 20 17:41:40 PDT 2009


Author: ddunbar
Date: Mon Apr 20 19:41:40 2009
New Revision: 69639

URL: http://llvm.org/viewvc/llvm-project?rev=69639&view=rev
Log:
Assert on a few conditions that (I believe) should hold
w.r.t. ASTContext::[gs]etFieldDecl, and the Field argument to
EmitObjCValueForIvar).

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=69639&r1=69638&r2=69639&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Apr 20 19:41:40 2009
@@ -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 @@
 void ASTContext::setFieldDecl(const ObjCInterfaceDecl *OI,
                               const ObjCIvarDecl *Ivar,
                               const ObjCIvarRefExpr *MRef) {
+  assert(MRef->getDecl() == Ivar);
   ASTFieldForIvarRef[MRef] = OI->lookupFieldDeclForIvar(*this, Ivar);
 }
 

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=69639&r1=69638&r2=69639&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Apr 20 19:41:40 2009
@@ -1086,6 +1086,7 @@
                                        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);

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=69639&r1=69638&r2=69639&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Apr 20 19:41:40 2009
@@ -2368,6 +2368,7 @@
                                        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 @@
                                              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();





More information about the cfe-commits mailing list