[llvm] r372720 - lowerObjCCall - silence static analyzer dyn_cast<CallInst> null dereference warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 03:46:31 PDT 2019


Author: rksimon
Date: Tue Sep 24 03:46:30 2019
New Revision: 372720

URL: http://llvm.org/viewvc/llvm-project?rev=372720&view=rev
Log:
lowerObjCCall - silence static analyzer dyn_cast<CallInst> null dereference warnings. NFCI.

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

Modified:
    llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp

Modified: llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp?rev=372720&r1=372719&r2=372720&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp Tue Sep 24 03:46:30 2019
@@ -76,7 +76,7 @@ static bool lowerObjCCall(Function &F, c
   }
 
   for (auto I = F.use_begin(), E = F.use_end(); I != E;) {
-    auto *CI = dyn_cast<CallInst>(I->getUser());
+    auto *CI = cast<CallInst>(I->getUser());
     assert(CI->getCalledFunction() && "Cannot lower an indirect call!");
     ++I;
 




More information about the llvm-commits mailing list