forked from OSchip/llvm-project
[clang] Sema::CheckEquivalentExceptionSpec - remove useless nullptr test
We use castAs<> for NewProto/OldProto, which would assert if the cast failed.
This commit is contained in:
parent
32b73bc6ab
commit
5fe64d238b
|
@ -342,8 +342,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
|||
if (!MissingExceptionSpecification)
|
||||
return ReturnValueOnError;
|
||||
|
||||
const FunctionProtoType *NewProto =
|
||||
New->getType()->castAs<FunctionProtoType>();
|
||||
const auto *NewProto = New->getType()->castAs<FunctionProtoType>();
|
||||
|
||||
// The new function declaration is only missing an empty exception
|
||||
// specification "throw()". If the throw() specification came from a
|
||||
|
@ -353,7 +352,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
|||
// specifications.
|
||||
//
|
||||
// Likewise if the old function is a builtin.
|
||||
if (MissingEmptyExceptionSpecification && NewProto &&
|
||||
if (MissingEmptyExceptionSpecification &&
|
||||
(Old->getLocation().isInvalid() ||
|
||||
Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
|
||||
Old->getBuiltinID()) &&
|
||||
|
@ -364,8 +363,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
|||
return false;
|
||||
}
|
||||
|
||||
const FunctionProtoType *OldProto =
|
||||
Old->getType()->castAs<FunctionProtoType>();
|
||||
const auto *OldProto = Old->getType()->castAs<FunctionProtoType>();
|
||||
|
||||
FunctionProtoType::ExceptionSpecInfo ESI = OldProto->getExceptionSpecType();
|
||||
if (ESI.Type == EST_Dynamic) {
|
||||
|
|
Loading…
Reference in New Issue