From d8a9f87f7cde461fd0c9cdf8e7d7863471185237 Mon Sep 17 00:00:00 2001 From: Yaron Keren Date: Fri, 29 Jan 2016 13:46:15 +0000 Subject: [PATCH] Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259192 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/TemplateBase.h | 6 ++++++ lib/AST/TemplateBase.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h index f87171a81d..b9c2c08943 100644 --- a/include/clang/AST/TemplateBase.h +++ b/include/clang/AST/TemplateBase.h @@ -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; }; diff --git a/lib/AST/TemplateBase.cpp b/lib/AST/TemplateBase.cpp index e9edb0df66..f79ce9765a 100644 --- a/lib/AST/TemplateBase.cpp +++ b/lib/AST/TemplateBase.cpp @@ -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 //===----------------------------------------------------------------------===// -- 2.40.0