From 3c2d70434bd750683baa94432bfe9fd1f639f968 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 13 Apr 2015 19:07:27 +0000 Subject: 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 --- llvm/lib/IR/DebugInfoMetadata.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp') 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(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(nullptr)); -- cgit v1.2.3