[Lldb-commits] [lldb] [lldb] Construct SmallVector with ArrayRef (NFC) (PR #102793)

2024-08-11 Thread David Blaikie via lldb-commits

https://github.com/dwblaikie approved this pull request.


https://github.com/llvm/llvm-project/pull/102793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 4134592 - [lldb] Construct SmallVector with ArrayRef (NFC) (#102793)

2024-08-11 Thread via lldb-commits

Author: Kazu Hirata
Date: 2024-08-11T12:48:06-07:00
New Revision: 41345925f9393518be8029cfb1ea80cfeb5631b4

URL: 
https://github.com/llvm/llvm-project/commit/41345925f9393518be8029cfb1ea80cfeb5631b4
DIFF: 
https://github.com/llvm/llvm-project/commit/41345925f9393518be8029cfb1ea80cfeb5631b4.diff

LOG: [lldb] Construct SmallVector with ArrayRef (NFC) (#102793)

Added: 


Modified: 
lldb/include/lldb/Utility/UUID.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/UUID.h 
b/lldb/include/lldb/Utility/UUID.h
index 66058d482f012f..bc4b4acd5a7d8f 100644
--- a/lldb/include/lldb/Utility/UUID.h
+++ b/lldb/include/lldb/Utility/UUID.h
@@ -28,7 +28,7 @@ class UUID {
   UUID() = default;
   
   /// Creates a uuid from the data pointed to by the bytes argument.
-  UUID(llvm::ArrayRef bytes) : m_bytes(bytes.begin(), bytes.end()) {
+  UUID(llvm::ArrayRef bytes) : m_bytes(bytes) {
 if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; })) {
   Clear();
}



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Construct SmallVector with ArrayRef (NFC) (PR #102793)

2024-08-11 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/102793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)

2024-08-11 Thread Matheus Izvekov via lldb-commits

mizvekov wrote:

> It is not only valuable to external resugarers. Another point that warrants 
> an introduction of it is for unevaluated lambdas. These lambdas e.g. 
> appearing as part of the `using Alias = decltype(lambda)` could carry a 
> requires expression and thus evaluating it requires the recovery of the 
> instantiating template arguments for the type alias, which isn't a quite 
> natural thing without such a Decl. I have improved some of these situations 
> through an on-stack InstantiatingTemplate to help to inspect the template 
> arguments; however, that approach is somewhat cumbersome and still couldn't 
> extend to other scenarios e.g. mangling these lambdas. (#97024. We need a 
> correct DeclContext for the lambda, yet a `TypeAliasTemplateDecl` isn't a 
> DeclContext, unfortunately.)

So in clang we have taken a different approach, in order to not sacrifice 
template type alias performance, we instead put a `Decl` context reference in 
templated declarations that can appear within a template type alias pattern, 
such as lambdas and blocks.

The idea is a tradeoff where template type alias, which are very light weight, 
don't get the big performance hit they would otherwise if they had a 
per-specialization declaration.
But we get a slight performance hit on Lambdas instead, but these are much more 
heavy weight and need the declcontext anyway for other reasons.
The other tradeoff is increased implementation complexity.

See for example CXXRecordDecl's `getLambdaContextDecl` function.

Unfortunately there is an issue where we currently only store this lambda 
context when we need it for mangling reasons, but there are other reasons to 
depend on it as well, and code in clang currently makes the incorrect 
assumption that it will always be available when needed.

I am working on a patch to fix that.

https://github.com/llvm/llvm-project/pull/101858
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] af09dd6 - [lldb] Silence warning

2024-08-11 Thread Alexandre Ganea via lldb-commits

Author: Alexandre Ganea
Date: 2024-08-11T19:01:12-04:00
New Revision: af09dd692232fe6f06650e5b29710206d516fb38

URL: 
https://github.com/llvm/llvm-project/commit/af09dd692232fe6f06650e5b29710206d516fb38
DIFF: 
https://github.com/llvm/llvm-project/commit/af09dd692232fe6f06650e5b29710206d516fb38.diff

LOG: [lldb] Silence warning

This fixes:
```
[6831/7617] Building CXX object
tools\lldb\source\Target\CMakeFiles\lldbTarget.dir\ThreadPlanSingleThreadTimeout.cpp.obj
C:\src\git\llvm-project\lldb\source\Target\ThreadPlanSingleThreadTimeout.cpp(66)
: warning C4715:
'lldb_private::ThreadPlanSingleThreadTimeout::StateToString': not all
control paths return a value
```

Added: 


Modified: 
lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp

Removed: 




diff  --git a/lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp 
b/lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp
index 40a8af8e703432..0a939d55f4ce49 100644
--- a/lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp
+++ b/lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp
@@ -63,6 +63,7 @@ std::string 
ThreadPlanSingleThreadTimeout::StateToString(State state) {
   case State::Done:
 return "Done";
   }
+  llvm_unreachable("Uncovered state value!");
 }
 
 void ThreadPlanSingleThreadTimeout::PushNewWithTimeout(Thread &thread,



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a819b0e - [lldb] Silence warning

2024-08-11 Thread Alexandre Ganea via lldb-commits

Author: Alexandre Ganea
Date: 2024-08-11T19:01:12-04:00
New Revision: a819b0e55fafab0c6c4b059fc0132620f43ac38a

URL: 
https://github.com/llvm/llvm-project/commit/a819b0e55fafab0c6c4b059fc0132620f43ac38a
DIFF: 
https://github.com/llvm/llvm-project/commit/a819b0e55fafab0c6c4b059fc0132620f43ac38a.diff

LOG: [lldb] Silence warning

This fixes the following warning, when building with Clang ToT on
Windows:
```
[6668/7618] Building CXX object
tools\lldb\source\Plugins\Process\Windows\Common\CMakeFiles\lldbPluginProcessWindowsCommon.dir\TargetThreadWindows.cpp.obj
C:\src\git\llvm-project\lldb\source\Plugins\Process\Windows\Common\TargetThreadWindows.cpp(182,22):
warning: cast from 'FARPROC' (aka 'long long (*)()') to
'GetThreadDescriptionFunctionPtr' (aka 'long (*)(void *, wchar_t **)')
converts to incompatible function type [-Wcast-function-type-mismatch]
```

This is similar to: https://github.com/llvm/llvm-project/pull/97905

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp 
b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
index a69c10081ff190..a0d0f0ea0abc80 100644
--- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
@@ -179,9 +179,10 @@ const char *TargetThreadWindows::GetName() {
   Log *log = GetLog(LLDBLog::Thread);
   static GetThreadDescriptionFunctionPtr GetThreadDescription = []() {
 HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
-return hModule ? reinterpret_cast(
- ::GetProcAddress(hModule, "GetThreadDescription"))
-   : nullptr;
+return hModule
+   ? reinterpret_cast(
+ (void *)::GetProcAddress(hModule, "GetThreadDescription"))
+   : nullptr;
   }();
   LLDB_LOGF(log, "GetProcAddress: %p",
 reinterpret_cast(GetThreadDescription));



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)

2024-08-11 Thread Dmitrii Galimzianov via lldb-commits

https://github.com/DmT021 created 
https://github.com/llvm/llvm-project/pull/102835

When we search for a symbol, we first check if it is in the module_sp of the 
current SymbolContext, and if not, we check in the target's modules. However, 
the target's ModuleList also includes the already checked module, which leads 
to a redundant search in it.

>From c417f458aed8a177e75ae83ead687d7b64a0 Mon Sep 17 00:00:00 2001
From: Dmitrii Galimzianov 
Date: Mon, 12 Aug 2024 01:09:33 +0200
Subject: [PATCH] Remove redundant symbol lookups in
 IRExecutionUnit::FindInSymbols

When we search for a symbol, we first check if it is in the module_sp of the 
current SymbolContext, and if not, we check in the target's modules. However, 
the target's ModuleList also includes the already checked module, which leads 
to a redundant search in it.
---
 lldb/source/Expression/IRExecutionUnit.cpp | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index f220704423627d..ad089e36eba7d6 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -785,6 +785,10 @@ IRExecutionUnit::FindInSymbols(const 
std::vector &names,
 return LLDB_INVALID_ADDRESS;
   }
 
+  ModuleList images = target->GetImages();
+  // We'll process module_sp separately, before the other modules.
+  images.Remove(sc.module_sp);
+
   LoadAddressResolver resolver(target, symbol_was_missing_weak);
 
   ModuleFunctionSearchOptions function_options;
@@ -799,20 +803,21 @@ IRExecutionUnit::FindInSymbols(const 
std::vector &names,
   sc_list);
   if (auto load_addr = resolver.Resolve(sc_list))
 return *load_addr;
-}
 
