Skip to content

Commit 54b2914

Browse files
committed
Fix "pointer is null" static analyzer warnings. NFCI.
Use castAs<> instead of getAs<> since the pointers are dereferenced immediately and castAs will perform the null assertion for us.
1 parent ada22c8 commit 54b2914

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/AST/VTableBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ static BaseOffset
270270
ComputeReturnAdjustmentBaseOffset(ASTContext &Context,
271271
const CXXMethodDecl *DerivedMD,
272272
const CXXMethodDecl *BaseMD) {
273-
const FunctionType *BaseFT = BaseMD->getType()->getAs<FunctionType>();
274-
const FunctionType *DerivedFT = DerivedMD->getType()->getAs<FunctionType>();
273+
const auto *BaseFT = BaseMD->getType()->castAs<FunctionType>();
274+
const auto *DerivedFT = DerivedMD->getType()->castAs<FunctionType>();
275275

276276
// Canonicalize the return types.
277277
CanQualType CanDerivedReturnType =

0 commit comments

Comments
 (0)