[llvm] 19bfb6d - Fix "pointer is null" static analyzer warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 09:20:02 PST 2020


Author: Simon Pilgrim
Date: 2020-01-08T17:19:10Z
New Revision: 19bfb6d8df6c23c8c8d19af9221d12bf08244b51

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

LOG: Fix "pointer is null" static analyzer warning. NFCI.

Use cast<> instead of dyn_cast<> since we know that the pointer should be valid (and is dereferenced immediately below in the getSignature call).

Added: 
    

Modified: 
    llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index 6179b71c76ce..d1f3acbd221e 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -453,7 +453,7 @@ Function *WebAssemblyLowerEmscriptenEHSjLj::getInvokeWrapper(CallOrInvoke *CI) {
     CalleeFTy = F->getFunctionType();
   else {
     auto *CalleeTy = cast<PointerType>(Callee->getType())->getElementType();
-    CalleeFTy = dyn_cast<FunctionType>(CalleeTy);
+    CalleeFTy = cast<FunctionType>(CalleeTy);
   }
 
   std::string Sig = getSignature(CalleeFTy);


        


More information about the llvm-commits mailing list