r373665 - OverloadCandidate::getNumParams - silence static analyzer getAs<FunctionProtoType> null dereference warning. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 3 14:27:03 PDT 2019
Author: rksimon
Date: Thu Oct 3 14:27:02 2019
New Revision: 373665
URL: http://llvm.org/viewvc/llvm-project?rev=373665&view=rev
Log:
OverloadCandidate::getNumParams - silence static analyzer getAs<FunctionProtoType> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us.
Also replaces an auto to make the type more obvious.
Modified:
cfe/trunk/include/clang/Sema/Overload.h
Modified: cfe/trunk/include/clang/Sema/Overload.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=373665&r1=373664&r2=373665&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Overload.h (original)
+++ cfe/trunk/include/clang/Sema/Overload.h Thu Oct 3 14:27:02 2019
@@ -826,10 +826,10 @@ class Sema;
unsigned getNumParams() const {
if (IsSurrogate) {
- auto STy = Surrogate->getConversionType();
+ QualType STy = Surrogate->getConversionType();
while (STy->isPointerType() || STy->isReferenceType())
STy = STy->getPointeeType();
- return STy->getAs<FunctionProtoType>()->getNumParams();
+ return STy->castAs<FunctionProtoType>()->getNumParams();
}
if (Function)
return Function->getNumParams();
More information about the cfe-commits
mailing list