Skip to content

Commit

Permalink
[llvm] Add explicit visibility macros to YAMLTraits classes (llvm#111484
Browse files Browse the repository at this point in the history
)

These symbols need to be exported for llvm-pdbutil when using windows
shared library builds.
Exclude the YAML traits declared in llvm-pdbutil so there not declared
as dllimported which will causing missing symbol errors for windows
shared library builds.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on
window.
  • Loading branch information
fsfod authored and Groverkss committed Nov 15, 2024
1 parent adace2c commit 181fb89
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
15 changes: 12 additions & 3 deletions llvm/include/llvm/Support/YAMLTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,15 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl {
LLVM_YAML_IS_SEQUENCE_VECTOR_IMPL(type, true)

#define LLVM_YAML_DECLARE_MAPPING_TRAITS(Type) \
namespace llvm { \
namespace yaml { \
template <> struct LLVM_ABI MappingTraits<Type> { \
static void mapping(IO &IO, Type &Obj); \
}; \
} \
}

#define LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(Type) \
namespace llvm { \
namespace yaml { \
template <> struct MappingTraits<Type> { \
Expand All @@ -2090,7 +2099,7 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl {
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type) \
namespace llvm { \
namespace yaml { \
template <> struct ScalarEnumerationTraits<Type> { \
template <> struct LLVM_ABI ScalarEnumerationTraits<Type> { \
static void enumeration(IO &io, Type &Value); \
}; \
} \
Expand All @@ -2099,7 +2108,7 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl {
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type) \
namespace llvm { \
namespace yaml { \
template <> struct ScalarBitSetTraits<Type> { \
template <> struct LLVM_ABI ScalarBitSetTraits<Type> { \
static void bitset(IO &IO, Type &Options); \
}; \
} \
Expand All @@ -2108,7 +2117,7 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl {
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote) \
namespace llvm { \
namespace yaml { \
template <> struct ScalarTraits<Type> { \
template <> struct LLVM_ABI ScalarTraits<Type> { \
static void output(const Type &Value, void *ctx, raw_ostream &Out); \
static StringRef input(StringRef Scalar, void *ctxt, Type &Value); \
static QuotingType mustQuote(StringRef) { return MustQuote; } \
Expand Down
22 changes: 11 additions & 11 deletions llvm/tools/llvm-pdbutil/PdbYaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ struct PdbObject {
}
}

LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbObject)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::MSFHeaders)
LLVM_YAML_DECLARE_MAPPING_TRAITS(msf::SuperBlock)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::StreamBlockList)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbPublicsStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbObject)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::MSFHeaders)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(msf::SuperBlock)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::StreamBlockList)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbInfoStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbDbiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbTpiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbPublicsStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::NamedStreamMapping)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbModiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS_PRIVATE(pdb::yaml::PdbDbiModuleInfo)

#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H

0 comments on commit 181fb89

Please sign in to comment.