diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-13 19:07:27 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-13 19:07:27 +0000 |
commit | 3c2d70434bd750683baa94432bfe9fd1f639f968 (patch) | |
tree | af48b74f5b86aac27b510973e4d5c4a24fec2ecb /llvm/lib/IR/DebugInfoMetadata.cpp | |
parent | 3ff56573294b531a123046c1ff7d4b91601261f1 (diff) | |
download | bcm5719-llvm-3c2d70434bd750683baa94432bfe9fd1f639f968.tar.gz bcm5719-llvm-3c2d70434bd750683baa94432bfe9fd1f639f968.zip |
DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC
I don't really like this function at all -- I think it should be as
simple as `return getFunction() == F` -- but for now this seems like the
best we can do.
llvm-svn: 234778
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 72126cc5fb2..ed6206264b0 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -348,6 +348,16 @@ Function *MDSubprogram::getFunction() const { return dyn_cast_or_null<Function>(getFunctionConstant()); } +bool MDSubprogram::describes(const Function *F) const { + assert(F && "Invalid function"); + if (F == getFunction()) + return true; + StringRef Name = getLinkageName(); + if (Name.empty()) + Name = getName(); + return F->getName() == Name; +} + void MDSubprogram::replaceFunction(Function *F) { replaceFunction(F ? ConstantAsMetadata::get(F) : static_cast<ConstantAsMetadata *>(nullptr)); |