diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-21 19:08:31 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-21 19:08:31 +0000 |
commit | c12eb40f6c6eca83e99bc20f6813dc32e3e68831 (patch) | |
tree | 5f6a5692b259139651a6fbaeb9490d6943beca67 | |
parent | fd456e42ad4108bc4feb14ba37a5c0cb267744a2 (diff) | |
download | clang-c12eb40f6c6eca83e99bc20f6813dc32e3e68831.tar.gz |
SemaTemplateDeduction - 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@375443 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 16d5afbd87..64ef819e30 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -3826,8 +3826,7 @@ Sema::TemplateDeductionResult Sema::DeduceTemplateArguments( if (Args.size() < Function->getMinRequiredArguments() && !PartialOverloading) return TDK_TooFewArguments; else if (TooManyArguments(NumParams, Args.size(), PartialOverloading)) { - const FunctionProtoType *Proto - = Function->getType()->getAs<FunctionProtoType>(); + const auto *Proto = Function->getType()->castAs<FunctionProtoType>(); if (Proto->isTemplateVariadic()) /* Do nothing */; else if (!Proto->isVariadic()) @@ -3965,11 +3964,8 @@ QualType Sema::adjustCCAndNoReturn(QualType ArgFunctionType, if (ArgFunctionType.isNull()) return ArgFunctionType; - const FunctionProtoType *FunctionTypeP = - FunctionType->castAs<FunctionProtoType>(); - const FunctionProtoType *ArgFunctionTypeP = - ArgFunctionType->getAs<FunctionProtoType>(); - + const auto *FunctionTypeP = FunctionType->castAs<FunctionProtoType>(); + const auto *ArgFunctionTypeP = ArgFunctionType->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = ArgFunctionTypeP->getExtProtoInfo(); bool Rebuild = false; |