summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-02 18:29:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-02 18:29:09 +0000
commit229385cd68599e95a8180d90940992931623d0d1 (patch)
treeea87c7c6508a52062dc25e0b0977e5e0625bbd2b /clang/lib/Sema
parent45cf7e3d2a524e751c2d5c35f2761a8cfbc47fdd (diff)
downloadbcm5719-llvm-229385cd68599e95a8180d90940992931623d0d1.tar.gz
bcm5719-llvm-229385cd68599e95a8180d90940992931623d0d1.zip
Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow type.
llvm-svn: 100197
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f3d0dcff20c..541c27169a7 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5740,17 +5740,15 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
Visibility != tok::objc_not_keyword ? TranslateIvarVisibility(Visibility)
: ObjCIvarDecl::None;
// Must set ivar's DeclContext to its enclosing interface.
- Decl *EnclosingDecl = IntfDecl.getAs<Decl>();
- DeclContext *EnclosingContext;
+ ObjCContainerDecl *EnclosingDecl = IntfDecl.getAs<ObjCContainerDecl>();
+ ObjCContainerDecl *EnclosingContext;
if (ObjCImplementationDecl *IMPDecl =
dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
// Case of ivar declared in an implementation. Context is that of its class.
- ObjCInterfaceDecl* IDecl = IMPDecl->getClassInterface();
- assert(IDecl && "No class- ActOnIvar");
- EnclosingContext = cast_or_null<DeclContext>(IDecl);
+ EnclosingContext = IMPDecl->getClassInterface();
+ assert(EnclosingContext && "Implementation has no class interface!");
} else
- EnclosingContext = dyn_cast<DeclContext>(EnclosingDecl);
- assert(EnclosingContext && "null DeclContext for ivar - ActOnIvar");
+ EnclosingContext = EnclosingDecl;
// Construct the decl.
ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context,
OpenPOWER on IntegriCloud