diff options
-rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 4 | ||||
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index c6f0928..a8e124c 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -309,6 +309,10 @@ namespace llvm { /// dump - print subprogram. void dump() const; + + /// describes - Return true if this subprogram provides debugging + /// information for the function F. + bool describes(const Function *F); }; /// DIGlobalVariable - This is a wrapper for a global variable. diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 5a8e5cb..7db9b2f 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -291,6 +291,19 @@ uint64_t DIDerivedType::getOriginalTypeSize() const { return BT.getSizeInBits(); } +/// describes - Return true if this subprogram provides debugging +/// information for the function F. +bool DISubprogram::describes(const Function *F) { + assert (F && "Invalid function"); + std::string Name; + getLinkageName(Name); + if (Name.empty()) + getName(Name); + if (!Name.empty() && (strcmp(Name.c_str(), F->getNameStart()) == false)) + return true; + return false; +} + //===----------------------------------------------------------------------===// // DIFactory: Basic Helpers //===----------------------------------------------------------------------===// |