Author: Manna, Soumi
Date: 2023-06-04T09:09:59-07:00
New Revision: c7550310738b27aec440e5d20cec7f0209d45721

URL: 
https://github.com/llvm/llvm-project/commit/c7550310738b27aec440e5d20cec7f0209d45721
DIFF: 
https://github.com/llvm/llvm-project/commit/c7550310738b27aec440e5d20cec7f0209d45721.diff

LOG: [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

Added: 
    

Modified: 
    clang/lib/CodeGen/CGDebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 2857ea20ba1d8..edef27bdf377c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3307,7 +3307,7 @@ llvm::DIType *CGDebugInfo::CreateType(const 
MemberPointerType *Ty,
         Flags);
 
   const FunctionProtoType *FPT =
-      Ty->getPointeeType()->getAs<FunctionProtoType>();
+      Ty->getPointeeType()->castAs<FunctionProtoType>();
   return DBuilder.createMemberPointerType(
       getOrCreateInstanceMethodType(
           CXXMethodDecl::getThisType(FPT, Ty->getMostRecentCXXRecordDecl()),


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to