Skip to content

Commit 2e0de86

Browse files
committed
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. llvm-svn: 373099
1 parent d8e38b9 commit 2e0de86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/Utils/ModuleUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void appendToUsedList(Module &M, StringRef Name, ArrayRef<GlobalValue *>
7373
SmallPtrSet<Constant *, 16> InitAsSet;
7474
SmallVector<Constant *, 16> Init;
7575
if (GV) {
76-
ConstantArray *CA = dyn_cast<ConstantArray>(GV->getInitializer());
76+
auto *CA = cast<ConstantArray>(GV->getInitializer());
7777
for (auto &Op : CA->operands()) {
7878
Constant *C = cast_or_null<Constant>(Op);
7979
if (InitAsSet.insert(C).second)

0 commit comments

Comments
 (0)