[llvm] r232315 - IR: Default the Metadata::dump() argument "harder" after r232275

Duncan P. N. Exon Smith dexonsmith at apple.com
Sat Mar 14 23:53:32 PDT 2015


Author: dexonsmith
Date: Sun Mar 15 01:53:32 2015
New Revision: 232315

URL: http://llvm.org/viewvc/llvm-project?rev=232315&view=rev
Log:
IR: Default the Metadata::dump() argument "harder" after r232275

Use an overload instead of a default argument for `Metadata::dump()`.
The latter seems to require calling `dump(nullptr)` explicitly when
using a debugger, where as the former doesn't.

Other than utility for debugging, there's NFC here.

Modified:
    llvm/trunk/include/llvm/IR/Metadata.h
    llvm/trunk/lib/IR/AsmWriter.cpp

Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=232315&r1=232314&r2=232315&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Sun Mar 15 01:53:32 2015
@@ -106,7 +106,14 @@ public:
   ///
   /// If \c M is provided, metadata nodes will be numbered canonically;
   /// otherwise, pointer addresses are substituted.
-  void dump(const Module *M = nullptr) const;
+  ///
+  /// Note: this uses an explicit overload instead of default arguments so that
+  /// the nullptr version is easy to call from a debugger.
+  ///
+  /// @{
+  void dump() const;
+  void dump(const Module *M) const;
+  /// @}
 
   /// \brief Print.
   ///

Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=232315&r1=232314&r2=232315&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Sun Mar 15 01:53:32 2015
@@ -3290,6 +3290,9 @@ LLVM_DUMP_METHOD
 void NamedMDNode::dump() const { print(dbgs()); }
 
 LLVM_DUMP_METHOD
+void Metadata::dump() const { dump(nullptr); }
+
+LLVM_DUMP_METHOD
 void Metadata::dump(const Module *M) const {
   print(dbgs(), M);
   dbgs() << '\n';





More information about the llvm-commits mailing list