[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113073)

2024-10-20 Thread Nikita Popov via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb] Remove stack_logging.h (PR #112987)

2024-10-20 Thread Kristof Beyls via lldb-commits

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

Removing the file obviously helps resolve the non-LLVM-licensed issue with it :)
I don't have insights into whether this file is used at all, but I'm trusting 
you know that well enough.

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-20 Thread Lu Weining via lldb-commits

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-20 Thread Lu Weining via lldb-commits


@@ -833,6 +845,107 @@ def test_riscv64_regs_gpr_only(self):
 substrs=["registers were unavailable"],
 )
 
+@skipIfLLVMTargetMissing("LoongArch")
+def test_loongarch64_regs(self):
+# check registers using 64 bit LoongArch core file containing GP and 
FP registers
+target = self.dbg.CreateTarget(None)
+self.assertTrue(target, VALID_TARGET)
+process = target.LoadCore("linux-loongarch64.core")
+
+values = {}
+values["r0"] = "0x"
+values["r1"] = "0x0001216c"
+values["r2"] = "0x"
+values["r3"] = "0x7b8249e0"
+values["r4"] = "0x"
+values["r5"] = "0x0001210c"
+values["r6"] = "0x"
+values["r7"] = "0x"
+values["r8"] = "0x"
+values["r9"] = "0x"
+values["r10"] = "0x"
+values["r11"] = "0x00dd"
+values["r12"] = "0x"
+values["r13"] = "0x002f"
+values["r14"] = "0x"
+values["r15"] = "0x"
+values["r16"] = "0x"
+values["r17"] = "0x"
+values["r18"] = "0x"
+values["r19"] = "0x"
+values["r20"] = "0x"
+values["r21"] = "0x"
+values["r22"] = "0x7b824a10"
+values["r23"] = "0x"
+values["r24"] = "0x"
+values["r25"] = "0x"
+values["r26"] = "0x"
+values["r27"] = "0x"
+values["r28"] = "0x"
+values["r29"] = "0x"
+values["r30"] = "0x"
+values["r31"] = "0x"
+values["orig_a0"] = "0x56b62d50"
+values["pc"] = "0x0001212c"
+
+fpr_values = {}
+fpr_values["f0"] = "0xff05"
+fpr_values["f1"] = "0x2525252525252525"
+fpr_values["f2"] = "0x2525252525560005"
+fpr_values["f3"] = "0x"
+fpr_values["f4"] = "0x"
+fpr_values["f5"] = "0x0008"
+fpr_values["f6"] = "0x0f0e0d0c0b0a0908"
+fpr_values["f7"] = "0x"
+fpr_values["f8"] = "0x6261747563657845"
+fpr_values["f9"] = "0x766173206562206c"
+fpr_values["f10"] = "0x"
+fpr_values["f11"] = "0x"
+fpr_values["f12"] = "0x"
+fpr_values["f13"] = "0x"
+fpr_values["f14"] = "0x"
+fpr_values["f15"] = "0x"
+fpr_values["f16"] = "0x"
+fpr_values["f17"] = "0x"
+fpr_values["f18"] = "0x"
+fpr_values["f19"] = "0x"
+fpr_values["f20"] = "0x"
+fpr_values["f21"] = "0x"
+fpr_values["f22"] = "0x"
+fpr_values["f23"] = "0x"
+fpr_values["f24"] = "0x"
+fpr_values["f25"] = "0x"
+fpr_values["f26"] = "0x"
+fpr_values["f27"] = "0x"
+fpr_values["f28"] = "0x"
+fpr_values["f29"] = "0x"
+fpr_values["f30"] = "0x"
+fpr_values["f31"] = "0x"
+fpr_values["fcc0"] = "0x01"
+fpr_values["fcc1"] = "0x00"
+fpr_values["fcc2"] = "0x01"
+fpr_values["fcc3"] = "0x01"
+fpr_values["fcc4"] = "0x01"
+fpr_values["fcc5"] = "0x01"
+fpr_values["fcc6"] = "0x00"
+fpr_values["fcc7"] = "0x01"
+fpr_values["fcsr"] = "0x"

