[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)
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)
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
[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)
@@ -495,7 +495,8 @@ class ClassRecord : public TagRecord { }; // LF_UNION -struct UnionRecord : public TagRecord { +class UnionRecord : public TagRecord { +public: fsfod wrote: yes it wasn't usable in the XMACRO to forward declare classes used for the function declarations it creates 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)
https://github.com/fsfod updated https://github.com/llvm/llvm-project/pull/113102 >From 79408f0a5703c1174ef98130a4106c61cd593d76 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 b0e78a243a3c24..479a8724e2adef 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 0d429239bfa598736c0eb7cb99c5726ba7d7ae93 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