r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

Yaron Keren via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 29 05:46:16 PST 2016


Author: yrnkrn
Date: Fri Jan 29 07:46:15 2016
New Revision: 259192

URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
Log:
Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().


Modified:
    cfe/trunk/include/clang/AST/TemplateBase.h
    cfe/trunk/lib/AST/TemplateBase.cpp

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15 2016
@@ -354,6 +354,12 @@ public:
   /// \brief Print this template argument to the given output stream.
   void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
              
+  /// \brief Debugging aid that dumps the template argument.
+  void dump(raw_ostream &Out) const;
+
+  /// \brief Debugging aid that dumps the template argument to standard error.
+  void dump() const;
+             
   /// \brief Used to insert TemplateArguments into FoldingSets.
   void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
 };

Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
@@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
   }
 }
 
+void TemplateArgument::dump(raw_ostream &Out) const {
+  LangOptions LO; // FIXME! see also TemplateName::dump().
+  LO.CPlusPlus = true;
+  LO.Bool = true;
+  print(PrintingPolicy(LO), Out);
+}
+
+void TemplateArgument::dump() const { dump(llvm::errs()); }
+
 //===----------------------------------------------------------------------===//
 // TemplateArgumentLoc Implementation
 //===----------------------------------------------------------------------===//




More information about the cfe-commits mailing list