Add a method to check that the subprogram holds debug info for the given Function...
authorDevang Patel <dpatel@apple.com>
Wed, 15 Apr 2009 00:06:07 +0000 (00:06 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 15 Apr 2009 00:06:07 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69113 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp

index c6f09283bd3da1fd742dd1d72f93e643adfc7639..a8e124c6f09cf75a2bb8735c9c59446e5876be46 100644 (file)
@@ -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.
index 5a8e5cb90b280af304c3526da1966dd6a7453f04..7db9b2f3bc411a249d3dc4c69b9995b5c540acc2 100644 (file)
@@ -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
 //===----------------------------------------------------------------------===//