Author: Simon Pilgrim
Date: 2022-02-12T20:11:21Z
New Revision: abe1bb763e3a7ce197f310afbff6112eb605136f

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

LOG: [clang] MicrosoftCXXNameMangler::mangleObjCKindOfType - use castAs<> 
instead of getAs<> to avoid dereference of nullptr

The pointer is referenced in the mangleType call, so assert the cast is correct 
instead of returning nullptr

Added: 
    

Modified: 
    clang/lib/AST/MicrosoftMangle.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/MicrosoftMangle.cpp 
b/clang/lib/AST/MicrosoftMangle.cpp
index 8802b6e500a67..7329f163d12c9 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -1943,7 +1943,7 @@ void MicrosoftCXXNameMangler::mangleObjCKindOfType(const 
ObjCObjectType *T,
   Extra.mangleSourceName("KindOf");
   Extra.mangleType(QualType(T, 0)
                        .stripObjCKindOfType(getASTContext())
-                       ->getAs<ObjCObjectType>(),
+                       ->castAs<ObjCObjectType>(),
                    Quals, Range);
 
   mangleArtificialTagType(TTK_Struct, TemplateMangling, {"__ObjC"});


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

Reply via email to