[clang] 6d56823 - SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 03:39:04 PST 2020
Author: Simon Pilgrim
Date: 2020-11-25T11:38:29Z
New Revision: 6d56823116820962984cdd535cbed1191be696c9
URL: https://github.com/llvm/llvm-project/commit/6d56823116820962984cdd535cbed1191be696c9
DIFF: https://github.com/llvm/llvm-project/commit/6d56823116820962984cdd535cbed1191be696c9.diff
LOG: SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.
castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately.
Added:
Modified:
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5580cdf136914..859caed8fd866 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -15166,10 +15166,10 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
CurBlock->TheDecl->setSignatureAsWritten(Sig);
CurBlock->FunctionType = T;
- const FunctionType *Fn = T->getAs<FunctionType>();
+ const auto *Fn = T->castAs<FunctionType>();
QualType RetTy = Fn->getReturnType();
bool isVariadic =
- (isa<FunctionProtoType>(Fn) && cast<FunctionProtoType>(Fn)->isVariadic());
+ (isa<FunctionProtoType>(Fn) && cast<FunctionProtoType>(Fn)->isVariadic());
CurBlock->TheDecl->setIsVariadic(isVariadic);
More information about the cfe-commits
mailing list