]> granicus.if.org Git - clang/commitdiff
Implement TemplateArgument::dump() method for debugging, patterned after TemplateName...
authorYaron Keren <yaron.keren@gmail.com>
Fri, 29 Jan 2016 13:46:15 +0000 (13:46 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Fri, 29 Jan 2016 13:46:15 +0000 (13:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259192 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/TemplateBase.h
lib/AST/TemplateBase.cpp

index f87171a81d1d27e1094d2413c3eadaf988ca60b9..b9c2c08943e95162f0bb59eb7fcc1337259e92fe 100644 (file)
@@ -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;
 };
index e9edb0df66df12d44a2b0e7f7a830c23b79ac85a..f79ce9765a6641cf248c323507918b6ceb5f752d 100644 (file)
@@ -415,6 +415,15 @@ void TemplateArgument::print(const PrintingPolicy &Policy,
   }
 }
 
+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
 //===----------------------------------------------------------------------===//