From 4911023fe3fd3a142d1077149fc3bcd9948dece8 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 5 Nov 2018 17:40:28 +0000 Subject: Add a target modules dump ast command. This is useful for investigating the clang ast as you reconstruct it via by parsing debug info. It can also be used to write tests against. Differential Revision: https://reviews.llvm.org/D54072 llvm-svn: 346149 --- lldb/source/Symbol/ClangASTContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lldb/source/Symbol/ClangASTContext.cpp') diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index fe482dc4fb3..ab378cd8cff 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1285,7 +1285,7 @@ CompilerType ClangASTContext::GetCStringType(bool is_const) { return CompilerType(ast, ast->getPointerType(char_type)); } -clang::DeclContext * +clang::TranslationUnitDecl * ClangASTContext::GetTranslationUnitDecl(clang::ASTContext *ast) { return ast->getTranslationUnitDecl(); } @@ -8965,6 +8965,11 @@ ClangASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, //---------------------------------------------------------------------- #define DEPTH_INCREMENT 2 +void ClangASTContext::Dump(Stream &s) { + TranslationUnitDecl *tu = GetTranslationUnitDecl(); + tu->dump(s.AsRawOstream()); +} + void ClangASTContext::DumpValue( lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format, const DataExtractor &data, -- cgit v1.2.3