Add ‘asttree’ predicate to stats command, courtesy of vkhristenko.
This commit is contained in:
parent
e709fd898b
commit
625ed58bba
@ -38,6 +38,7 @@
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/CodeGen/ModuleBuilder.h"
|
||||
#include "clang/Frontend/ASTConsumers.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/Utils.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
@ -469,7 +470,12 @@ namespace cling {
|
||||
// FIXME: Add stream argument and move DumpIncludePath path here.
|
||||
void Interpreter::dump(llvm::StringRef what, llvm::StringRef filter) {
|
||||
llvm::raw_ostream &where = cling::log();
|
||||
if (what.equals("ast"))
|
||||
if (what.equals("asttree")) {
|
||||
std::unique_ptr<clang::ASTConsumer> printer =
|
||||
clang::CreateASTDumper(filter, true /*DumpDecls*/,
|
||||
false /*DumpLookups*/ );
|
||||
printer->HandleTranslationUnit(getSema().getASTContext());
|
||||
} else if (what.equals("ast"))
|
||||
getSema().getASTContext().PrintStats();
|
||||
else if (what.equals("decl"))
|
||||
ClangInternalState::printLookupTables(where, getSema().getASTContext());
|
||||
|
@ -360,6 +360,7 @@ namespace cling {
|
||||
"\n"
|
||||
" " << metaString << "stats [name]\t\t- Show stats for internal data structures\n"
|
||||
"\t\t\t\t 'ast' abstract syntax tree stats\n"
|
||||
"\t\t\t\t 'asttree [filter]' abstract syntax tree layout\n"
|
||||
"\t\t\t\t 'decl' dump ast declarations\n"
|
||||
"\t\t\t\t 'undo' show undo stack\n"
|
||||
"\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user