From: Simon Pilgrim Date: Fri, 27 Sep 2019 16:55:49 +0000 (+0000) Subject: ModuleUtils - silence static analyzer dyn_cast<> null dereference warning. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76bcaad5e8162b688dc65095c19affe83f89a2d6;p=llvm ModuleUtils - 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373099 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/ModuleUtils.cpp b/lib/Transforms/Utils/ModuleUtils.cpp index c84beceee19..1ef3757017a 100644 --- a/lib/Transforms/Utils/ModuleUtils.cpp +++ b/lib/Transforms/Utils/ModuleUtils.cpp @@ -73,7 +73,7 @@ static void appendToUsedList(Module &M, StringRef Name, ArrayRef SmallPtrSet InitAsSet; SmallVector Init; if (GV) { - ConstantArray *CA = dyn_cast(GV->getInitializer()); + auto *CA = cast(GV->getInitializer()); for (auto &Op : CA->operands()) { Constant *C = cast_or_null(Op); if (InitAsSet.insert(C).second)