<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 13, 2015 at 12:07 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dexonsmith<br>
Date: Mon Apr 13 14:07:27 2015<br>
New Revision: 234778<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=234778&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=234778&view=rev</a><br>
Log:<br>
DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC<br>
<br>
I don't really like this function at all -- I think it should be as<br>
simple as `return getFunction() == F` -- but for now this seems like the<br>
best we can do.<br></blockquote><div><br>Any particular cases where this does anything other than getFunction() == F? (maybe this is bitcasts getting in the way again?)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/DebugInfo.h<br>
    llvm/trunk/include/llvm/IR/DebugInfoMetadata.h<br>
    llvm/trunk/lib/IR/DebugInfo.cpp<br>
    llvm/trunk/lib/IR/DebugInfoMetadata.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234778&r1=234777&r2=234778&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234778&r1=234777&r2=234778&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)<br>
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr 13 14:07:27 2015<br>
@@ -520,7 +520,7 @@ public:<br>
   DITypeRef getContainingType() const { return get()->getContainingType(); }<br>
<br>
   /// \brief Check if this provides debugging information for the function F.<br>
-  bool describes(const Function *F);<br>
+  bool describes(const Function *F) const { return get()->describes(F); }<br>
<br>
   Function *getFunction() const { return get()->getFunction(); }<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=234778&r1=234777&r2=234778&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=234778&r1=234777&r2=234778&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)<br>
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Mon Apr 13 14:07:27 2015<br>
@@ -1386,6 +1386,11 @@ public:<br>
   void replaceFunction(std::nullptr_t) { replaceOperandWith(7, nullptr); }<br>
   /// @}<br>
<br>
+  /// \brief Check if this subprogram decribes the given function.<br>
+  ///<br>
+  /// FIXME: Should this be looking through bitcasts?<br>
+  bool describes(const Function *F) const;<br>
+<br>
   static bool classof(const Metadata *MD) {<br>
     return MD->getMetadataID() == MDSubprogramKind;<br>
   }<br>
<br>
Modified: llvm/trunk/lib/IR/DebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234778&r1=234777&r2=234778&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234778&r1=234777&r2=234778&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)<br>
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr 13 14:07:27 2015<br>
@@ -49,18 +49,6 @@ bool DIVariable::isInlinedFnArgument(con<br>
   return !SP.describes(CurFn);<br>
 }<br>
<br>
-bool DISubprogram::describes(const Function *F) {<br>
-  assert(F && "Invalid function");<br>
-  if (F == getFunction())<br>
-    return true;<br>
-  StringRef Name = getLinkageName();<br>
-  if (Name.empty())<br>
-    Name = getName();<br>
-  if (F->getName() == Name)<br>
-    return true;<br>
-  return false;<br>
-}<br>
-<br>
 GlobalVariable *DIGlobalVariable::getGlobal() const {<br>
   return dyn_cast_or_null<GlobalVariable>(getConstant());<br>
 }<br>
<br>
Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=234778&r1=234777&r2=234778&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=234778&r1=234777&r2=234778&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)<br>
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Mon Apr 13 14:07:27 2015<br>
@@ -348,6 +348,16 @@ Function *MDSubprogram::getFunction() co<br>
   return dyn_cast_or_null<Function>(getFunctionConstant());<br>
 }<br>
<br>
+bool MDSubprogram::describes(const Function *F) const {<br>
+  assert(F && "Invalid function");<br>
+  if (F == getFunction())<br>
+    return true;<br>
+  StringRef Name = getLinkageName();<br>
+  if (Name.empty())<br>
+    Name = getName();<br>
+  return F->getName() == Name;<br>
+}<br>
+<br>
 void MDSubprogram::replaceFunction(Function *F) {<br>
   replaceFunction(F ? ConstantAsMetadata::get(F)<br>
                     : static_cast<ConstantAsMetadata *>(nullptr));<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>