[Lldb-commits] [libcxx] [flang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [clang] [libcxxabi] [lld] [lldb] [mlir] [Mips] Fix unable to handle inline assembly ends with compat-branch o… (PR #7729

2024-02-04 Thread via lldb-commits

yingopq wrote:

> What assembly does GCC emit, and how does GNU as deal with that assembly? 
> That is, how do those two tools interact in the GNU world when dealing with 
> forbidden slots?

All results were same: add nop after beqzc.
```
$ cat a.s
.set reorder
bbb:
beqzc $t1, bbb
b bbb
$ sudo mipsel-linux-gnu-as -mips32r6 a.s
$ mipsel-linux-gnu-objdump -d a.out

a.out: file format elf32-tradlittlemips


Disassembly of section .text:

 :
   0:   d93fbeqzc   t1,0 
   4:   nop
   8:   1000b   8 
   c:   nop
```

and
```
$ sudo mipsel-linux-gnu-gcc -mips32r6 -c a.s -o hello.o
$ mipsel-linux-gnu-objdump -d hello.o 

hello.o: file format elf32-tradlittlemips


Disassembly of section .text:

 :
   0:   d93fbeqzc   t1,0 
   4:   nop
   8:   1000b   8 
   c:   nop
```

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


[Lldb-commits] [libcxx] [flang] [compiler-rt] [libc] [clang-tools-extra] [llvm] [clang] [libcxxabi] [lld] [lldb] [mlir] [Mips] Fix unable to handle inline assembly ends with compat-branch o… (PR #7729

2024-02-04 Thread via lldb-commits

yingopq wrote:

> What assembly does GCC emit, and how does GNU as deal with that assembly? 
> That is, how do those two tools interact in the GNU world when dealing with 
> forbidden slots?

All results were same: add nop after beqzc.
```
$ cat a.s
.set reorder
bbb:
beqzc $t1, bbb
b bbb
$ sudo mipsel-linux-gnu-as -mips32r6 a.s
$ mipsel-linux-gnu-objdump -d a.out

a.out: file format elf32-tradlittlemips


Disassembly of section .text:

 :
   0:   d93fbeqzc   t1,0 
   4:   nop
   8:   1000b   8 
   c:   nop
```

and
```
$ sudo mipsel-linux-gnu-gcc -mips32r6 -c a.s -o hello.o
$ mipsel-linux-gnu-objdump -d hello.o 

hello.o: file format elf32-tradlittlemips


Disassembly of section .text:

 :
   0:   d93fbeqzc   t1,0 
   4:   nop
   8:   1000b   8 
   c:   nop
```

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


[Lldb-commits] [lldb] [lldb][libc++] Adds system_clock data formatters. (PR #78609)

2024-02-04 Thread Mark de Wever via lldb-commits

mordante wrote:

@jasonmolenda I'm not using a mac, but based on your results I expect that 
`std::size_t` is a 64-bit _unsigned_ integer type. Is that correct?

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


[Lldb-commits] [lldb] [lldb] Remove unused private TypeCategoryMap methods (NFC) (PR #80602)

2024-02-04 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/80602

None

>From 8f2a96e57efb6b073c12903abbe4846f9be4e2ea Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Fri, 30 Jun 2023 17:02:02 -0700
Subject: [PATCH] [lldb] Remove unused private TypeCategoryMap methods (NFC)

---
 lldb/include/lldb/DataFormatters/TypeCategoryMap.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h 
b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
index efd01f321da92..b1981233378bf 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -94,12 +94,6 @@ class TypeCategoryMap {
 
   MapType m_map;
   ActiveCategoriesList m_active_categories;
-
-  MapType &map() { return m_map; }
-
-  ActiveCategoriesList &active_list() { return m_active_categories; }
-
-  std::recursive_mutex &mutex() { return m_map_mutex; }
 };
 } // namespace lldb_private
 

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


[Lldb-commits] [lldb] [lldb] Remove unused private TypeCategoryMap methods (NFC) (PR #80602)

2024-02-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) lldb/include/lldb/DataFormatters/TypeCategoryMap.h (-6) 


``diff
diff --git a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h 
b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
index efd01f321da92..b1981233378bf 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -94,12 +94,6 @@ class TypeCategoryMap {
 
   MapType m_map;
   ActiveCategoriesList m_active_categories;
-
-  MapType &map() { return m_map; }
-
-  ActiveCategoriesList &active_list() { return m_active_categories; }
-
-  std::recursive_mutex &mutex() { return m_map_mutex; }
 };
 } // namespace lldb_private
 

``




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


[Lldb-commits] [lldb] [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (PR #80603)

2024-02-04 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/80603

None

>From 28553f88104374a14858451858ef034f4298faae Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 1 Jun 2023 16:57:04 -0700
Subject: [PATCH] [lldb] Remove unnecessary FormatCache::GetEntry (NFC)

---
 lldb/include/lldb/DataFormatters/FormatCache.h |  5 +
 lldb/source/DataFormatters/FormatCache.cpp | 18 +-
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/lldb/include/lldb/DataFormatters/FormatCache.h 
b/lldb/include/lldb/DataFormatters/FormatCache.h
index e75aaee1a7bb8..3f1baa26a5a54 100644
--- a/lldb/include/lldb/DataFormatters/FormatCache.h
+++ b/lldb/include/lldb/DataFormatters/FormatCache.h
@@ -45,15 +45,12 @@ class FormatCache {
 void Set(lldb::TypeSummaryImplSP);
 void Set(lldb::SyntheticChildrenSP);
   };
-  typedef std::map CacheMap;
-  CacheMap m_map;
+  std::map m_entries;
   std::recursive_mutex m_mutex;
 
   uint64_t m_cache_hits = 0;
   uint64_t m_cache_misses = 0;
 
-  Entry &GetEntry(ConstString type);
-
 public:
   FormatCache() = default;
 
diff --git a/lldb/source/DataFormatters/FormatCache.cpp 
b/lldb/source/DataFormatters/FormatCache.cpp
index 5e0965fcdae40..6c83b36e79dea 100644
--- a/lldb/source/DataFormatters/FormatCache.cpp
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -51,14 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP 
synthetic_sp) {
   m_synthetic_sp = synthetic_sp;
 }
 
-FormatCache::Entry &FormatCache::GetEntry(ConstString type) {
-  auto i = m_map.find(type), e = m_map.end();
-  if (i != e)
-return i->second;
-  m_map[type] = FormatCache::Entry();
-  return m_map[type];
-}
-
 namespace lldb_private {
 
 template<> bool FormatCache::Entry::IsCached() {
@@ -76,7 +68,7 @@ template<> bool 
FormatCache::Entry::IsCached() {
 template 
 bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) {
   std::lock_guard guard(m_mutex);
-  auto entry = GetEntry(type);
+  auto entry = m_entries[type];
   if (entry.IsCached()) {
 m_cache_hits++;
 entry.Get(format_impl_sp);
@@ -101,21 +93,21 @@ FormatCache::Get(ConstString,
 
 void FormatCache::Set(ConstString type, lldb::TypeFormatImplSP &format_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(format_sp);
+  m_entries[type].Set(format_sp);
 }
 
 void FormatCache::Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(summary_sp);
+  m_entries[type].Set(summary_sp);
 }
 
 void FormatCache::Set(ConstString type,
   lldb::SyntheticChildrenSP &synthetic_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(synthetic_sp);
+  m_entries[type].Set(synthetic_sp);
 }
 
 void FormatCache::Clear() {
   std::lock_guard guard(m_mutex);
-  m_map.clear();
+  m_entries.clear();
 }

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


[Lldb-commits] [lldb] [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (PR #80603)

2024-02-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


2 Files Affected:

- (modified) lldb/include/lldb/DataFormatters/FormatCache.h (+1-4) 
- (modified) lldb/source/DataFormatters/FormatCache.cpp (+5-13) 


``diff
diff --git a/lldb/include/lldb/DataFormatters/FormatCache.h 
b/lldb/include/lldb/DataFormatters/FormatCache.h
index e75aaee1a7bb8..3f1baa26a5a54 100644
--- a/lldb/include/lldb/DataFormatters/FormatCache.h
+++ b/lldb/include/lldb/DataFormatters/FormatCache.h
@@ -45,15 +45,12 @@ class FormatCache {
 void Set(lldb::TypeSummaryImplSP);
 void Set(lldb::SyntheticChildrenSP);
   };
-  typedef std::map CacheMap;
-  CacheMap m_map;
+  std::map m_entries;
   std::recursive_mutex m_mutex;
 
   uint64_t m_cache_hits = 0;
   uint64_t m_cache_misses = 0;
 
-  Entry &GetEntry(ConstString type);
-
 public:
   FormatCache() = default;
 
diff --git a/lldb/source/DataFormatters/FormatCache.cpp 
b/lldb/source/DataFormatters/FormatCache.cpp
index 5e0965fcdae40..6c83b36e79dea 100644
--- a/lldb/source/DataFormatters/FormatCache.cpp
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -51,14 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP 
synthetic_sp) {
   m_synthetic_sp = synthetic_sp;
 }
 
-FormatCache::Entry &FormatCache::GetEntry(ConstString type) {
-  auto i = m_map.find(type), e = m_map.end();
-  if (i != e)
-return i->second;
-  m_map[type] = FormatCache::Entry();
-  return m_map[type];
-}
-
 namespace lldb_private {
 
 template<> bool FormatCache::Entry::IsCached() {
@@ -76,7 +68,7 @@ template<> bool 
FormatCache::Entry::IsCached() {
 template 
 bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) {
   std::lock_guard guard(m_mutex);
-  auto entry = GetEntry(type);
+  auto entry = m_entries[type];
   if (entry.IsCached()) {
 m_cache_hits++;
 entry.Get(format_impl_sp);
@@ -101,21 +93,21 @@ FormatCache::Get(ConstString,
 
 void FormatCache::Set(ConstString type, lldb::TypeFormatImplSP &format_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(format_sp);
+  m_entries[type].Set(format_sp);
 }
 
 void FormatCache::Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(summary_sp);
+  m_entries[type].Set(summary_sp);
 }
 
 void FormatCache::Set(ConstString type,
   lldb::SyntheticChildrenSP &synthetic_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(synthetic_sp);
+  m_entries[type].Set(synthetic_sp);
 }
 
 void FormatCache::Clear() {
   std::lock_guard guard(m_mutex);
-  m_map.clear();
+  m_entries.clear();
 }

``




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


[Lldb-commits] [lldb] [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (PR #80603)

2024-02-04 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Mark de Wever via lldb-commits

https://github.com/mordante created 
https://github.com/llvm/llvm-project/pull/80609

The code is heavily based on the vector data formatter.

>From 12b03c9ff9f6ddb0a011d8f958e3a826bd7603b9 Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Sun, 4 Feb 2024 18:46:50 +0100
Subject: [PATCH] [lldb][libc++] Adds valarray data formatters.

The code is heavily based on the vector data formatter.
---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |   9 ++
 .../Plugins/Language/CPlusPlus/LibCxx.h   |   4 +
 .../Language/CPlusPlus/LibCxxValarray.cpp | 140 ++
 .../libcxx/valarray/Makefile  |   5 +
 .../TestDataFormatterLibcxxValarray.py|  78 ++
 .../libcxx/valarray/main.cpp  |  17 +++
 7 files changed, 254 insertions(+)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 21108b27896a1..97fa894ea7376 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -17,6 +17,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibCxxTuple.cpp
   LibCxxUnorderedMap.cpp
   LibCxxVariant.cpp
+  LibCxxValarray.cpp
   LibCxxVector.cpp
   LibStdcpp.cpp
   LibStdcppTuple.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index e0de80880376a..af2f97f6b40ee 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -750,6 +750,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
   "libc++ std::vector synthetic children",
   "^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
+  lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator,
+  "libc++ std::valarray synthetic children",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator,
@@ -871,6 +876,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::vector summary provider",
 "^std::__[[:alnum:]]+::vector<.+>$", stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::valarray summary provider",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_summary_flags, true);
   AddCXXSummary(
   cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
   "libc++ std::list summary provider",
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
index 72da6b2426efe..a3fff03f2c642 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -219,6 +219,10 @@ SyntheticChildrenFrontEnd *
 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
 lldb::ValueObjectSP);
 
+SyntheticChildrenFrontEnd *
+LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP);
+
 SyntheticChildrenFrontEnd *
 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
   lldb::ValueObjectSP);
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
new file mode 100644
index 0..5ec4df3da3c90
--- /dev/null
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
@@ -0,0 +1,140 @@
+//===-- LibCxxValarray.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "LibCxx.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include 
+
+using nam

[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Mark de Wever (mordante)


Changes

The code is heavily based on the vector data formatter.

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


7 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt (+1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+9) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (+4) 
- (added) lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp (+140) 
- (added) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile
 (+5) 
- (added) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py
 (+78) 
- (added) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp
 (+17) 


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 21108b27896a1..97fa894ea7376 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -17,6 +17,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibCxxTuple.cpp
   LibCxxUnorderedMap.cpp
   LibCxxVariant.cpp
+  LibCxxValarray.cpp
   LibCxxVector.cpp
   LibStdcpp.cpp
   LibStdcppTuple.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index e0de80880376a..af2f97f6b40ee 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -750,6 +750,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
   "libc++ std::vector synthetic children",
   "^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
+  lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator,
+  "libc++ std::valarray synthetic children",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator,
@@ -871,6 +876,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::vector summary provider",
 "^std::__[[:alnum:]]+::vector<.+>$", stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::valarray summary provider",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_summary_flags, true);
   AddCXXSummary(
   cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
   "libc++ std::list summary provider",
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
index 72da6b2426efe..a3fff03f2c642 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -219,6 +219,10 @@ SyntheticChildrenFrontEnd *
 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
 lldb::ValueObjectSP);
 
+SyntheticChildrenFrontEnd *
+LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP);
+
 SyntheticChildrenFrontEnd *
 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
   lldb::ValueObjectSP);
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
new file mode 100644
index 0..5ec4df3da3c90
--- /dev/null
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
@@ -0,0 +1,140 @@
+//===-- LibCxxValarray.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "LibCxx.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace lldb_private {
+namespace formatters {
+class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~LibcxxStdValarraySyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren()

[Lldb-commits] [lldb] [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (PR #80603)

2024-02-04 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (PR #80603)

2024-02-04 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] 9ff83f1 - [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (#80603)

2024-02-04 Thread via lldb-commits

Author: Dave Lee
Date: 2024-02-04T11:47:24-08:00
New Revision: 9ff83f12fe406f9c3c6b2cd0ee96660a7485f29f

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

LOG: [lldb] Remove unnecessary FormatCache::GetEntry (NFC) (#80603)

The implementation of `FormatCache::Entry
&FormatCache::GetEntry(ConstString)` is effectively a duplication of
`std::map::operator[]`. This change deletes `GetEntry` and replaces its
use with `operator[]`.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/FormatCache.h
lldb/source/DataFormatters/FormatCache.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/FormatCache.h 
b/lldb/include/lldb/DataFormatters/FormatCache.h
index e75aaee1a7bb8..3f1baa26a5a54 100644
--- a/lldb/include/lldb/DataFormatters/FormatCache.h
+++ b/lldb/include/lldb/DataFormatters/FormatCache.h
@@ -45,15 +45,12 @@ class FormatCache {
 void Set(lldb::TypeSummaryImplSP);
 void Set(lldb::SyntheticChildrenSP);
   };
-  typedef std::map CacheMap;
-  CacheMap m_map;
+  std::map m_entries;
   std::recursive_mutex m_mutex;
 
   uint64_t m_cache_hits = 0;
   uint64_t m_cache_misses = 0;
 
-  Entry &GetEntry(ConstString type);
-
 public:
   FormatCache() = default;
 

diff  --git a/lldb/source/DataFormatters/FormatCache.cpp 
b/lldb/source/DataFormatters/FormatCache.cpp
index 5e0965fcdae40..6c83b36e79dea 100644
--- a/lldb/source/DataFormatters/FormatCache.cpp
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -51,14 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP 
synthetic_sp) {
   m_synthetic_sp = synthetic_sp;
 }
 
-FormatCache::Entry &FormatCache::GetEntry(ConstString type) {
-  auto i = m_map.find(type), e = m_map.end();
-  if (i != e)
-return i->second;
-  m_map[type] = FormatCache::Entry();
-  return m_map[type];
-}
-
 namespace lldb_private {
 
 template<> bool FormatCache::Entry::IsCached() {
@@ -76,7 +68,7 @@ template<> bool 
FormatCache::Entry::IsCached() {
 template 
 bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) {
   std::lock_guard guard(m_mutex);
-  auto entry = GetEntry(type);
+  auto entry = m_entries[type];
   if (entry.IsCached()) {
 m_cache_hits++;
 entry.Get(format_impl_sp);
@@ -101,21 +93,21 @@ FormatCache::Get(ConstString,
 
 void FormatCache::Set(ConstString type, lldb::TypeFormatImplSP &format_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(format_sp);
+  m_entries[type].Set(format_sp);
 }
 
 void FormatCache::Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(summary_sp);
+  m_entries[type].Set(summary_sp);
 }
 
 void FormatCache::Set(ConstString type,
   lldb::SyntheticChildrenSP &synthetic_sp) {
   std::lock_guard guard(m_mutex);
-  GetEntry(type).Set(synthetic_sp);
+  m_entries[type].Set(synthetic_sp);
 }
 
 void FormatCache::Clear() {
   std::lock_guard guard(m_mutex);
-  m_map.clear();
+  m_entries.clear();
 }



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


[Lldb-commits] [lldb] [lldb] Cleanup regex in libcxx formatters (NFC) (PR #80618)

2024-02-04 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/80618

None

>From 9381ad39a74ed10446d1832813dfb1d5cfb24758 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Sun, 4 Feb 2024 13:15:58 -0800
Subject: [PATCH] [lldb] Cleanup regex in libcxx formatters (NFC)

---
 .../Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index e0de80880376a..1dcda53350afa 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -788,7 +788,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator,
   "libc++ std::unordered containers synthetic children",
-  "^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$",
+  "^std::__[[:alnum:]]+::unordered_(multi)?(map|set)<.+> >$",
   stl_synth_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
@@ -824,7 +824,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   "^std::__[[:alnum:]]+::ranges::ref_view<.+>$", stl_deref_flags, true);
 
   cpp_category_sp->AddTypeSynthetic(
-  "^(std::__[[:alnum:]]+::)deque<.+>$", eFormatterMatchRegex,
+  "^std::__[[:alnum:]]+::deque<.+>$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -832,8 +832,8 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
-  "shared_ptr synthetic children",
-  "^(std::__[[:alnum:]]+::)shared_ptr<.+>$", stl_synth_flags, true);
+  "shared_ptr synthetic children", "^std::__[[:alnum:]]+::shared_ptr<.+>$",
+  stl_synth_flags, true);
 
   static constexpr const char *const libcxx_std_unique_ptr_regex =
   "^std::__[[:alnum:]]+::unique_ptr<.+>$";
@@ -846,7 +846,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
-  "weak_ptr synthetic children", "^(std::__[[:alnum:]]+::)weak_ptr<.+>$",
+  "weak_ptr synthetic children", "^std::__[[:alnum:]]+::weak_ptr<.+>$",
   stl_synth_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxFunctionSummaryProvider,
@@ -910,7 +910,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::unordered containers summary provider",
-"^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$",
+"^std::__[[:alnum:]]+::unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp, LibcxxContainerSummaryProvider,
 "libc++ std::tuple summary provider",

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


[Lldb-commits] [lldb] [lldb] Cleanup regex in libcxx formatters (NFC) (PR #80618)

2024-02-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(+6-6) 


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index e0de80880376a..1dcda53350afa 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -788,7 +788,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator,
   "libc++ std::unordered containers synthetic children",
-  "^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$",
+  "^std::__[[:alnum:]]+::unordered_(multi)?(map|set)<.+> >$",
   stl_synth_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
@@ -824,7 +824,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   "^std::__[[:alnum:]]+::ranges::ref_view<.+>$", stl_deref_flags, true);
 
   cpp_category_sp->AddTypeSynthetic(
-  "^(std::__[[:alnum:]]+::)deque<.+>$", eFormatterMatchRegex,
+  "^std::__[[:alnum:]]+::deque<.+>$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -832,8 +832,8 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
-  "shared_ptr synthetic children",
-  "^(std::__[[:alnum:]]+::)shared_ptr<.+>$", stl_synth_flags, true);
+  "shared_ptr synthetic children", "^std::__[[:alnum:]]+::shared_ptr<.+>$",
+  stl_synth_flags, true);
 
   static constexpr const char *const libcxx_std_unique_ptr_regex =
   "^std::__[[:alnum:]]+::unique_ptr<.+>$";
@@ -846,7 +846,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
-  "weak_ptr synthetic children", "^(std::__[[:alnum:]]+::)weak_ptr<.+>$",
+  "weak_ptr synthetic children", "^std::__[[:alnum:]]+::weak_ptr<.+>$",
   stl_synth_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxFunctionSummaryProvider,
@@ -910,7 +910,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::unordered containers summary provider",
-"^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$",
+"^std::__[[:alnum:]]+::unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp, LibcxxContainerSummaryProvider,
 "libc++ std::tuple summary provider",

``




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


[Lldb-commits] [lldb] [lldb] Cleanup regex in libcxx formatters (NFC) (PR #80618)

2024-02-04 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-02-04 Thread Michael Buch via lldb-commits

Michael137 wrote:

ping

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits


@@ -871,6 +876,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::vector summary provider",
 "^std::__[[:alnum:]]+::vector<.+>$", stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::valarray summary provider",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_summary_flags, true);

Michael137 wrote:

Do we need `(( )?&)?` here?

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits


@@ -0,0 +1,140 @@
+//===-- LibCxxValarray.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "LibCxx.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace lldb_private {
+namespace formatters {
+class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~LibcxxStdValarraySyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(ConstString name) override;
+
+private:
+  ValueObject *m_start = nullptr;

Michael137 wrote:

Can we add brief doxygen comments explaining what these represent? At least for 
`m_start` and `m_finish`

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits


@@ -0,0 +1,140 @@
+//===-- LibCxxValarray.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "LibCxx.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace lldb_private {
+namespace formatters {
+class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~LibcxxStdValarraySyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(ConstString name) override;
+
+private:
+  ValueObject *m_start = nullptr;
+  ValueObject *m_finish = nullptr;
+  CompilerType m_element_type;
+  uint32_t m_element_size = 0;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() {
+  if (valobj_sp)
+Update();
+}
+
+lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+~LibcxxStdValarraySyntheticFrontEnd() {
+  // these need to stay around because they are child objects who will follow
+  // their parent's life cycle
+  // delete m_start;
+  // delete m_finish;
+}
+
+size_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+CalculateNumChildren() {
+  if (!m_start || !m_finish)
+return 0;
+  uint64_t start_val = m_start->GetValueAsUnsigned(0);
+  uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
+
+  if (start_val == 0 || finish_val == 0)
+return 0;
+
+  if (start_val >= finish_val)
+return 0;
+
+  size_t num_children = (finish_val - start_val);
+  if (num_children % m_element_size)
+return 0;
+  return num_children / m_element_size;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::GetChildAtIndex(
+size_t idx) {
+  if (!m_start || !m_finish)
+return lldb::ValueObjectSP();
+
+  uint64_t offset = idx * m_element_size;
+  offset = offset + m_start->GetValueAsUnsigned(0);
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(name.GetString(), offset,
+  m_backend.GetExecutionContextRef(),
+  m_element_type);
+}
+
+bool lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::Update() {
+  m_start = m_finish = nullptr;
+
+  CompilerType type = m_backend.GetCompilerType();
+  if (type.GetNumTemplateArguments() == 0)
+return false;
+
+  m_element_type = type.GetTypeTemplateArgument(0);
+  if (std::optional size = m_element_type.GetByteSize(nullptr))
+m_element_size = *size;
+
+  if (m_element_size == 0)
+return false;
+
+  ValueObjectSP start = m_backend.GetChildMemberWithName("__begin_");
+  ValueObjectSP finish = m_backend.GetChildMemberWithName("__end_");
+
+  if (!start || !finish)
+return false;
+
+  m_start = start.get();
+  m_finish = finish.get();
+
+  return false;
+}
+
+bool lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+MightHaveChildren() {
+  return true;
+}
+
+size_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+GetIndexOfChildWithName(ConstString name) {
+  if (!m_start || !m_finish)
+return UINT32_MAX;

Michael137 wrote:

should we use `std::numeric_limits` here?

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits

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

LGTM to me generally (just some minor stylistic comments)

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits


@@ -750,6 +750,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
   "libc++ std::vector synthetic children",
   "^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
+  lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator,
+  "libc++ std::valarray synthetic children",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_deref_flags, true);

Michael137 wrote:

Do we need the `(( )?&)?` part?

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Michael Buch via lldb-commits


@@ -0,0 +1,140 @@
+//===-- LibCxxValarray.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "LibCxx.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace lldb_private {
+namespace formatters {
+class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~LibcxxStdValarraySyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(ConstString name) override;
+
+private:
+  ValueObject *m_start = nullptr;

Michael137 wrote:

I think we should also add a comment about lifetime here (e.g., `pointer is 
held, not owned`)

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


[Lldb-commits] [lldb] [lldb] Cleanup regex in libcxx formatters (NFC) (PR #80618)

2024-02-04 Thread Michael Buch via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)

2024-02-04 Thread Dave Lee via lldb-commits


@@ -750,6 +750,11 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
   lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
   "libc++ std::vector synthetic children",
   "^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
+  lldb_private::formatters::LibcxxStdValarraySyntheticFrontEndCreator,
+  "libc++ std::valarray synthetic children",
+  "^std::__[[:alnum:]]+::valarray<.+>(( )?&)?$", stl_deref_flags, true);

kastiglione wrote:

Not needed, and relatedly I removed a bunch of these 
https://github.com/llvm/llvm-project/pull/79644

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-02-04 Thread Dave Lee via lldb-commits

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

🚢 

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


[Lldb-commits] [lldb] [lldb][libc++] Adds system_clock data formatters. (PR #78609)

2024-02-04 Thread Michael Buch via lldb-commits

Michael137 wrote:

tbf, we are casting the value to an uint64_t and printing it with a `PRIu64`, 
right?:
```
stream.Printf("timestamp=%" PRIu64 " s", static_cast(seconds))
```

So how would we ever expect a `-1096193779200` here?

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-02-04 Thread Michael Buch via lldb-commits

Michael137 wrote:

Will land after https://github.com/llvm/llvm-project/pull/80609 to not disrupt 
that patch

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


[Lldb-commits] [llvm] [clang] [clang-tools-extra] [libc] [libcxx] [flang] [mlir] [openmp] [compiler-rt] [lldb] [lld] [Driver] Report invalid target triple versions for all environment types. (PR #7865

2024-02-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [libcxxabi] [flang] [compiler-rt] [lld] [libc] [llvm] [libcxx] [clang] [clang-tools-extra] [TTI][RISCV]Improve costs for fixed vector whole reg extract/insert. (PR #80164)

2024-02-04 Thread Luke Lau via lldb-commits


@@ -326,6 +326,48 @@ InstructionCost 
RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
 switch (Kind) {
 default:
   break;
+case TTI::SK_ExtractSubvector:
+  if (isa(SubTp) &&
+  LT.second.getVectorElementType() != MVT::i1) {
+unsigned TpRegs = getRegUsageForType(Tp);
+unsigned NumElems =
+divideCeil(Tp->getElementCount().getFixedValue(), TpRegs);
+// Whole vector extract - just the vector itself + (possible) vsetvli.
+// TODO: consider adding the cost for vsetvli.
+if (Index == 0 || (ST->getRealMaxVLen() == ST->getRealMinVLen() &&
+   NumElems * LT.second.getScalarSizeInBits() ==
+   ST->getRealMinVLen() &&
+   Index % NumElems == 0))

lukel97 wrote:

Should we add some test cases that exercise the exact VLEN path? I presume 
we'll need to add another RUN line with `-riscv-v-vector-bits-min=... 
-riscv-v-vector-bits-max=...`

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


[Lldb-commits] [clang-tools-extra] [libcxxabi] [lldb] [libcxx] [clang] [libc] [lld] [flang] [compiler-rt] [llvm] [TTI][RISCV]Improve costs for fixed vector whole reg extract/insert. (PR #80164)

2024-02-04 Thread Luke Lau via lldb-commits


@@ -326,6 +326,48 @@ InstructionCost 
RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
 switch (Kind) {
 default:
   break;
+case TTI::SK_ExtractSubvector:
+  if (isa(SubTp) &&
+  LT.second.getVectorElementType() != MVT::i1) {
+unsigned TpRegs = getRegUsageForType(Tp);
+unsigned NumElems =
+divideCeil(Tp->getElementCount().getFixedValue(), TpRegs);
+// Whole vector extract - just the vector itself + (possible) vsetvli.
+// TODO: consider adding the cost for vsetvli.
+if (Index == 0 || (ST->getRealMaxVLen() == ST->getRealMinVLen() &&
+   NumElems * LT.second.getScalarSizeInBits() ==

lukel97 wrote:

Should this be checking that the extracted subvector type is VLEN sized, not 
the containing vector type? 

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