diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
| commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
| tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /lldb/source/API/SBType.cpp | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'lldb/source/API/SBType.cpp')
| -rw-r--r-- | lldb/source/API/SBType.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 533930c0544b..1ccc3b0c2dc9 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -22,15 +22,14 @@ #include "llvm/ADT/APSInt.h" #include <memory> +#include <optional> using namespace lldb; using namespace lldb_private; SBType::SBType() { LLDB_INSTRUMENT_VA(this); } -SBType::SBType(const CompilerType &type) - : m_opaque_sp(new TypeImpl( - CompilerType(type.GetTypeSystem(), type.GetOpaqueQualType()))) {} +SBType::SBType(const CompilerType &type) : m_opaque_sp(new TypeImpl(type)) {} SBType::SBType(const lldb::TypeSP &type_sp) : m_opaque_sp(new TypeImpl(type_sp)) {} @@ -122,7 +121,7 @@ uint64_t SBType::GetByteSize() { LLDB_INSTRUMENT_VA(this); if (IsValid()) - if (llvm::Optional<uint64_t> size = + if (std::optional<uint64_t> size = m_opaque_sp->GetCompilerType(false).GetByteSize(nullptr)) return *size; return 0; @@ -364,8 +363,8 @@ SBType SBType::GetBasicType(lldb::BasicType basic_type) { LLDB_INSTRUMENT_VA(this, basic_type); if (IsValid() && m_opaque_sp->IsValid()) - return SBType( - m_opaque_sp->GetTypeSystem(false)->GetBasicTypeFromAST(basic_type)); + if (auto ts = m_opaque_sp->GetTypeSystem(false)) + return SBType(ts->GetBasicTypeFromAST(basic_type)); return SBType(); } @@ -492,7 +491,12 @@ bool SBType::IsTypeComplete() { if (!IsValid()) return false; - return m_opaque_sp->GetCompilerType(false).IsCompleteType(); + CompilerType compiler_type = m_opaque_sp->GetCompilerType(false); + // Only return true if we have a complete type and it wasn't forcefully + // completed. + if (compiler_type.IsCompleteType()) + return !compiler_type.IsForcefullyCompleted(); + return false; } uint32_t SBType::GetTypeFlags() { @@ -542,7 +546,8 @@ uint32_t SBType::GetNumberOfTemplateArguments() { LLDB_INSTRUMENT_VA(this); if (IsValid()) - return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments(); + return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments( + /*expand_pack=*/true); return 0; } @@ -553,13 +558,15 @@ lldb::SBType SBType::GetTemplateArgumentType(uint32_t idx) { return SBType(); CompilerType type; + const bool expand_pack = true; switch(GetTemplateArgumentKind(idx)) { case eTemplateArgumentKindType: - type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument(idx); + type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument( + idx, expand_pack); break; case eTemplateArgumentKindIntegral: type = m_opaque_sp->GetCompilerType(false) - .GetIntegralTemplateArgument(idx) + .GetIntegralTemplateArgument(idx, expand_pack) ->type; break; default: @@ -574,7 +581,8 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { LLDB_INSTRUMENT_VA(this, idx); if (IsValid()) - return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind(idx); + return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind( + idx, /*expand_pack=*/true); return eTemplateArgumentKindNull; } |
