forked from OSchip/llvm-project
[clang-tidy] checkOverridingFunctionReturnType - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointers are referenced immediately, so assert the cast is correct instead of returning nullptr
This commit is contained in:
parent
437d4e01fe
commit
389bee71ea
|
@ -40,11 +40,11 @@ static bool checkOverridingFunctionReturnType(const ASTContext *Context,
|
|||
const CXXMethodDecl *BaseMD,
|
||||
const CXXMethodDecl *DerivedMD) {
|
||||
QualType BaseReturnTy = BaseMD->getType()
|
||||
->getAs<FunctionType>()
|
||||
->castAs<FunctionType>()
|
||||
->getReturnType()
|
||||
.getCanonicalType();
|
||||
QualType DerivedReturnTy = DerivedMD->getType()
|
||||
->getAs<FunctionType>()
|
||||
->castAs<FunctionType>()
|
||||
->getReturnType()
|
||||
.getCanonicalType();
|
||||
|
||||
|
|
Loading…
Reference in New Issue