[llvm-commits] [llvm] r69113 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp

Devang Patel dpatel at apple.com
Tue Apr 14 17:06:08 PDT 2009


Author: dpatel
Date: Tue Apr 14 19:06:07 2009
New Revision: 69113

URL: http://llvm.org/viewvc/llvm-project?rev=69113&view=rev
Log:
Add a method to check that the subprogram holds debug info for the given Function or not.

Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/Analysis/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=69113&r1=69112&r2=69113&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Tue Apr 14 19:06:07 2009
@@ -309,6 +309,10 @@
 
     /// 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.

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=69113&r1=69112&r2=69113&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Apr 14 19:06:07 2009
@@ -291,6 +291,19 @@
   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
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list