-if (sc.target_sp) {
-  SymbolContextList sc_list;
-  sc.target_sp->GetImages().FindFunctions(name, 
lldb::eFunctionNameTypeFull,
-  function_options, sc_list);
+  sc.module_sp->FindSymbolsWithNameAndType(name, lldb::eSymbolTypeAny,
+   sc_list);
   if (auto load_addr = resolver.Resolve(sc_list))
 return *load_addr;
 }
 
-if (sc.target_sp) {
+{
   SymbolContextList sc_list;
-  sc.target_sp->GetImages().FindSymbolsWithNameAndType(
-  name, lldb::eSymbolTypeAny, sc_list);
+  images.FindFunctions(name, lldb::eFunctionNameTypeFull, function_options,
+   sc_list);
+  if (auto load_addr = resolver.Resolve(sc_list))
+return *load_addr;
+
+  images.FindSymbolsWithNameAndType(name, lldb::eSymbolTypeAny, sc_list);
   if (auto load_addr = resolver.Resolve(sc_list))
 return *load_addr;
 }

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)

2024-08-11 Thread via lldb-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/102835
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)

2024-08-11 Thread Dmitrii Galimzianov via lldb-commits

DmT021 wrote:

@augusto2112 Please take a look

https://github.com/llvm/llvm-project/pull/102835
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)

