Skip to content

Commit c755031

Browse files
committed
[NFC][CLANG] Fix Static Code Analyzer Concerns
This patch uses castAs instead of getAs which will assert if the type doesn't match to resolve dereference issue with nullptr FPT when calling getThisType() in clang::CodeGen::CGDebugInfo::CreateType(clang::MemberPointerType const *, llvm::DIFile *). Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D151947
1 parent 0702d4e commit c755031

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3307,7 +3307,7 @@ llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
33073307
Flags);
33083308

33093309
const FunctionProtoType *FPT =
3310-
Ty->getPointeeType()->getAs<FunctionProtoType>();
3310+
Ty->getPointeeType()->castAs<FunctionProtoType>();
33113311
return DBuilder.createMemberPointerType(
33123312
getOrCreateInstanceMethodType(
33133313
CXXMethodDecl::getThisType(FPT, Ty->getMostRecentCXXRecordDecl()),

0 commit comments

Comments
 (0)