Author: Simon Pilgrim
Date: 2022-02-12T10:57:09Z
New Revision: ed5d659038362d6ccfebad3d9b7e10e73e681196

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

LOG: [clang-tidy] NoexceptMoveConstructorCheck::check - use castAs<> instead of 
getAs<> to avoid dereference of nullptr

The pointer is referenced immediately, so assert the cast is correct instead of 
returning nullptr

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp

Removed: 
    


################################################################################
diff  --git 
a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
index f87f214945fa2..782498bd69e9a 100644
--- a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
@@ -38,7 +38,7 @@ void NoexceptMoveConstructorCheck::check(
       return;
     }
 
-    const auto *ProtoType = Decl->getType()->getAs<FunctionProtoType>();
+    const auto *ProtoType = Decl->getType()->castAs<FunctionProtoType>();
 
     if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
       return;


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

Reply via email to