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 | 031d4d40d0a185ce84ae46fb2f5cbe297513a7a7 (patch) | |
| tree | ad18db04be9f87f59bdc662ffea666a838d9c5d8 /clang/lib | |
| parent | ecb20c12a26bb574a9e3f01e6fb306dddc8ac0b9 (diff) | |
| download | bcm5719-llvm-031d4d40d0a185ce84ae46fb2f5cbe297513a7a7.tar.gz bcm5719-llvm-031d4d40d0a185ce84ae46fb2f5cbe297513a7a7.zip  | |
CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
llvm-svn: 100188
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 883ed98511e..d799162fa43 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/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;  | 