SixWeining wrote:

(lldb) register read fcsr 
fcsr = 0x

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-20 Thread Lu Weining via lldb-commits

https://github.com/SixWeining commented:

Looks good to me once the `code_formatter` CI fail and fcsr format issues are 
addressed.

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


[Lldb-commits] [lldb] Push down cpython module to the submodule (PR #113066)

2024-10-20 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113121)

2024-10-20 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/113121

None

>From 14a4eccbbde981c5ff3a4d9e3081398d5609a699 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sun, 20 Oct 2024 12:07:41 -0700
Subject: [PATCH] [lldb] Avoid repeated map lookups (NFC)

---
 lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 584c2115459c66..4fc48b4d133382 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1295,12 +1295,11 @@ void SymbolFilePDB::CacheFunctionNames() {
 continue;
 
   if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
-auto vm_addr = pub_sym_up->getVirtualAddress();
-
 // PDB public symbol has mangled name for its associated function.
-if (vm_addr && addr_ids.find(vm_addr) != addr_ids.end()) {
-  // Cache mangled name.
-  m_func_full_names.Append(ConstString(name), addr_ids[vm_addr]);
+if (auto vm_addr = pub_sym_up->getVirtualAddress()) {
+  if (auto it = addr_ids.find(vm_addr); it != addr_ids.end())
+// Cache mangled name.
+m_func_full_names.Append(ConstString(name), it->second);
 }
   }
 }

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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113121)

2024-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (+4-5) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 584c2115459c66..4fc48b4d133382 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1295,12 +1295,11 @@ void SymbolFilePDB::CacheFunctionNames() {
 continue;
 
   if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
-auto vm_addr = pub_sym_up->getVirtualAddress();
-
 // PDB public symbol has mangled name for its associated function.
-if (vm_addr && addr_ids.find(vm_addr) != addr_ids.end()) {
-  // Cache mangled name.
-  m_func_full_names.Append(ConstString(name), addr_ids[vm_addr]);
+if (auto vm_addr = pub_sym_up->getVirtualAddress()) {
+  if (auto it = addr_ids.find(vm_addr); it != addr_ids.end())
+// Cache mangled name.
+m_func_full_names.Append(ConstString(name), it->second);
 }
   }
 }

``




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


