diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2018-05-31 13:29:58 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2018-05-31 13:29:58 +0000 |
commit | 0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4 (patch) | |
tree | d22716759a31167ef8f0bfdb57c835d41ed73d50 /llvm/lib/IR/DebugInfo.cpp | |
parent | e37a5ce1489e54f4143d384b559107fe7eef9257 (diff) | |
download | bcm5719-llvm-0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4.tar.gz bcm5719-llvm-0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4.zip |
Extend the GlobalObject metadata interface
- Make eraseMetadata return whether it changed something
- Wire getMetadata for a single MDNode efficiently into the attachment
map
- Add hasMetadata, which is less weird than checking getMetadata ==
nullptr on a multimap.
Use it to simplify code.
llvm-svn: 333649
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 993020e7b4c..b741cc9236f 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -313,7 +313,7 @@ static MDNode *stripDebugLocFromLoopID(MDNode *N) { bool llvm::stripDebugInfo(Function &F) { bool Changed = false; - if (F.getMetadata(LLVMContext::MD_dbg)) { + if (F.hasMetadata(LLVMContext::MD_dbg)) { Changed = true; F.setSubprogram(nullptr); } @@ -369,12 +369,7 @@ bool llvm::StripDebugInfo(Module &M) { Changed |= stripDebugInfo(F); for (auto &GV : M.globals()) { - SmallVector<MDNode *, 1> MDs; - GV.getMetadata(LLVMContext::MD_dbg, MDs); - if (!MDs.empty()) { - GV.eraseMetadata(LLVMContext::MD_dbg); - Changed = true; - } + Changed |= GV.eraseMetadata(LLVMContext::MD_dbg); } if (GVMaterializer *Materializer = M.getMaterializer()) |