[Lldb-commits] [lldb] [AMDGPU] Add encoding/decoding support for non-result-returning ATOMIC_CSUB instructions (PR #68197)

2023-10-10 Thread Stephen Thomas via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete updated 
https://github.com/llvm/llvm-project/pull/68452

>From 6d8f61115b159cdf4d00135a76b88b7848dc4103 Mon Sep 17 00:00:00 2001
From: Pete Lawrence 
Date: Thu, 5 Oct 2023 14:22:35 -1000
Subject: [PATCH] [lldb] Update the `po` alias to print Fix-Its to the console.

Modifying `po` alias to match outward FixIt behavior with `expression`.
- Fix `po` alias so that it prints out a message when applying a FixIt, just 
like the `expression` command.
- Add test cases for applying a FixIt with both `expression` command and `po` 
alias.
- Reword console messages for readability.
---
 .../Commands/CommandObjectDWIMPrint.cpp   | 15 ++--
 .../Commands/CommandObjectExpression.cpp  |  8 +++
 .../API/lang/cpp/dwim-print-fixit/Makefile|  3 +++
 .../dwim-print-fixit/TestCppDWIMPrintFixIt.py | 24 +++
 .../API/lang/cpp/dwim-print-fixit/main.cpp|  5 
 .../API/lang/cpp/expression-fixit/Makefile|  3 +++
 .../TestCppExpressionFixIt.py | 24 +++
 .../API/lang/cpp/expression-fixit/main.cpp|  5 
 8 files changed, 81 insertions(+), 6 deletions(-)
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/main.cpp

diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..52ff96316919203 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors only refer to final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..7c7ec9e6c67cfed 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors only refer to final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {
diff --git a/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile 
b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
new file mode 100644
index 000..8b20bcb0502
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
new file mode 100644
index 000..260903f30464caa
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
@@ -0,0 +1,24 @@
+"""
+Tests whether the do-what-I-mean (DWIM) print `po` alias applies FixIts like 
`expr` does
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+def test_with_run_command(self):
+"""Confirms `po` sh

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete updated 
https://github.com/llvm/llvm-project/pull/68452

>From 60dbef776988d89bbf59ae1aa6e4d2b404881b43 Mon Sep 17 00:00:00 2001
From: Pete Lawrence 
Date: Thu, 5 Oct 2023 14:22:35 -1000
Subject: [PATCH] [lldb] Update the `po` alias to print Fix-Its to the console.

Modifying `po` alias to match outward FixIt behavior with `expression`.
- Fix `po` alias so that it prints out a message when applying a FixIt, just 
like the `expression` command.
- Add test cases for applying a FixIt with both `expression` command and `po` 
alias.
- Reword console messages for readability.
---
 .../Commands/CommandObjectDWIMPrint.cpp   | 15 ++--
 .../Commands/CommandObjectExpression.cpp  |  8 +++
 .../API/lang/cpp/dwim-print-fixit/Makefile|  3 +++
 .../dwim-print-fixit/TestCppDWIMPrintFixIt.py | 24 +++
 .../API/lang/cpp/dwim-print-fixit/main.cpp|  5 
 .../API/lang/cpp/expression-fixit/Makefile|  3 +++
 .../TestCppExpressionFixIt.py | 24 +++
 .../API/lang/cpp/expression-fixit/main.cpp|  5 
 8 files changed, 81 insertions(+), 6 deletions(-)
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/main.cpp

diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..bdc17c9cffc779a 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors refer to the final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..2834be660abaf53 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors refer to the final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {
diff --git a/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile 
b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
new file mode 100644
index 000..8b20bcb0502
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
new file mode 100644
index 000..260903f30464caa
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
@@ -0,0 +1,24 @@
+"""
+Tests whether the do-what-I-mean (DWIM) print `po` alias applies FixIts like 
`expr` does
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+def test_with_run_command(self):
+"""Confirms `po` show

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits


@@ -0,0 +1,27 @@
+"""
+Tests whether the do-what-I-mean (DWIM) print `po` alias applies FixIts like 
`expr` does
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class CPP_DWIM_Fixit_TestCase(TestBase):
+def test_with_run_command(self):
+"Confirm that the `po` command (alias) applies a FixIt " \
+"and prints it out to the console, " \
+"just like the `expression` command."

PortalPete wrote:

Fixed with a `"""` string that's one line for doxygen.

```"""Confirms `po` shows an expression after applying Fix-It(s)."""```

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits


@@ -173,7 +173,16 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
 ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options, 
&m_fixed_expression);
+
+// Only mention Fix-Its if the command applies them.
+// The compiler errors can address any parsing issues after applying 
Fix-It(s).

PortalPete wrote:

Fixed to past-test because it comes printing the result.

```cpp
// Only mention Fix-Its if the expression evaluator applied them.
// Compiler errors refer to the final expression after applying Fix-It(s).
```

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Pete Lawrence via lldb-commits


@@ -173,7 +173,16 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
 ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options, 
&m_fixed_expression);
+
+// Only mention Fix-Its if the command applies them.
+// The compiler errors can address any parsing issues after applying 
Fix-It(s).
+if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream.Printf("  Applying Fix-It to expression, changing it to:\n  
  %s\n",

PortalPete wrote:

Changed phrasing to past tense because this message appears after the 
expression's result.

```cpp
error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
error_stream << "" << fixed_expression << "\n";
```

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll created 
https://github.com/llvm/llvm-project/pull/68705

This patch adds a `SBType::FindNestedType(name)` function which performs a 
non-recursive search in given class for a type with specified name. The intent 
is to perform a fast search in debug info, so that it can be used in 
formatters, and let them remain responsive.

This is driven by my work on formatters for Clang and LLVM types. In 
particular, by 
[`PointerIntPairInfo::MaskAndShiftConstants`](https://github.com/llvm/llvm-project/blob/cde9f9df79805a0850310870d6dcc64004292727/llvm/include/llvm/ADT/PointerIntPair.h#L174C16-L174C16),
 which is required to extract pointer and integer from `PointerIntPair`.

Related Discourse thread: 
https://discourse.llvm.org/t/traversing-member-types-of-a-type/72452

>From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Tue, 10 Oct 2023 15:07:56 +0300
Subject: [PATCH] [lldb] Add SBType::FindNestedType() function

---
 lldb/bindings/interface/SBTypeDocstrings.i  |  7 +++
 lldb/include/lldb/API/SBType.h  |  2 ++
 lldb/include/lldb/Symbol/Type.h |  2 ++
 lldb/include/lldb/Symbol/TypeSystem.h   |  4 
 lldb/source/API/SBType.cpp  |  9 +
 .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp|  4 
 .../Plugins/TypeSystem/Clang/TypeSystemClang.h  |  2 ++
 lldb/source/Symbol/Type.cpp | 13 +
 lldb/source/Symbol/TypeSystem.cpp   |  4 
 9 files changed, 47 insertions(+)

diff --git a/lldb/bindings/interface/SBTypeDocstrings.i 
b/lldb/bindings/interface/SBTypeDocstrings.i
index 96421a6aa20104b..b4ec67da957c7d4 100644
--- a/lldb/bindings/interface/SBTypeDocstrings.i
+++ b/lldb/bindings/interface/SBTypeDocstrings.i
@@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,::
 "
 ) lldb::SBType::GetTypeFlags;
 
+%feature("docstring",
+"Searches for a nested type that has provided name.
+
+Returns the type if it was found.
+Returns invalid type if nothing was found."
+) lldb::SBType::FindNestedType;
+
 %feature("docstring",
 "Represents a list of :py:class:`SBType` s.
 
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 5962f0c50dee14f..fa02197ff8f3940 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -215,6 +215,8 @@ class SBType {
   bool GetDescription(lldb::SBStream &description,
   lldb::DescriptionLevel description_level);
 
+  lldb::SBType FindNestedType(const char *name);
+
   lldb::SBType &operator=(const lldb::SBType &rhs);
 
   bool operator==(lldb::SBType &rhs);
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 046501931d211a7..6da4aaba401fe14 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -313,6 +313,8 @@ class TypeImpl {
   bool GetDescription(lldb_private::Stream &strm,
   lldb::DescriptionLevel description_level);
 
+  CompilerType FindNestedType(ConstString name);
+
 private:
   bool CheckModule(lldb::ModuleSP &module_sp) const;
   bool CheckExeModule(lldb::ModuleSP &module_sp) const;
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..b503b66eb528c68 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface,
 
   virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0;
 
+  // CompilerType functions
+
+  virtual CompilerDeclContext GetCompilerDeclContextForType(const 
CompilerType& type);
+
   // Tests
 #ifndef NDEBUG
   /// Verify the integrity of the type to catch CompilerTypes that mix
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index ee5b6447428098e..7fe1836ea5d670b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);
+
+  if (!IsValid())
+return SBType();
+  auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name)));
+  return ret;
+}
+
 SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
   LLDB_INSTRUMENT_VA(this);
 }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const 
CompilerType &type) {
   return GetDeclContextForType(ClangUtil::GetQualType(type));
 }
 
+CompilerDeclContext TypeSystemClang

[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vlad Serebrennikov (Endilll)


Changes

This patch adds a `SBType::FindNestedType(name)` function which performs a 
non-recursive search in given class for a type with specified name. The intent 
is to perform a fast search in debug info, so that it can be used in 
formatters, and let them remain responsive.

This is driven by my work on formatters for Clang and LLVM types. In 
particular, by 
[`PointerIntPairInfo::MaskAndShiftConstants`](https://github.com/llvm/llvm-project/blob/cde9f9df79805a0850310870d6dcc64004292727/llvm/include/llvm/ADT/PointerIntPair.h#L174C16-L174C16),
 which is required to extract pointer and integer from `PointerIntPair`.

Related Discourse thread: 
https://discourse.llvm.org/t/traversing-member-types-of-a-type/72452

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


9 Files Affected:

- (modified) lldb/bindings/interface/SBTypeDocstrings.i (+7) 
- (modified) lldb/include/lldb/API/SBType.h (+2) 
- (modified) lldb/include/lldb/Symbol/Type.h (+2) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+4) 
- (modified) lldb/source/API/SBType.cpp (+9) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+4) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+2) 
- (modified) lldb/source/Symbol/Type.cpp (+13) 
- (modified) lldb/source/Symbol/TypeSystem.cpp (+4) 


``diff
diff --git a/lldb/bindings/interface/SBTypeDocstrings.i 
b/lldb/bindings/interface/SBTypeDocstrings.i
index 96421a6aa20104b..b4ec67da957c7d4 100644
--- a/lldb/bindings/interface/SBTypeDocstrings.i
+++ b/lldb/bindings/interface/SBTypeDocstrings.i
@@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,::
 "
 ) lldb::SBType::GetTypeFlags;
 
+%feature("docstring",
+"Searches for a nested type that has provided name.
+
+Returns the type if it was found.
+Returns invalid type if nothing was found."
+) lldb::SBType::FindNestedType;
+
 %feature("docstring",
 "Represents a list of :py:class:`SBType` s.
 
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 5962f0c50dee14f..fa02197ff8f3940 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -215,6 +215,8 @@ class SBType {
   bool GetDescription(lldb::SBStream &description,
   lldb::DescriptionLevel description_level);
 
+  lldb::SBType FindNestedType(const char *name);
+
   lldb::SBType &operator=(const lldb::SBType &rhs);
 
   bool operator==(lldb::SBType &rhs);
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 046501931d211a7..6da4aaba401fe14 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -313,6 +313,8 @@ class TypeImpl {
   bool GetDescription(lldb_private::Stream &strm,
   lldb::DescriptionLevel description_level);
 
+  CompilerType FindNestedType(ConstString name);
+
 private:
   bool CheckModule(lldb::ModuleSP &module_sp) const;
   bool CheckExeModule(lldb::ModuleSP &module_sp) const;
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..b503b66eb528c68 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface,
 
   virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0;
 
+  // CompilerType functions
+
+  virtual CompilerDeclContext GetCompilerDeclContextForType(const 
CompilerType& type);
+
   // Tests
 #ifndef NDEBUG
   /// Verify the integrity of the type to catch CompilerTypes that mix
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index ee5b6447428098e..7fe1836ea5d670b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);
+
+  if (!IsValid())
+return SBType();
+  auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name)));
+  return ret;
+}
+
 SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
   LLDB_INSTRUMENT_VA(this);
 }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const 
CompilerType &type) {
   return GetDeclContextForType(ClangUtil::GetQualType(type));
 }
 
+CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const 
CompilerType& type) {
+  return CreateDeclContext(GetDeclContextForType(type));
+}
+
 /// Aggressively desugar the provided type, skipping past va

[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 7d4cd47e242c28c450c1e2a1a9f4bd4b7b5a01ab 
ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad -- lldb/include/lldb/API/SBType.h 
lldb/include/lldb/Symbol/Type.h lldb/include/lldb/Symbol/TypeSystem.h 
lldb/source/API/SBType.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
lldb/source/Symbol/Type.cpp lldb/source/Symbol/TypeSystem.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index b503b66eb528..6320a3f60842 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -137,7 +137,8 @@ public:
 
   // CompilerType functions
 
-  virtual CompilerDeclContext GetCompilerDeclContextForType(const 
CompilerType& type);
+  virtual CompilerDeclContext
+  GetCompilerDeclContextForType(const CompilerType &type);
 
   // Tests
 #ifndef NDEBUG
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index b4bf3d3fdb20..bc20720efd6d 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2636,7 +2636,8 @@ TypeSystemClang::GetDeclContextForType(const CompilerType 
&type) {
   return GetDeclContextForType(ClangUtil::GetQualType(type));
 }
 
-CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const 
CompilerType& type) {
+CompilerDeclContext
+TypeSystemClang::GetCompilerDeclContextForType(const CompilerType &type) {
   return CreateDeclContext(GetDeclContextForType(type));
 }
 
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 806ff64ef0af..3abbd2bb0b87 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -219,7 +219,8 @@ public:
 
   static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
 
-  CompilerDeclContext GetCompilerDeclContextForType(const CompilerType &type) 
override;
+  CompilerDeclContext
+  GetCompilerDeclContextForType(const CompilerType &type) override;
 
   uint32_t GetPointerByteSize() override;
 
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 724973b1fd9b..c3438ecb682a 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1088,7 +1088,8 @@ CompilerType TypeImpl::FindNestedType(ConstString name) {
   auto decl_context = 
type_system->GetCompilerDeclContextForType(m_static_type);
   llvm::DenseSet searched_symbol_files;
   TypeMap search_result;
-  symbol_file->FindTypes(name, decl_context, /*max_matches*/ 1, 
searched_symbol_files, search_result);
+  symbol_file->FindTypes(name, decl_context, /*max_matches*/ 1,
+ searched_symbol_files, search_result);
   if (search_result.Empty()) {
 return CompilerType();
   }
diff --git a/lldb/source/Symbol/TypeSystem.cpp 
b/lldb/source/Symbol/TypeSystem.cpp
index ce24e312f4f3..874f12573eca 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -186,7 +186,8 @@ std::optional 
TypeSystem::ReportStatistics() {
   return std::nullopt;
 }
 
-CompilerDeclContext TypeSystem::GetCompilerDeclContextForType(const 
CompilerType& type) {
+CompilerDeclContext
+TypeSystem::GetCompilerDeclContextForType(const CompilerType &type) {
   return CompilerDeclContext();
 }
 

``




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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

Intended usage is going to look like the following for `PointerIntPair`:
```python
class PointerIntPairProvider:
def update(self):
pointer_info = self.valobj.type.template_args[4] # PointerIntPairInfo
masks = pointer_info.FindNestedType("MaskAndShiftConstants")
if masks.IsValid():
for enumerator in enum.enum_members:
if enumerator.name == "PointerBitMask":
pointer_mask = enumerator.unsigned
# extract pointer using the mask
```
Fully qualified name of `PointerIntPairInfo` used in `clang::QualType` is the 
following: `llvm::PointerIntPairInfo, 3, 
llvm::PointerLikeTypeTraits > >::MaskAndShiftConstants`. I'm not sure if existing 
`SBTarget::FindFirstType()` can handle this case as well as proposed function.

I'll submit a proper API test shortly.

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

It should be noted that after calling `FindNestedType` and successfully finding 
`MaskAndShiftConstants` in the example above, the following routine in my fork 
reports that `PointerIntPairInfo` has 2 enums instead of 1:
```cpp
uint32_t TypeSystemClang::GetNumMemberEnums(lldb::opaque_compiler_type_t type) {
  using EnumIt = clang::DeclContext::specific_decl_iterator;
  if (!type)
return 0;

  clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
  if (GetCompleteQualType(&getASTContext(), qual_type)) {
const clang::RecordType *record_type =
llvm::cast(qual_type.getTypePtr());
const clang::RecordDecl *record_decl = record_type->getDecl();
assert(record_decl);
auto result = std::distance(EnumIt(record_decl->decls_begin()), 
EnumIt(record_decl->decls_end()));
return result;
  }
  return 0;
}
```
It's also available here: 
https://github.com/Endilll/llvm-project/blob/fbad2d1fd8e9c67e4de8a196df0cd1d1788fa990/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L7080-L7095

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread via lldb-commits

jimingham wrote:

The idea seems good.  If you are looking for a type and you know it is defined 
inside another type, then providing a way for you to tell lldb that is useful.  

Is FindNestedType guaranteed to have a single return?  What if I had:

class A {
  class B {
  class D {
  };
   };
   class E {
  class D {
  };
};
};

Then I would expect 

```
class_a_type = lldb.target.FindFirstType("A")
class_a_type.FindNestedType("D")

```
to return both A::B::D and A::E::D.  So you might need to return a SBTypeList 
here?  You could also add a `FindFirstWhatever` API to return the first hit in 
case there may be many, though whenever I use that in anything but interactive 
SB API uses I feel like I probably should be being more careful, so I'm of two 
minds about that...
 

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

> Is FindNestedType guaranteed to have a single return?

Yes, because search is not recursive, i.e. doesn't search inside nested types.
I'm intentionally specifying `FindNestedType` this way, because I'd like it to 
not do too much to remain fast by design, and I'm yet to see a use case when 
I'd be interested in type `NN`, buried inside arbitrary number of intervening 
nested types. Even if there is such use case, `SBTarget::FindFirstType` could 
be a better fit to address it.

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [lldb] [lldb][DataFormatter] unordered_map: account for new libc++ __hash_node layout (PR #68574)

2023-10-10 Thread Alex Langford via lldb-commits


@@ -162,10 +162,21 @@ lldb::ValueObjectSP lldb_private::formatters::
   if (!node_sp || error.Fail())
   return nullptr;
 
-  value_sp = node_sp->GetChildMemberWithName("__value_");
   hash_sp = node_sp->GetChildMemberWithName("__hash_");
-  if (!value_sp || !hash_sp)
+  if (!hash_sp)
 return nullptr;
+
+  value_sp = node_sp->GetChildMemberWithName("__value_");
+  if (!value_sp) {
+// Newer libc++ versions wrap the `__value_` in an anonymous union.

bulbazord wrote:

Definitely better. I assume phabricator will be read-only mode for quite a 
while to come, so I'm not too worried about it being difficult to find. We 
should probably update it with a commit hash once it lands though.

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread via lldb-commits

jimingham wrote:

Not sure why you say "SBTarget::FindFirstType" is a replacement for the deeper 
search, since it will search the whole type landscape which is what your search 
allows us to avoid...

You could make this API more general by adding a "depth" parameter:

SBType::FindNestedTypes(const char *name, uint32_t depth);


Your use case would pass depth of 1, and retain the speed you intend, but allow 
for more general searches.

If you do that I think the API is great.  If you still just want to do 1 level 
depth search, then I think you have to reflect that more clearly in the name.  
I would NOT expect FindNestedType to only search one level deep because that's 
the only way it would be guaranteed to only return a singular type.  If you 
want to keep it this way, you should do something like "FindDirectlyNestedType" 
though that makes it more obvious that this is an oddly limited API...

Jim


> On Oct 10, 2023, at 9:58 AM, Vlad Serebrennikov ***@***.***> wrote:
> 
> 
> Is FindNestedType guaranteed to have a single return?
> 
> Yes, because search is not recursive, i.e. doesn't search inside nested types.
> I'm intentionally specifying FindNestedType this way, because I'd like it to 
> not do too much to remain fast by design, and I'm yet to see a use case when 
> I'd be interested in type NN, buried inside arbitrary number of intervening 
> nested types. Even if there is such use case, SBTarget::FindFirstType could 
> be a better fit to address it.
> 
> —
> Reply to this email directly, view it on GitHub 
> , or 
> unsubscribe 
> .
> You are receiving this because your review was requested.
> 



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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

`depth` parameter makes sense to me.
I wonder if it should have a default value 0 meaning infinite depth.

Now I wonder how my current implementation behaves with respect to depth, which 
is actually embarrassing. And how to implement `depth` parameter. 

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


[Lldb-commits] [lldb] [lldb][DataFormatter] unordered_map: account for new libc++ __hash_node layout (PR #68574)

2023-10-10 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread via lldb-commits

jimingham wrote:

0 to mean unlimited search sounds good to me.

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Alex Langford via lldb-commits


@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);

bulbazord wrote:

`name` needs to be in the instrumentation macro
```
LLDB_INSTRUMENT_VA(this, name);
```

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Alex Langford via lldb-commits


@@ -1082,6 +1082,19 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
   return true;
 }
 
+CompilerType TypeImpl::FindNestedType(ConstString name) {
+  auto type_system = GetTypeSystem(false);
+  auto *symbol_file = type_system->GetSymbolFile();
+  auto decl_context = 
type_system->GetCompilerDeclContextForType(m_static_type);
+  llvm::DenseSet searched_symbol_files;
+  TypeMap search_result;
+  symbol_file->FindTypes(name, decl_context, /*max_matches*/ 1, 
searched_symbol_files, search_result);
+  if (search_result.Empty()) {
+return CompilerType();
+  }

bulbazord wrote:

llvm style is to avoid braces for single-line if statements. 
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Alex Langford via lldb-commits


@@ -1082,6 +1082,19 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
   return true;
 }
 
+CompilerType TypeImpl::FindNestedType(ConstString name) {
+  auto type_system = GetTypeSystem(false);

bulbazord wrote:

Can you add an inline comment for this false? It's not obvious what it means 
here. Something like:
```
auto type_system = GetTypeSystem(/*param_name*/ false);
```

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


[Lldb-commits] [lldb] 606f89a - [lldb] Fix `po` alias by printing fix-its to the console. (#68452)

2023-10-10 Thread via lldb-commits

Author: Pete Lawrence
Date: 2023-10-10T13:59:58-07:00
New Revision: 606f89ab7d537ca068fb1be9fd89d96a30de38f8

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

LOG: [lldb] Fix `po` alias by printing fix-its to the console. (#68452)

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419

Co-authored-by: Pete Lawrence 

Added: 
lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
lldb/test/API/lang/cpp/expression-fixit/Makefile
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
lldb/test/API/lang/cpp/expression-fixit/main.cpp

Modified: 
lldb/source/Commands/CommandObjectDWIMPrint.cpp
lldb/source/Commands/CommandObjectExpression.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..bdc17c9cffc779a 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors refer to the final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;

diff  --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..2834be660abaf53 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors refer to the final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {

diff  --git a/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile 
b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
new file mode 100644
index 000..8b20bcb0502
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git a/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
new file mode 100644
index 000..260903f30464caa
--- /dev/null
+++ b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
@@ -0,0 +1,24 @@
+"""
+Tests whether the do-what-I-mean (DWIM) print `po` alias applies FixIts like 
`expr` does
+"""
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+def test_with_run_command(self):
+"""Confirms `po` shows an expression after applying Fix-It(s)."""
+
+self.build()
+lldbutil.run_to_source_breakpoint(
+self, "// break here", lldb.SBFileSp

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-10 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] 2e59b75 - Revert "[lldb] Fix `po` alias by printing fix-its to the console. (#68452)"

2023-10-10 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2023-10-10T14:56:00-07:00
New Revision: 2e59b7550e3678a10be1a26f651488fc665a1f09

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

LOG: Revert "[lldb] Fix `po` alias by printing fix-its to the console. (#68452)"

This reverts commit 606f89ab7d537ca068fb1be9fd89d96a30de38f8 while 
investigating bot failures.

Added: 


Modified: 
lldb/source/Commands/CommandObjectDWIMPrint.cpp
lldb/source/Commands/CommandObjectExpression.cpp

Removed: 
lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
lldb/test/API/lang/cpp/expression-fixit/Makefile
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
lldb/test/API/lang/cpp/expression-fixit/main.cpp



diff  --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index bdc17c9cffc779a..7b168eab9e02d44 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,19 +172,8 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-std::string fixed_expression;
-
-ExpressionResults expr_result = target.EvaluateExpression(
-expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
-
-// Only mention Fix-Its if the expression evaluator applied them.
-// Compiler errors refer to the final expression after applying Fix-It(s).
-if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-  Stream &error_stream = result.GetErrorStream();
-  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
-  error_stream << "" << fixed_expression << "\n";
-}
-
+ExpressionResults expr_result =
+target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;

diff  --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index 2834be660abaf53..e7e6e3820b99133 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // Only mention Fix-Its if the expression evaluator applied them.
-  // Compiler errors refer to the final expression after applying Fix-It(s).
+  // We only tell you about the FixIt if we applied it.  The compiler errors
+  // will suggest the FixIt if it parsed.
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
-error_stream << "" << m_fixed_expression << "\n";
+error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
+m_fixed_expression.c_str());
   }
 
   if (result_valobj_sp) {

diff  --git a/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile 
b/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
deleted file mode 100644
index 8b20bcb0502..000
--- a/lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules

diff  --git a/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
b/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
deleted file mode 100644
index 260903f30464caa..000
--- a/lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
+++ /dev/null
@@ -1,24 +0,0 @@
-"""
-Tests whether the do-what-I-mean (DWIM) print `po` alias applies FixIts like 
`expr` does
-"""
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class TestCase(TestBase):
-def test_with_run_command(self):
-"""Confirms `po` shows an expression after applying Fix-It(s)."""
-
-self.build()
-lldbutil.run_to_source_breakpoint(
-self, "// break here", lldb.SBFileSpec("main.cpp")
-)
-
-self.expect(
-"dwim-print -O -- class C { int i; void f() { []() { ++i; }(); } 
}; 42",
-error = True,
-substrs=["Evaluated this expression after applying Fix-It(s)",
-"class C { int i; void f() { [this]() { ++i; }(); } }"],
-)

diff  --git a/lldb/test/API/lang/cpp/dwim-print-fixi

[Lldb-commits] [lldb] [lldb-vscode] Update installation instructions (PR #68234)

2023-10-10 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

FWIW I ran into the same issue and ended up using [these 
instructions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension).

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete created 
https://github.com/llvm/llvm-project/pull/68755

The `po` alias now matches the behavior of the `expression` command when the it 
can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a 
`protected` member that stores the post Fix-It expression, just like the 
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both `po` and 
`expressions`

rdar://115317419

>From ee8e9b698edac7c44d77441a86844f94b045b9d1 Mon Sep 17 00:00:00 2001
From: Pete Lawrence <34425917+portalp...@users.noreply.github.com>
Date: Tue, 10 Oct 2023 10:59:58 -1000
Subject: [PATCH] [lldb] Fix `po` alias by printing fix-its to the console.

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419
---
 .../Commands/CommandObjectDWIMPrint.cpp   | 15 ++--
 .../Commands/CommandObjectExpression.cpp  |  8 +++
 .../commands/expression/fixits/TestFixIts.py  |  4 ++--
 .../API/lang/cpp/dwim-print-fixit/Makefile|  3 +++
 .../dwim-print-fixit/TestCppDWIMPrintFixIt.py | 24 +++
 .../API/lang/cpp/dwim-print-fixit/main.cpp|  5 
 .../API/lang/cpp/expression-fixit/Makefile|  3 +++
 .../TestCppExpressionFixIt.py | 24 +++
 .../API/lang/cpp/expression-fixit/main.cpp|  5 
 9 files changed, 83 insertions(+), 8 deletions(-)
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/main.cpp

diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..bdc17c9cffc779a 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors refer to the final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..2834be660abaf53 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors refer to the final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {
diff --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py 
b/lldb/test/API/commands/expression/fixits/TestFixIts.py
index 3bdeb84b4e79726..92a3ae8b943e318 100644
--- a/lldb/test/API/commands/expression/fixits/TestFixIts.py
++

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pete Lawrence (PortalPete)


Changes

The `po` alias now matches the behavior of the `expression` command when the it 
can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a 
`protected` member that stores the post Fix-It expression, just like the 
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both `po` and 
`expressions`

rdar://115317419

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


9 Files Affected:

- (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+13-2) 
- (modified) lldb/source/Commands/CommandObjectExpression.cpp (+4-4) 
- (modified) lldb/test/API/commands/expression/fixits/TestFixIts.py (+2-2) 
- (added) lldb/test/API/lang/cpp/dwim-print-fixit/Makefile (+3) 
- (added) lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
(+24) 
- (added) lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp (+5) 
- (added) lldb/test/API/lang/cpp/expression-fixit/Makefile (+3) 
- (added) lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py 
(+24) 
- (added) lldb/test/API/lang/cpp/expression-fixit/main.cpp (+5) 


``diff
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..bdc17c9cffc779a 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors refer to the final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..2834be660abaf53 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors refer to the final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {
diff --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py 
b/lldb/test/API/commands/expression/fixits/TestFixIts.py
index 3bdeb84b4e79726..92a3ae8b943e318 100644
--- a/lldb/test/API/commands/expression/fixits/TestFixIts.py
+++ b/lldb/test/API/commands/expression/fixits/TestFixIts.py
@@ -22,7 +22,7 @@ def test_with_dummy_target(self):
 self.assertEqual(
 result, lldb.eReturnStatusSuccessFinishResult, ret_val.GetError()
 )
-self.assertIn("Fix-it applied", ret_val.GetError())
+self.assertIn("Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError())
 
 def test_with_target(self):
 """Test calling expressions with errors that can be fixed by the 
FixIts."""
@@ -99,7 +99,7 @@ def test_with_target_error_applies_fixit(self):
 )
 self.assertEqual(result, lldb.eReturnStatusFailed, ret_val.GetError())
 
-self.assertIn("Fix-it applied, fixed expression was:", 
ret_val.GetError())
+self.assertIn("Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError())
 self.assertIn("null_pointer->first", ret_val.GetError())
 
 # The final function call runs into SIGILL on aarch64-linux.
diff --git a/lldb/test/API/lan

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
4df74963ea0f6c8650d5837ab52e3cdcf1dcf016..ee8e9b698edac7c44d77441a86844f94b045b9d1
 lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py 
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py 
lldb/test/API/commands/expression/fixits/TestFixIts.py
``





View the diff from darker here.


``diff
--- commands/expression/fixits/TestFixIts.py2023-10-10 23:52:02.00 +
+++ commands/expression/fixits/TestFixIts.py2023-10-11 00:05:10.993363 +
@@ -20,11 +20,13 @@
 "expression ((1 << 16) - 1))", ret_val
 )
 self.assertEqual(
 result, lldb.eReturnStatusSuccessFinishResult, ret_val.GetError()
 )
-self.assertIn("Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError())
+self.assertIn(
+"Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError()
+)
 
 def test_with_target(self):
 """Test calling expressions with errors that can be fixed by the 
FixIts."""
 self.build()
 (target, process, self.thread, bkpt) = 
lldbutil.run_to_source_breakpoint(
@@ -97,11 +99,13 @@
 result = self.dbg.GetCommandInterpreter().HandleCommand(
 "expression null_pointer.first", ret_val
 )
 self.assertEqual(result, lldb.eReturnStatusFailed, ret_val.GetError())
 
-self.assertIn("Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError())
+self.assertIn(
+"Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError()
+)
 self.assertIn("null_pointer->first", ret_val.GetError())
 
 # The final function call runs into SIGILL on aarch64-linux.
 @expectedFailureAll(
 archs=["aarch64"], oslist=["freebsd", "linux"], 
bugnumber="llvm.org/pr49407"

``




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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread Pete Lawrence via lldb-commits

https://github.com/PortalPete updated 
https://github.com/llvm/llvm-project/pull/68755

>From 5d48fc34f1ae2fcbbf24294e10aab4152c865221 Mon Sep 17 00:00:00 2001
From: Pete Lawrence <34425917+portalp...@users.noreply.github.com>
Date: Tue, 10 Oct 2023 10:59:58 -1000
Subject: [PATCH] [lldb] Fix `po` alias by printing fix-its to the console.

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419
---
 .../Commands/CommandObjectDWIMPrint.cpp   | 15 +--
 .../Commands/CommandObjectExpression.cpp  |  8 +++---
 .../commands/expression/fixits/TestFixIts.py  |  8 --
 .../API/lang/cpp/dwim-print-fixit/Makefile|  3 +++
 .../dwim-print-fixit/TestCppDWIMPrintFixIt.py | 26 +++
 .../API/lang/cpp/dwim-print-fixit/main.cpp|  5 
 .../API/lang/cpp/expression-fixit/Makefile|  3 +++
 .../TestCppExpressionFixIt.py | 26 +++
 .../API/lang/cpp/expression-fixit/main.cpp|  5 
 9 files changed, 91 insertions(+), 8 deletions(-)
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/dwim-print-fixit/TestCppDWIMPrintFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/dwim-print-fixit/main.cpp
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/Makefile
 create mode 100644 
lldb/test/API/lang/cpp/expression-fixit/TestCppExpressionFixIt.py
 create mode 100644 lldb/test/API/lang/cpp/expression-fixit/main.cpp

diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 7b168eab9e02d44..bdc17c9cffc779a 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -172,8 +172,19 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+std::string fixed_expression;
+
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &fixed_expression);
+
+// Only mention Fix-Its if the expression evaluator applied them.
+// Compiler errors refer to the final expression after applying Fix-It(s).
+if (!fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Evaluated this expression after applying 
Fix-It(s):\n";
+  error_stream << "" << fixed_expression << "\n";
+}
+
 if (expr_result == eExpressionCompleted) {
   if (verbosity != eDWIMPrintVerbosityNone) {
 StringRef flags;
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e3820b99133..2834be660abaf53 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
   ExpressionResults success = target.EvaluateExpression(
   expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
 
-  // We only tell you about the FixIt if we applied it.  The compiler errors
-  // will suggest the FixIt if it parsed.
+  // Only mention Fix-Its if the expression evaluator applied them.
+  // Compiler errors refer to the final expression after applying Fix-It(s).
   if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
-error_stream.Printf("  Fix-it applied, fixed expression was: \n%s\n",
-m_fixed_expression.c_str());
+error_stream << "  Evaluated this expression after applying Fix-It(s):\n";
+error_stream << "" << m_fixed_expression << "\n";
   }
 
   if (result_valobj_sp) {
diff --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py 
b/lldb/test/API/commands/expression/fixits/TestFixIts.py
index 3bdeb84b4e79726..38b242838c828f1 100644
--- a/lldb/test/API/commands/expression/fixits/TestFixIts.py
+++ b/lldb/test/API/commands/expression/fixits/TestFixIts.py
@@ -22,7 +22,9 @@ def test_with_dummy_target(self):
 self.assertEqual(
 result, lldb.eReturnStatusSuccessFinishResult, ret_val.GetError()
 )
-self.assertIn("Fix-it applied", ret_val.GetError())
+self.assertIn(
+"Evaluated this expression after applying Fix-It(s):", 
ret_val.GetError()
+)
 
 def test_with_target(self):
 """Test 

[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll updated 
https://github.com/llvm/llvm-project/pull/68705

>From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Tue, 10 Oct 2023 15:07:56 +0300
Subject: [PATCH 1/3] [lldb] Add SBType::FindNestedType() function

---
 lldb/bindings/interface/SBTypeDocstrings.i  |  7 +++
 lldb/include/lldb/API/SBType.h  |  2 ++
 lldb/include/lldb/Symbol/Type.h |  2 ++
 lldb/include/lldb/Symbol/TypeSystem.h   |  4 
 lldb/source/API/SBType.cpp  |  9 +
 .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp|  4 
 .../Plugins/TypeSystem/Clang/TypeSystemClang.h  |  2 ++
 lldb/source/Symbol/Type.cpp | 13 +
 lldb/source/Symbol/TypeSystem.cpp   |  4 
 9 files changed, 47 insertions(+)

diff --git a/lldb/bindings/interface/SBTypeDocstrings.i 
b/lldb/bindings/interface/SBTypeDocstrings.i
index 96421a6aa20104b..b4ec67da957c7d4 100644
--- a/lldb/bindings/interface/SBTypeDocstrings.i
+++ b/lldb/bindings/interface/SBTypeDocstrings.i
@@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,::
 "
 ) lldb::SBType::GetTypeFlags;
 
+%feature("docstring",
+"Searches for a nested type that has provided name.
+
+Returns the type if it was found.
+Returns invalid type if nothing was found."
+) lldb::SBType::FindNestedType;
+
 %feature("docstring",
 "Represents a list of :py:class:`SBType` s.
 
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 5962f0c50dee14f..fa02197ff8f3940 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -215,6 +215,8 @@ class SBType {
   bool GetDescription(lldb::SBStream &description,
   lldb::DescriptionLevel description_level);
 
+  lldb::SBType FindNestedType(const char *name);
+
   lldb::SBType &operator=(const lldb::SBType &rhs);
 
   bool operator==(lldb::SBType &rhs);
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 046501931d211a7..6da4aaba401fe14 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -313,6 +313,8 @@ class TypeImpl {
   bool GetDescription(lldb_private::Stream &strm,
   lldb::DescriptionLevel description_level);
 
+  CompilerType FindNestedType(ConstString name);
+
 private:
   bool CheckModule(lldb::ModuleSP &module_sp) const;
   bool CheckExeModule(lldb::ModuleSP &module_sp) const;
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..b503b66eb528c68 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface,
 
   virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0;
 
+  // CompilerType functions
+
+  virtual CompilerDeclContext GetCompilerDeclContextForType(const 
CompilerType& type);
+
   // Tests
 #ifndef NDEBUG
   /// Verify the integrity of the type to catch CompilerTypes that mix
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index ee5b6447428098e..7fe1836ea5d670b 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);
+
+  if (!IsValid())
+return SBType();
+  auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name)));
+  return ret;
+}
+
 SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
   LLDB_INSTRUMENT_VA(this);
 }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const 
CompilerType &type) {
   return GetDeclContextForType(ClangUtil::GetQualType(type));
 }
 
+CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const 
CompilerType& type) {
+  return CreateDeclContext(GetDeclContextForType(type));
+}
+
 /// Aggressively desugar the provided type, skipping past various kinds of
 /// syntactic sugar and other constructs one typically wants to ignore.
 /// The \p mask argument allows one to skip certain kinds of simplifications,
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0544de3cd33befb..806ff64ef0af76b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem {

[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits


@@ -1082,6 +1082,19 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
   return true;
 }
 
+CompilerType TypeImpl::FindNestedType(ConstString name) {
+  auto type_system = GetTypeSystem(false);

Endilll wrote:

Done!

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits


@@ -1082,6 +1082,19 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
   return true;
 }
 
+CompilerType TypeImpl::FindNestedType(ConstString name) {
+  auto type_system = GetTypeSystem(false);
+  auto *symbol_file = type_system->GetSymbolFile();
+  auto decl_context = 
type_system->GetCompilerDeclContextForType(m_static_type);
+  llvm::DenseSet searched_symbol_files;
+  TypeMap search_result;
+  symbol_file->FindTypes(name, decl_context, /*max_matches*/ 1, 
searched_symbol_files, search_result);
+  if (search_result.Empty()) {
+return CompilerType();
+  }

Endilll wrote:

Done!

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Vlad Serebrennikov via lldb-commits


@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);

Endilll wrote:

I didn't knew this. Thank you!

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


[Lldb-commits] [lldb] a9d5056 - Use llvm::endianness (NFC)

2023-10-10 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-10T21:54:15-07:00
New Revision: a9d50568625e4f2e021d6229f8c1c721a3d82d51

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

LOG: Use llvm::endianness (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
support::endianness with llvm::endianness.

Added: 


Modified: 
lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
llvm/include/llvm/BinaryFormat/MsgPack.h
llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h
llvm/include/llvm/MC/MCAsmBackend.h
llvm/include/llvm/Object/ELFTypes.h
llvm/include/llvm/Object/StackMapParser.h
llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/ProfileData/InstrProfData.inc
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/include/llvm/ProfileData/InstrProfWriter.h
llvm/include/llvm/Support/ELFAttributeParser.h
llvm/include/llvm/Support/HashBuilder.h
llvm/include/llvm/Support/VersionTuple.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.h
llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp
llvm/lib/DWARFLinkerParallel/OutputSections.h
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/ELF_aarch32.cpp
llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
llvm/lib/MC/MCAsmBackend.cpp
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfWriter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendELF.h
llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVAsmBackend.cpp
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Removed: 




diff  --git a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp 
b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
index 2c6b9a2299dd7d0..7ccc9210daad092 100644
--- a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -53,7 +53,7 @@ Expected ProcessInfo::create(StringRef response) 
{
 
 lldb::pid_t ProcessInfo::GetPid() const { return m_pid; }
 
-support::endianness ProcessInfo::GetEndian() const { return m_endian; }
+llvm::endianness ProcessInfo::GetEndian() const { return m_endian; }
 
 //== ThreadInfo 

 ThreadInfo::ThreadInfo(StringRef name, StringRef reason, RegisterMap registers,
@@ -237,7 +237,7 @@ StopReply::create(StringRef Response, llvm::endianness 
Endian,
 
 Expected StopReplyStop::parseRegisters(
 const StringMap> &Elements,
-support::endianness Endian, ArrayRef RegInfos) 
{
+llvm::endianness Endian, ArrayRef RegInfos) {
 
   RegisterMap Result;
   for (const auto &E : Elements) {
@@ -263,7 +263,7 @@ Expected StopReplyStop::parseRegisters(
 }
 
 Expected>
-StopReplyStop::create(StringRef Response, support::endianness Endian,
+StopReplyStop::create(StringRef Response, llvm::endianness Endian,
   ArrayRef RegInfos) {
   unsigned int Signal;
   StringRef SignalStr = Response.take_front(2);

diff  --g

[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Med Ismail Bennani via lldb-commits


@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind 
SBType::GetTemplateArgumentKind(uint32_t idx) {
   return eTemplateArgumentKindNull;
 }
 
+SBType SBType::FindNestedType(const char *name) {
+  LLDB_INSTRUMENT_VA(this);
+
+  if (!IsValid())
+return SBType();
+  auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name)));

medismailben wrote:

It would be nice if we could avoid creating the `ConstString` this early.

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


[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

2023-10-10 Thread Med Ismail Bennani via lldb-commits


@@ -313,6 +313,8 @@ class TypeImpl {
   bool GetDescription(lldb_private::Stream &strm,
   lldb::DescriptionLevel description_level);
 
+  CompilerType FindNestedType(ConstString name);

medismailben wrote:

Do we want to make a `ConstString` for every argument that is passed to 
`FindNestedType` ?

I think this should take an `llvm::StringRef` and only make a `ConstString` out 
of it (if needed) when we know the name matches an actual type.

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


[Lldb-commits] [lldb] b888592 - Use llvm::endianness::{big, little, native} (NFC)

2023-10-10 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-10T22:54:51-07:00
New Revision: b8885926f8115d5fe2c06907e066cae061d5f230

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

LOG: Use llvm::endianness::{big,little,native} (NFC)

Note that llvm::support::endianness has been renamed to
llvm::endianness while becoming an enum class as opposed to an enum.
This patch replaces llvm::support::{big,little,native} with
llvm::endianness::{big,little,native}.

Added: 


Modified: 
clang/lib/APINotes/APINotesWriter.cpp
clang/lib/Basic/SourceManager.cpp
clang/lib/Driver/OffloadBundler.cpp
lld/ELF/DWARF.h
lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
llvm/include/llvm/Support/BinaryByteStream.h
llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
llvm/lib/DebugInfo/CodeView/RecordName.cpp
llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
llvm/tools/llvm-objdump/MachODump.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/llvm-readobj/MachODumper.cpp
llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp
llvm/unittests/Support/BinaryStreamTest.cpp
llvm/unittests/Support/HashBuilderTest.cpp
llvm/unittests/Support/YAMLIOTest.cpp

Removed: 




diff  --git a/clang/lib/APINotes/APINotesWriter.cpp 
b/clang/lib/APINotes/APINotesWriter.cpp
index a92b379a8e56acb..770d78e22050c01 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -294,7 +294,7 @@ class IdentifierTableInfo {
 uint32_t KeyLength = Key.size();
 uint32_t DataLength = sizeof(uint32_t);
 
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(KeyLength);
 writer.write(DataLength);
 return {KeyLength, DataLength};
@@ -303,7 +303,7 @@ class IdentifierTableInfo {
   void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { OS << Key; }
 
   void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Data);
   }
 };
@@ -326,7 +326,7 @@ void APINotesWriter::Implementation::writeIdentifierBlock(
 llvm::raw_svector_ostream BlobStream(HashTableBlob);
 // Make sure that no bucket is at offset 0
 llvm::support::endian::write(BlobStream, 0,
-   llvm::support::little);
+   llvm::endianness::little);
 Offset = Generator.Emit(BlobStream);
   }
 
@@ -354,21 +354,21 @@ class ObjCContextIDTableInfo {
 uint32_t KeyLength = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t);
 uint32_t DataLength = sizeof(uint32_t);
 
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(KeyLength);
 writer.write(DataLength);
 return {KeyLength, DataLength};
   }
 
   void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Key.parentContextID);
 writer.write(Key.contextKind);
 writer.write(Key.contextID);
   }
 
   void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Data);
   }
 };
@@ -406,7 +406,7 @@ unsigned getVersionedInfoSize(
 
 /// Emit a serialized representation of a version tuple.
 void emitVersionTuple(raw_ostream &OS, const VersionTuple &VT) {
-  llvm::support::endian::Writer writer(OS, llvm::support::little);
+  

[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread Med Ismail Bennani via lldb-commits

medismailben wrote:

LGTM overall. I think you can make the test less redundant by using the same 
source file & Makefile for both tests.

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


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68755)

2023-10-10 Thread Med Ismail Bennani via lldb-commits

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


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