[Lldb-commits] [lldb] 8673d0e - [lldb] Avoid repeated map lookups (NFC) (#113073)

2024-10-20 Thread via lldb-commits

Author: Kazu Hirata
Date: 2024-10-20T09:07:10-07:00
New Revision: 8673d0e0673dd1a5e6f7a5df7509c45e33582987

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

LOG: [lldb] Avoid repeated map lookups (NFC) (#113073)

Added: 


Modified: 
lldb/source/Interpreter/Options.cpp

Removed: 




diff  --git a/lldb/source/Interpreter/Options.cpp 
b/lldb/source/Interpreter/Options.cpp
index 6a90b2cc9b9896..893a3b71604ba8 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -251,12 +251,9 @@ Option *Options::GetLongOptions() {
   m_getopt_table[i].flag = nullptr;
   m_getopt_table[i].val = short_opt;
 
-  if (option_seen.find(short_opt) == option_seen.end()) {
-option_seen[short_opt] = i;
-  } else if (short_opt) {
+  auto [pos, inserted] = option_seen.try_emplace(short_opt, i);
+  if (!inserted && short_opt) {
 m_getopt_table[i].val = 0;
-std::map::const_iterator pos =
-option_seen.find(short_opt);
 StreamString strm;
 if (defs[i].HasShortOption())
   Debugger::ReportError(



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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113073)

2024-10-20 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)

2024-10-20 Thread Thomas Fransham via lldb-commits

https://github.com/fsfod updated 
https://github.com/llvm/llvm-project/pull/113102

>From 9a0e1420ab0621e8c229db75a2460069dee9d499 Mon Sep 17 00:00:00 2001
From: Thomas Fransham 
Date: Mon, 12 Aug 2024 16:04:12 +0100
Subject: [PATCH 1/2] [DebugInfo] Add explicit visibility macros to CodeView
 template functions

These will be needed for when llvm is built as a shared library on windows with
explicit visibility macros enabled.
Change UnionRecord to class instead of a struct so we can use X macros from
CodeViewTypes.def to forward declare all record classes.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on 
window.
---
 .../SymbolFile/NativePDB/SymbolFileNativePDB.h |  2 +-
 .../DebugInfo/CodeView/ContinuationRecordBuilder.h | 14 ++
 .../llvm/DebugInfo/CodeView/SimpleTypeSerializer.h | 13 +
 llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h  |  3 ++-
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 669c44aa131edc..297f11451afb75 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -32,7 +32,7 @@ class ClassRecord;
 class EnumRecord;
 class ModifierRecord;
 class PointerRecord;
-struct UnionRecord;
+class UnionRecord;
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h 
b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 84cef520a2f460..8347ef870d0676 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -50,6 +50,20 @@ class ContinuationRecordBuilder {
 
   std::vector end(TypeIndex Index);
 };
+
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name) 
\
+  extern template LLVM_TEMPLATE_ABI void 
ContinuationRecordBuilder::writeMemberType(\
+  Name##Record &Record);
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
+
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h 
b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index fcc0452a6ae9a7..713798fc38d2d8 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -32,6 +32,19 @@ class SimpleTypeSerializer {
   ArrayRef serialize(const FieldListRecord &Record) = delete;
 };
 
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)   
\
+  class Name##Record;  
\
+  extern template LLVM_TEMPLATE_ABI ArrayRef 
llvm::codeview::SimpleTypeSerializer::serialize(  \
+  Name##Record &Record);
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name)
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
 } // end namespace codeview
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h 
b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 5a84fac5f59034..484e05b5adc672 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -495,7 +495,8 @@ class ClassRecord : public TagRecord {
 };
 
 // LF_UNION
-struct UnionRecord : public TagRecord {
+class UnionRecord : public TagRecord {
+public:
   UnionRecord() = default;
   explicit UnionRecord(TypeRecordKind Kind) : TagRecord(Kind) {}
   UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,

>From 4d1de42ee95ee6904f7f531f4acb24310c4d0dda Mon Sep 17 00:00:00 2001
From: Thomas Fransham 
Date: Sun, 20 Oct 2024 20:35:48 +0100
Subject: [PATCH 2/2] Fix formatting

---
 .../llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h   | 4 ++--
 llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h 
b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 8347ef870d0676..3de138f37be2d2 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h

[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)

2024-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-debuginfo

Author: Thomas Fransham (fsfod)


Changes

These will be needed for when llvm is built as a shared library on windows with 
explicit visibility macros enabled.
Change UnionRecord to class instead of a struct so we can use X macros from 
CodeViewTypes.def to forward declare all record classes.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on 
window.

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


4 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
(+1-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h 
(+14) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h (+13) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h (+2-1) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 669c44aa131edc..297f11451afb75 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -32,7 +32,7 @@ class ClassRecord;
 class EnumRecord;
 class ModifierRecord;
 class PointerRecord;
-struct UnionRecord;
+class UnionRecord;
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h 
b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 84cef520a2f460..8347ef870d0676 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -50,6 +50,20 @@ class ContinuationRecordBuilder {
 
   std::vector end(TypeIndex Index);
 };
+
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name) 
\
+  extern template LLVM_TEMPLATE_ABI void 
ContinuationRecordBuilder::writeMemberType(\
+  Name##Record &Record);
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
+
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h 
b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index fcc0452a6ae9a7..713798fc38d2d8 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -32,6 +32,19 @@ class SimpleTypeSerializer {
   ArrayRef serialize(const FieldListRecord &Record) = delete;
 };
 
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)   
\
+  class Name##Record;  
\
+  extern template LLVM_TEMPLATE_ABI ArrayRef 
llvm::codeview::SimpleTypeSerializer::serialize(  \
+  Name##Record &Record);
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name)
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
 } // end namespace codeview
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h 
b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 5a84fac5f59034..484e05b5adc672 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -495,7 +495,8 @@ class ClassRecord : public TagRecord {
 };
 
 // LF_UNION
-struct UnionRecord : public TagRecord {
+class UnionRecord : public TagRecord {
+public:
   UnionRecord() = default;
   explicit UnionRecord(TypeRecordKind Kind) : TagRecord(Kind) {}
   UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,

``




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


[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)

2024-10-20 Thread Thomas Fransham via lldb-commits

https://github.com/fsfod created 
https://github.com/llvm/llvm-project/pull/113102

These will be needed for when llvm is built as a shared library on windows with 
explicit visibility macros enabled.
Change UnionRecord to class instead of a struct so we can use X macros from 
CodeViewTypes.def to forward declare all record classes.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on 
window.

>From 9a0e1420ab0621e8c229db75a2460069dee9d499 Mon Sep 17 00:00:00 2001
From: Thomas Fransham 
Date: Mon, 12 Aug 2024 16:04:12 +0100
Subject: [PATCH] [DebugInfo] Add explicit visibility macros to CodeView
 template functions

These will be needed for when llvm is built as a shared library on windows with
explicit visibility macros enabled.
Change UnionRecord to class instead of a struct so we can use X macros from
CodeViewTypes.def to forward declare all record classes.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on 
window.
---
 .../SymbolFile/NativePDB/SymbolFileNativePDB.h |  2 +-
 .../DebugInfo/CodeView/ContinuationRecordBuilder.h | 14 ++
 .../llvm/DebugInfo/CodeView/SimpleTypeSerializer.h | 13 +
 llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h  |  3 ++-
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 669c44aa131edc..297f11451afb75 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -32,7 +32,7 @@ class ClassRecord;
 class EnumRecord;
 class ModifierRecord;
 class PointerRecord;
-struct UnionRecord;
+class UnionRecord;
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h 
b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 84cef520a2f460..8347ef870d0676 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -50,6 +50,20 @@ class ContinuationRecordBuilder {
 
   std::vector end(TypeIndex Index);
 };
+
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name) 
\
+  extern template LLVM_TEMPLATE_ABI void 
ContinuationRecordBuilder::writeMemberType(\
+  Name##Record &Record);
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
+
 } // namespace codeview
 } // namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h 
b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index fcc0452a6ae9a7..713798fc38d2d8 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -32,6 +32,19 @@ class SimpleTypeSerializer {
   ArrayRef serialize(const FieldListRecord &Record) = delete;
 };
 
+// Needed by RandomAccessVisitorTest.cpp
+#define TYPE_RECORD(EnumName, EnumVal, Name)   
\
+  class Name##Record;  
\
+  extern template LLVM_TEMPLATE_ABI ArrayRef 
llvm::codeview::SimpleTypeSerializer::serialize(  \
+  Name##Record &Record);
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name)
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
 } // end namespace codeview
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h 
b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 5a84fac5f59034..484e05b5adc672 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -495,7 +495,8 @@ class ClassRecord : public TagRecord {
 };
 
 // LF_UNION
-struct UnionRecord : public TagRecord {
+class UnionRecord : public TagRecord {
+public:
   UnionRecord() = default;
   explicit UnionRecord(TypeRecordKind Kind) : TagRecord(Kind) {}
   UnionRecord(uint16_t MemberCount, ClassOptions Options, TypeIndex FieldList,

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