From 10e761fa76b43089354d4250e6e675b961524650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Bolvansk=C3=BD?= Date: Sat, 2 Nov 2019 20:14:29 +0100 Subject: [PATCH] [LegacyPassManager] Fixed "null check after derefencing" warning The 'RequiredPass' pointer was utilized before it was verified against nullptr. Check lines: 1626, 1629. --- lib/IR/LegacyPassManager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp index 8f32f275801..8fe59912f20 100644 --- a/lib/IR/LegacyPassManager.cpp +++ b/lib/IR/LegacyPassManager.cpp @@ -1626,13 +1626,12 @@ MPPassManager::runOnModule(Module &M) { /// RequiredPass is run on the fly by Pass Manager when P requests it /// through getAnalysis interface. void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { + assert(RequiredPass && "No required pass?"); assert(P->getPotentialPassManagerType() == PMT_ModulePassManager && "Unable to handle Pass that requires lower level Analysis pass"); assert((P->getPotentialPassManagerType() < RequiredPass->getPotentialPassManagerType()) && "Unable to handle Pass that requires lower level Analysis pass"); - if (!RequiredPass) - return; FunctionPassManagerImpl *FPP = OnTheFlyManagers[P]; if (!FPP) {