2024-08-11 Thread Younan Zhang via lldb-commits

zyn0217 wrote:

> See for example CXXRecordDecl's getLambdaContextDecl function.
> Unfortunately there is an issue where we currently only store this lambda 
> context when we need it for mangling reasons, …

Yeah, I remember we use that to store an ImplicitConceptSpecializationDecl as 
well, not only for the purpose of mangling but also for lambdas appearing 
inside a concept. We probably could do the same for the using aliases, though 
that still needs some tweaking to store template arguments.

https://github.com/llvm/llvm-project/pull/101858
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Avoid calling DataLayout constructor accepting Module pointer (NFC) (PR #102839)

2024-08-11 Thread Sergei Barannikov via lldb-commits

https://github.com/s-barannikov created 
https://github.com/llvm/llvm-project/pull/102839

The constructor initializes `*this` with a copy of `M->getDataLayout()`, which 
can just be spelled as `DataLayout DL = M->getDataLayout()`. In all places 
where the constructor is used, Module outlives DataLayout, so store a reference 
to it instead of cloning.

>From e3cdec63767738ca0e5fe640f9e01996ec1ecc22 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov 
Date: Mon, 12 Aug 2024 03:53:28 +0300
Subject: [PATCH] [lldb] Avoid calling DataLayout constructor accepting Module
 pointer (NFC)

The constructor initializes `*this` with a copy of `M->getDataLayout()`,
which can just be spelled as `DataLayout DL = M->getDataLayout()`.
In all places where the constructor is used, Module outlives DataLayout,
so store a reference to it instead of cloning.
---
 lldb/source/Expression/IRInterpreter.cpp   | 6 +++---
 .../Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp | 7 +++
 lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp | 2 +-
 lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h   | 4 ++--
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/lldb/source/Expression/IRInterpreter.cpp 
b/lldb/source/Expression/IRInterpreter.cpp
index 5b670067b5c433..030b30f070ee35 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -96,7 +96,7 @@ class InterpreterStackFrame {
   typedef std::map ValueMap;
 
   ValueMap m_values;
-  DataLayout &m_target_data;
+  const DataLayout &m_target_data;
   lldb_private::IRExecutionUnit &m_execution_unit;
   const BasicBlock *m_bb = nullptr;
   const BasicBlock *m_prev_bb = nullptr;
@@ -110,7 +110,7 @@ class InterpreterStackFrame {
   lldb::ByteOrder m_byte_order;
   size_t m_addr_byte_size;
 
-  InterpreterStackFrame(DataLayout &target_data,
+  InterpreterStackFrame(const DataLayout &target_data,
 lldb_private::IRExecutionUnit &execution_unit,
 lldb::addr_t stack_frame_bottom,
 lldb::addr_t stack_frame_top)
@@ -703,7 +703,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, 
llvm::Function &function,
   s.c_str());
   }
 
-  DataLayout data_layout(&module);
+  const DataLayout &data_layout = module.getDataLayout();
 
   InterpreterStackFrame frame(data_layout, execution_unit, stack_frame_bottom,
   stack_frame_top);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
index bc0f5993aad0d6..defd72bbd93106 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
@@ -280,10 +280,9 @@ class Instrumenter {
 
   IntegerType *GetIntptrTy() {
 if (!m_intptr_ty) {
-  llvm::DataLayout data_layout(&m_module);
-
-  m_intptr_ty = llvm::Type::getIntNTy(m_module.getContext(),
-  data_layout.getPointerSizeInBits());
+  m_intptr_ty = llvm::Type::getIntNTy(
+  m_module.getContext(),
+  m_module.getDataLayout().getPointerSizeInBits());
 }
 
 return m_intptr_ty;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index cc9bd14c6194e4..34461da46dfc7b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -1606,7 +1606,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
   lldb_private::Log *log(GetLog(LLDBLog::Expressions));
 
   m_module = &llvm_module;
-  m_target_data = std::make_unique(m_module);
+  m_target_data = &m_module->getDataLayout();
   m_intptr_ty = llvm::Type::getIntNTy(m_module->getContext(),
   m_target_data->getPointerSizeInBits());
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h 
b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
index a924187ba04c06..45027fcd6fa492 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
@@ -331,9 +331,9 @@ class IRForTarget {
   lldb_private::TypeFromParser m_result_type;
   /// The module being processed, or NULL if that has not been determined yet.
   llvm::Module *m_module = nullptr;
-  /// The target data for the module being processed, or NULL if there is no
+  /// The target data for the module being processed, or nullptr if there is no
   /// module.
-  std::unique_ptr m_target_data;
+  const llvm::DataLayout *m_target_data = nullptr;
   /// The DeclMap containing the Decls
   lldb_private::ClangExpressionDeclMap *m_decl_map;
   /// The address of the function CFStringCreateWithBytes, cast to the

___
lldb-commits mailing list
lldb-commits@li

[Lldb-commits] [lldb] [lldb] Avoid calling DataLayout constructor accepting Module pointer (NFC) (PR #102839)

2024-08-11 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Sergei Barannikov (s-barannikov)


Changes

The constructor initializes `*this` with a copy of `M->getDataLayout()`, 
which can just be spelled as `DataLayout DL = M->getDataLayout()`. In all 
places where the constructor is used, Module outlives DataLayout, so store a 
reference to it instead of cloning.

---
Full diff: https://github.com/llvm/llvm-project/pull/102839.diff


4 Files Affected:

- (modified) lldb/source/Expression/IRInterpreter.cpp (+3-3) 
- (modified) lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp 
(+3-4) 
- (modified) lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (+1-1) 
- (modified) lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h (+2-2) 


``diff
diff --git a/lldb/source/Expression/IRInterpreter.cpp 
b/lldb/source/Expression/IRInterpreter.cpp
index 5b670067b5c433..030b30f070ee35 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -96,7 +96,7 @@ class InterpreterStackFrame {
   typedef std::map ValueMap;
 
   ValueMap m_values;
-  DataLayout &m_target_data;
+  const DataLayout &m_target_data;
   lldb_private::IRExecutionUnit &m_execution_unit;
   const BasicBlock *m_bb = nullptr;
   const BasicBlock *m_prev_bb = nullptr;
@@ -110,7 +110,7 @@ class InterpreterStackFrame {
   lldb::ByteOrder m_byte_order;
   size_t m_addr_byte_size;
 
-  InterpreterStackFrame(DataLayout &target_data,
+  InterpreterStackFrame(const DataLayout &target_data,
 lldb_private::IRExecutionUnit &execution_unit,
 lldb::addr_t stack_frame_bottom,
 lldb::addr_t stack_frame_top)
@@ -703,7 +703,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, 
llvm::Function &function,
   s.c_str());
   }
 
-  DataLayout data_layout(&module);
+  const DataLayout &data_layout = module.getDataLayout();
 
   InterpreterStackFrame frame(data_layout, execution_unit, stack_frame_bottom,
   stack_frame_top);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
index bc0f5993aad0d6..defd72bbd93106 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
@@ -280,10 +280,9 @@ class Instrumenter {
 
   IntegerType *GetIntptrTy() {
 if (!m_intptr_ty) {
-  llvm::DataLayout data_layout(&m_module);
-
-  m_intptr_ty = llvm::Type::getIntNTy(m_module.getContext(),
-  data_layout.getPointerSizeInBits());
+  m_intptr_ty = llvm::Type::getIntNTy(
+  m_module.getContext(),
+  m_module.getDataLayout().getPointerSizeInBits());
 }
 
 return m_intptr_ty;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index cc9bd14c6194e4..34461da46dfc7b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -1606,7 +1606,7 @@ bool IRForTarget::runOnModule(Module &llvm_module) {
   lldb_private::Log *log(GetLog(LLDBLog::Expressions));
 
   m_module = &llvm_module;
-  m_target_data = std::make_unique(m_module);
+  m_target_data = &m_module->getDataLayout();
   m_intptr_ty = llvm::Type::getIntNTy(m_module->getContext(),
   m_target_data->getPointerSizeInBits());
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h 
b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
index a924187ba04c06..45027fcd6fa492 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
@@ -331,9 +331,9 @@ class IRForTarget {
   lldb_private::TypeFromParser m_result_type;
   /// The module being processed, or NULL if that has not been determined yet.
   llvm::Module *m_module = nullptr;
-  /// The target data for the module being processed, or NULL if there is no
+  /// The target data for the module being processed, or nullptr if there is no
   /// module.
-  std::unique_ptr m_target_data;
+  const llvm::DataLayout *m_target_data = nullptr;
   /// The DeclMap containing the Decls
   lldb_private::ClangExpressionDeclMap *m_decl_map;
   /// The address of the function CFStringCreateWithBytes, cast to the

``




https://github.com/llvm/llvm-project/pull/102839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Avoid calling DataLayout constructor accepting Module pointer (NFC) (PR #102839)

2024-08-11 Thread Sergei Barannikov via lldb-commits

https://github.com/s-barannikov edited 
https://github.com/llvm/llvm-project/pull/102839
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits