[cfe-commits] r100188 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Daniel Dunbar
daniel at zuster.org
Fri Apr 2 08:43:29 PDT 2010
Author: ddunbar
Date: Fri Apr 2 10:43:29 2010
New Revision: 100188
URL: http://llvm.org/viewvc/llvm-project?rev=100188&view=rev
Log:
CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=100188&r1=100187&r2=100188&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Apr 2 10:43:29 2010
@@ -78,6 +78,19 @@
FindIvarInterface(CGM.getContext(), OID, Ivar, Index);
assert(Container && "Unable to find ivar container");
+ // Check that the Obj-C decl contexts match what we expect.
+ const ObjCContainerDecl *DC = cast<ObjCContainerDecl>(Ivar->getDeclContext());
+ assert(isa<ObjCInterfaceDecl>(DC) || isa<ObjCImplDecl>(DC) ||
+ isa<ObjCCategoryDecl>(DC));
+ if (isa<ObjCImplDecl>(DC)) {
+ assert(DC == ID);
+ assert(Container == cast<ObjCImplDecl>(DC)->getClassInterface());
+ } else if (isa<ObjCCategoryDecl>(DC)) {
+ assert(Container == cast<ObjCCategoryDecl>(DC)->getClassInterface());
+ } else {
+ assert(Container == DC);
+ }
+
// If we know have an implementation (and the ivar is in it) then
// look up in the implementation layout.
const ASTRecordLayout *RL;
More information about the cfe-commits
mailing list