Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-04-02 18:29:09 +00:00
Родитель 2f59979a7c
Коммит a19331f156
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -5740,17 +5740,15 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility) Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility)
: ObjCIvarDecl::None; : ObjCIvarDecl::None;
// Must set ivar's DeclContext to its enclosing interface. // Must set ivar's DeclContext to its enclosing interface.
Decl *EnclosingDecl = IntfDecl.getAs<Decl>(); ObjCContainerDecl *EnclosingDecl = IntfDecl.getAs<ObjCContainerDecl>();
DeclContext *EnclosingContext; ObjCContainerDecl *EnclosingContext;
if (ObjCImplementationDecl *IMPDecl = if (ObjCImplementationDecl *IMPDecl =
dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) { dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
// Case of ivar declared in an implementation. Context is that of its class. // Case of ivar declared in an implementation. Context is that of its class.
ObjCInterfaceDecl* IDecl = IMPDecl->getClassInterface(); EnclosingContext = IMPDecl->getClassInterface();
assert(IDecl && "No class- ActOnIvar"); assert(EnclosingContext && "Implementation has no class interface!");
EnclosingContext = cast_or_null<DeclContext>(IDecl);
} else } else
EnclosingContext = dyn_cast<DeclContext>(EnclosingDecl); EnclosingContext = EnclosingDecl;
assert(EnclosingContext && "null DeclContext for ivar - ActOnIvar");
// Construct the decl. // Construct the decl.
ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context,