[llvm] r375427 - CrossDSOCFI - silence static analyzer dyn_cast<> null dereference warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 10:15:25 PDT 2019


Author: rksimon
Date: Mon Oct 21 10:15:25 2019
New Revision: 375427

URL: http://llvm.org/viewvc/llvm-project?rev=375427&view=rev
Log:
CrossDSOCFI - silence static analyzer dyn_cast<> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

Modified:
    llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp

Modified: llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp?rev=375427&r1=375426&r2=375427&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp Mon Oct 21 10:15:25 2019
@@ -104,7 +104,7 @@ void CrossDSOCFI::buildCFICheck(Module &
   FunctionCallee C = M.getOrInsertFunction(
       "__cfi_check", Type::getVoidTy(Ctx), Type::getInt64Ty(Ctx),
       Type::getInt8PtrTy(Ctx), Type::getInt8PtrTy(Ctx));
-  Function *F = dyn_cast<Function>(C.getCallee());
+  Function *F = cast<Function>(C.getCallee());
   // Take over the existing function. The frontend emits a weak stub so that the
   // linker knows about the symbol; this pass replaces the function body.
   F->deleteBody();




More information about the llvm-commits mailing list