[llvm] r234778 - DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Apr 13 12:07:28 PDT 2015
Author: dexonsmith
Date: Mon Apr 13 14:07:27 2015
New Revision: 234778
URL: http://llvm.org/viewvc/llvm-project?rev=234778&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/IR/DebugInfo.h
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
llvm/trunk/lib/IR/DebugInfo.cpp
llvm/trunk/lib/IR/DebugInfoMetadata.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234778&r1=234777&r2=234778&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr 13 14:07:27 2015
@@ -520,7 +520,7 @@ public:
DITypeRef getContainingType() const { return get()->getContainingType(); }
/// \brief Check if this provides debugging information for the function F.
- bool describes(const Function *F);
+ bool describes(const Function *F) const { return get()->describes(F); }
Function *getFunction() const { return get()->getFunction(); }
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=234778&r1=234777&r2=234778&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Mon Apr 13 14:07:27 2015
@@ -1386,6 +1386,11 @@ public:
void replaceFunction(std::nullptr_t) { replaceOperandWith(7, nullptr); }
/// @}
+ /// \brief Check if this subprogram decribes the given function.
+ ///
+ /// FIXME: Should this be looking through bitcasts?
+ bool describes(const Function *F) const;
+
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == MDSubprogramKind;
}
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234778&r1=234777&r2=234778&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr 13 14:07:27 2015
@@ -49,18 +49,6 @@ bool DIVariable::isInlinedFnArgument(con
return !SP.describes(CurFn);
}
-bool DISubprogram::describes(const Function *F) {
- assert(F && "Invalid function");
- if (F == getFunction())
- return true;
- StringRef Name = getLinkageName();
- if (Name.empty())
- Name = getName();
- if (F->getName() == Name)
- return true;
- return false;
-}
-
GlobalVariable *DIGlobalVariable::getGlobal() const {
return dyn_cast_or_null<GlobalVariable>(getConstant());
}
Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=234778&r1=234777&r2=234778&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Mon Apr 13 14:07:27 2015
@@ -348,6 +348,16 @@ Function *MDSubprogram::getFunction() co
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));
More information about the llvm-commits
mailing list