From 7f9bbe0599779846c56cd305cd1279ffd623f38e Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Mon, 12 Aug 2019 21:49:54 +0000 Subject: [PATCH] [CompilerType] Pass an ExecutionContextScope to GetTypeBitAlign. llvm-svn: 368620 --- lldb/include/lldb/Symbol/ClangASTContext.h | 3 ++- lldb/include/lldb/Symbol/CompilerType.h | 2 +- lldb/include/lldb/Symbol/TypeSystem.h | 3 ++- lldb/source/Expression/Materializer.cpp | 4 ++-- lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp | 2 +- lldb/source/Symbol/ClangASTContext.cpp | 3 ++- lldb/source/Symbol/CompilerType.cpp | 4 ++-- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 51e0c42..42f652f 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -709,7 +709,8 @@ public: lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override; llvm::Optional - GetTypeBitAlign(lldb::opaque_compiler_type_t type) override; + GetTypeBitAlign(lldb::opaque_compiler_type_t type, + ExecutionContextScope *exe_scope) override; uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes, diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 16894fd..bf91fe9 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -257,7 +257,7 @@ public: lldb::Format GetFormat() const; - llvm::Optional GetTypeBitAlign() const; + llvm::Optional GetTypeBitAlign(ExecutionContextScope *exe_scope) const; uint32_t GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index 1ef2dac..9bbdc9c 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -387,7 +387,8 @@ public: uint32_t &length) = 0; virtual llvm::Optional - GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0; + GetTypeBitAlign(lldb::opaque_compiler_type_t type, + ExecutionContextScope *exe_scope) = 0; virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0; diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index c20422a..cd33248 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -531,7 +531,7 @@ public: } llvm::Optional opt_bit_align = - m_variable_sp->GetType()->GetLayoutCompilerType().GetTypeBitAlign(); + m_variable_sp->GetType()->GetLayoutCompilerType().GetTypeBitAlign(scope); if (!opt_bit_align) { err.SetErrorStringWithFormat("can't get the type alignment for %s", m_variable_sp->GetName().AsCString()); @@ -792,7 +792,7 @@ public: return; } - llvm::Optional opt_bit_align = m_type.GetTypeBitAlign(); + llvm::Optional opt_bit_align = m_type.GetTypeBitAlign(exe_scope); if (!opt_bit_align) { err.SetErrorStringWithFormat("can't get the type alignment"); return; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index d77f383..1e64316 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1302,7 +1302,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { llvm::Optional value_size = compiler_type.GetByteSize(nullptr); if (!value_size) return false; - llvm::Optional opt_alignment = compiler_type.GetTypeBitAlign(); + llvm::Optional opt_alignment = compiler_type.GetTypeBitAlign(nullptr); if (!opt_alignment) return false; lldb::offset_t value_alignment = (*opt_alignment + 7ull) / 8ull; diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index edc8acf..f864dfd 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -5088,7 +5088,8 @@ ClangASTContext::GetBitSize(lldb::opaque_compiler_type_t type, } llvm::Optional -ClangASTContext::GetTypeBitAlign(lldb::opaque_compiler_type_t type) { +ClangASTContext::GetTypeBitAlign(lldb::opaque_compiler_type_t type, + ExecutionContextScope *exe_scope) { if (GetCompleteType(type)) return getASTContext()->getTypeAlign(GetQualType(type)); return {}; diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index f57843e..774004c 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -503,9 +503,9 @@ CompilerType::GetByteSize(ExecutionContextScope *exe_scope) const { return {}; } -llvm::Optional CompilerType::GetTypeBitAlign() const { +llvm::Optional CompilerType::GetTypeBitAlign(ExecutionContextScope *exe_scope) const { if (IsValid()) - return m_type_system->GetTypeBitAlign(m_type); + return m_type_system->GetTypeBitAlign(m_type, exe_scope); return {}; } -- 2.7.4