[clang] 2e52f76 - [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 11 02:31:41 PST 2022
Author: Simon Pilgrim
Date: 2022-01-11T10:31:26Z
New Revision: 2e52f76a722aa3ae5d655e0f15972b4f73db0150
URL: https://github.com/llvm/llvm-project/commit/2e52f76a722aa3ae5d655e0f15972b4f73db0150
DIFF: https://github.com/llvm/llvm-project/commit/2e52f76a722aa3ae5d655e0f15972b4f73db0150.diff
LOG: [SemaOverload] compareConversionFunctions - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is dereferenced immediately below, so assert the cast is correct instead of returning nullptr
Added:
Modified:
clang/lib/Sema/SemaOverload.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 041fcee023a5..483247aaa7c5 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -3717,8 +3717,7 @@ compareConversionFunctions(Sema &S, FunctionDecl *Function1,
CallingConv Conv2CC = Conv2FuncRet->getCallConv();
CXXMethodDecl *CallOp = Conv2->getParent()->getLambdaCallOperator();
- const FunctionProtoType *CallOpProto =
- CallOp->getType()->getAs<FunctionProtoType>();
+ const auto *CallOpProto = CallOp->getType()->castAs<FunctionProtoType>();
CallingConv CallOpCC =
CallOp->getType()->castAs<FunctionType>()->getCallConv();
More information about the cfe-commits
mailing list