diff options
author | Alexander Kornienko <alexfh@google.com> | 2018-04-06 13:01:12 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2018-04-06 13:01:12 +0000 |
commit | e2fbe37780ca1bad55fbdb18a8c448d7156a932d (patch) | |
tree | 109ea44186382c64fcadd94f3d9ac46e9e0fb3de /include/clang/Frontend/ASTConsumers.h | |
parent | 42a3ce3c17dd56019bc60286c961cbbf8a283296 (diff) |
Allow the creation of human-friendly ASTDumper to arbitrary output stream
Summary:
`ASTPrinter` allows setting the ouput to any O-Stream, but that printer creates source-code-like syntax (and is also marked with a `FIXME`). The nice, colourful, mostly human-readable `ASTDumper` only works on the standard output, which is not feasible in case a user wants to see the AST of a file through a code navigation/comprehension tool.
This small addition of an overload solves generating a nice colourful AST block for the users of a tool I'm working on, [[ http://github.com/Ericsson/CodeCompass | CodeCompass ]], as opposed to having to duplicate the behaviour of definitions that only exist in the anonymous namespace of implementation TUs related to this module.
Reviewers: alexfh, klimek, rsmith
Reviewed By: alexfh
Subscribers: rnkovacs, dkrupp, gsd, xazax.hun, cfe-commits, #clang
Tags: #clang
Patch by Whisperity!
Differential Revision: https://reviews.llvm.org/D45096
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/ASTConsumers.h')
-rw-r--r-- | include/clang/Frontend/ASTConsumers.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index 53975a07ea..2a13527df1 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -34,9 +34,10 @@ class TargetOptions; std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS, StringRef FilterString); -// AST dumper: dumps the raw AST in human-readable form to stderr; this is -// intended for debugging. -std::unique_ptr<ASTConsumer> CreateASTDumper(StringRef FilterString, +// AST dumper: dumps the raw AST in human-readable form to the given output +// stream, or stdout if OS is nullptr. +std::unique_ptr<ASTConsumer> CreateASTDumper(std::unique_ptr<raw_ostream> OS, + StringRef FilterString, bool DumpDecls, bool Deserialize, bool DumpLookups); |