Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
tools/lldb-test/lldb-test.cpp
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | |||||
Error opts::symbols::dumpAST(lldb_private::Module &Module) { | Error opts::symbols::dumpAST(lldb_private::Module &Module) { | ||||
SymbolVendor &plugin = *Module.GetSymbolVendor(); | SymbolVendor &plugin = *Module.GetSymbolVendor(); | ||||
Module.ParseAllDebugSymbols(); | Module.ParseAllDebugSymbols(); | ||||
auto symfile = plugin.GetSymbolFile(); | auto symfile = plugin.GetSymbolFile(); | ||||
if (!symfile) | if (!symfile) | ||||
return make_string_error("Module has no symbol file."); | return make_string_error("Module has no symbol file."); | ||||
auto clang_ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus)); | symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus); | ||||
if (!type_system_or_err) | |||||
return make_string_error("Can't retrieve ClangASTContext"); | |||||
auto *clang_ast_ctx = | |||||
llvm::dyn_cast_or_null<ClangASTContext>(&type_system_or_err.get()); | |||||
if (!clang_ast_ctx) | if (!clang_ast_ctx) | ||||
return make_string_error("Can't retrieve Clang AST context."); | return make_string_error("Retrieved TypeSystem was not a ClangASTContext"); | ||||
auto ast_ctx = clang_ast_ctx->getASTContext(); | auto ast_ctx = clang_ast_ctx->getASTContext(); | ||||
if (!ast_ctx) | if (!ast_ctx) | ||||
return make_string_error("Can't retrieve AST context."); | return make_string_error("Can't retrieve AST context."); | ||||
auto tu = ast_ctx->getTranslationUnitDecl(); | auto tu = ast_ctx->getTranslationUnitDecl(); | ||||
if (!tu) | if (!tu) | ||||
return make_string_error("Can't retrieve translation unit declaration."); | return make_string_error("Can't retrieve translation unit declaration."); | ||||
▲ Show 20 Lines • Show All 456 Lines • Show Last 20 Lines |