diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-02 15:43:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-02 15:43:29 +0000 |
commit | 3a2c80fe4c1f9306b7b96241117730a29e73ea8c (patch) | |
tree | 7c84a6560949fe5a720ea6bde17efce388801c0c /lib/CodeGen | |
parent | bcc12fdaa7b3276b46c8e1349d5c99fd42d6a0a1 (diff) |
CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 883ed98511..d799162fa4 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -78,6 +78,19 @@ static uint64_t LookupFieldBitOffset(CodeGen::CodeGenModule &CGM, 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; |