diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-17 10:35:29 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-17 10:35:29 +0000 |
commit | 4219e20f04a9e809643977e66aa3ee0ef4e13504 (patch) | |
tree | 206053961963ed051a8fb4a23dd4167e8d8ecf4d | |
parent | 62e70af15a780dab29b1b47c5f0c25d58475cefe (diff) | |
download | clang-4219e20f04a9e809643977e66aa3ee0ef4e13504.tar.gz |
SemaDeclObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375097 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index a0fef8346c..db594bbd21 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -586,7 +586,7 @@ ActOnSuperClassOfClassInterface(Scope *S, dyn_cast_or_null<TypedefNameDecl>(PrevDecl)) { QualType T = TDecl->getUnderlyingType(); if (T->isObjCObjectType()) { - if (NamedDecl *IDecl = T->getAs<ObjCObjectType>()->getInterface()) { + if (NamedDecl *IDecl = T->castAs<ObjCObjectType>()->getInterface()) { SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl); SuperClassType = Context.getTypeDeclType(TDecl); @@ -1151,7 +1151,7 @@ Decl *Sema::ActOnCompatibilityAlias(SourceLocation AtLoc, dyn_cast_or_null<TypedefNameDecl>(CDeclU)) { QualType T = TDecl->getUnderlyingType(); if (T->isObjCObjectType()) { - if (NamedDecl *IDecl = T->getAs<ObjCObjectType>()->getInterface()) { + if (NamedDecl *IDecl = T->castAs<ObjCObjectType>()->getInterface()) { ClassName = IDecl->getIdentifier(); CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation, LookupOrdinaryName, @@ -4876,7 +4876,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T, } else if (!T->isObjCObjectPointerType()) { Invalid = true; Diag(IdLoc, diag::err_catch_param_not_objc_type); - } else if (!T->getAs<ObjCObjectPointerType>()->getInterfaceType()) { + } else if (!T->castAs<ObjCObjectPointerType>()->getInterfaceType()) { Invalid = true; Diag(IdLoc, diag::err_catch_param_not_objc_type); } |