Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Plugins/Language/CPlusPlus/BlockPointer.cpp
Show All 11 Lines | |||||
#include "lldb/DataFormatters/FormattersHelpers.h" | #include "lldb/DataFormatters/FormattersHelpers.h" | ||||
#include "lldb/Symbol/ClangASTContext.h" | #include "lldb/Symbol/ClangASTContext.h" | ||||
#include "lldb/Symbol/ClangASTImporter.h" | #include "lldb/Symbol/ClangASTImporter.h" | ||||
#include "lldb/Symbol/CompilerType.h" | #include "lldb/Symbol/CompilerType.h" | ||||
#include "lldb/Symbol/TypeSystem.h" | #include "lldb/Symbol/TypeSystem.h" | ||||
#include "lldb/Target/Target.h" | #include "lldb/Target/Target.h" | ||||
#include "lldb/Utility/LLDBAssert.h" | #include "lldb/Utility/LLDBAssert.h" | ||||
#include "lldb/Utility/Log.h" | |||||
using namespace lldb; | using namespace lldb; | ||||
using namespace lldb_private; | using namespace lldb_private; | ||||
using namespace lldb_private::formatters; | using namespace lldb_private::formatters; | ||||
namespace lldb_private { | namespace lldb_private { | ||||
namespace formatters { | namespace formatters { | ||||
class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd { | class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd { | ||||
public: | public: | ||||
BlockPointerSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) | BlockPointerSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) | ||||
: SyntheticChildrenFrontEnd(*valobj_sp), m_block_struct_type() { | : SyntheticChildrenFrontEnd(*valobj_sp), m_block_struct_type() { | ||||
CompilerType block_pointer_type(m_backend.GetCompilerType()); | CompilerType block_pointer_type(m_backend.GetCompilerType()); | ||||
CompilerType function_pointer_type; | CompilerType function_pointer_type; | ||||
block_pointer_type.IsBlockPointerType(&function_pointer_type); | block_pointer_type.IsBlockPointerType(&function_pointer_type); | ||||
TargetSP target_sp(m_backend.GetTargetSP()); | TargetSP target_sp(m_backend.GetTargetSP()); | ||||
if (!target_sp) { | if (!target_sp) { | ||||
return; | return; | ||||
} | } | ||||
Status err; | auto type_system_or_err = target_sp->GetScratchTypeSystemForLanguage( | ||||
TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage( | lldb::eLanguageTypeC_plus_plus); | ||||
&err, lldb::eLanguageTypeC_plus_plus); | if (auto err = type_system_or_err.takeError()) { | ||||
LLDB_LOG_ERROR( | |||||
if (!err.Success() || !type_system) { | lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), | ||||
std::move(err), "Failed to get scratch ClangASTContext"); | |||||
return; | return; | ||||
} | } | ||||
ClangASTContext *clang_ast_context = | ClangASTContext *clang_ast_context = | ||||
llvm::dyn_cast<ClangASTContext>(type_system); | llvm::dyn_cast<ClangASTContext>(&type_system_or_err.get()); | ||||
if (!clang_ast_context) { | if (!clang_ast_context) { | ||||
return; | return; | ||||
} | } | ||||
ClangASTImporterSP clang_ast_importer = target_sp->GetClangASTImporter(); | ClangASTImporterSP clang_ast_importer = target_sp->GetClangASTImporter(); | ||||
if (!clang_ast_importer) { | if (!clang_ast_importer) { | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |