aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Debugify.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2022-03-25 10:25:04 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2022-03-25 10:25:04 +0000
commit1a943923b8bc000ae03b22a05413918723d2d044 (patch)
tree96943c5916327d7b46ae6da19fa58039d68575bd /llvm/lib/Transforms/Utils/Debugify.cpp
parentae95f291e8d92bb7396219839efc0012a13378e1 (diff)
downloadllvm-1a943923b8bc000ae03b22a05413918723d2d044.zip
llvm-1a943923b8bc000ae03b22a05413918723d2d044.tar.gz
llvm-1a943923b8bc000ae03b22a05413918723d2d044.tar.bz2
[Utils] stripDebugifyMetadata - use cast<> instead of dyn_cast_or_null<> to avoid dereference of nullptr
The pointer is dereferenced immediately, so assert the cast is correct instead of returning nullptr
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Debugify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index d6b1b1b..7448e3e 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -266,7 +266,7 @@ bool llvm::stripDebugifyMetadata(Module &M) {
SmallVector<MDNode *, 4> Flags(NMD->operands());
NMD->clearOperands();
for (MDNode *Flag : Flags) {
- MDString *Key = dyn_cast_or_null<MDString>(Flag->getOperand(1));
+ auto *Key = cast<MDString>(Flag->getOperand(1));
if (Key->getString() == "Debug Info Version") {
Changed = true;
continue;