Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if (m_target->GetUseModernTypeLookup()) { | ||||
// persistent AST context as well as the modules and Objective-C runtime | // persistent AST context as well as the modules and Objective-C runtime | ||||
// AST contexts. | // AST contexts. | ||||
lldbassert(!m_merger_up); | lldbassert(!m_merger_up); | ||||
clang::ExternalASTMerger::ImporterTarget target = {ast_context, | clang::ExternalASTMerger::ImporterTarget target = {ast_context, | ||||
file_manager}; | file_manager}; | ||||
std::vector<clang::ExternalASTMerger::ImporterSource> sources; | std::vector<clang::ExternalASTMerger::ImporterSource> sources; | ||||
for (lldb::ModuleSP module_sp : m_target->GetImages().Modules()) { | for (lldb::ModuleSP module_sp : m_target->GetImages().Modules()) { | ||||
if (auto *module_ast_ctx = llvm::cast_or_null<ClangASTContext>( | auto type_system_or_err = | ||||
module_sp->GetTypeSystemForLanguage(lldb::eLanguageTypeC))) { | module_sp->GetTypeSystemForLanguage(lldb::eLanguageTypeC); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR( | |||||
lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS), | |||||
std::move(err), "Failed to get ClangASTContext"); | |||||
} else if (auto *module_ast_ctx = llvm::cast_or_null<ClangASTContext>( | |||||
&type_system_or_err.get())) { | |||||
labath: I don't believe this will work. Once you consume the error, it is left in an indeterminate… | |||||
lldbassert(module_ast_ctx->getASTContext()); | lldbassert(module_ast_ctx->getASTContext()); | ||||
lldbassert(module_ast_ctx->getFileManager()); | lldbassert(module_ast_ctx->getFileManager()); | ||||
sources.push_back({*module_ast_ctx->getASTContext(), | sources.push_back({*module_ast_ctx->getASTContext(), | ||||
*module_ast_ctx->getFileManager(), | *module_ast_ctx->getFileManager(), | ||||
module_ast_ctx->GetOriginMap() | module_ast_ctx->GetOriginMap()}); | ||||
}); | |||||
} | } | ||||
} | } | ||||
do { | do { | ||||
lldb::ProcessSP process(m_target->GetProcessSP()); | lldb::ProcessSP process(m_target->GetProcessSP()); | ||||
if (!process) | if (!process) | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 2,145 Lines • Show Last 20 Lines |
I don't believe this will work. Once you consume the error, it is left in an indeterminate state (which happens to be the "success" state, but it's best not to rely on it).
If you do want to log the error (which I do recommend), then you can use the LLDB_LOG_ERROR macro. This one will clear the error for you, and it will do so even if logging is disabled. I.e., if you log the error, there's no need for an additional consumeError call.