diff options
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
| -rw-r--r-- | llvm/lib/IR/Metadata.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 5d84bb75cfb..3b5f87a2b40 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -1393,6 +1393,13 @@ MDNode *GlobalObject::getMetadata(StringRef Kind) const { return getMetadata(getContext().getMDKindID(Kind)); } +void GlobalObject::copyMetadata(const GlobalObject *Other) { + SmallVector<std::pair<unsigned, MDNode *>, 8> MDs; + Other->getAllMetadata(MDs); + for (auto &MD : MDs) + addMetadata(MD.first, *MD.second); +} + void Function::setSubprogram(DISubprogram *SP) { setMetadata(LLVMContext::MD_dbg, SP); } |

