Skip to content

Commit d61eda7

Browse files
committed
also exclude exporting cl::opt with Clang
1 parent b6afd5e commit d61eda7

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

llvm/include/llvm/Support/CommandLine.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,13 +1518,11 @@ class opt
15181518
[](const typename ParserClass::parser_data_type &) {};
15191519
};
15201520

1521-
#if !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) || \
1522-
!(defined(_MSC_VER) && !defined(__clang__))
1523-
// Only instantiate opt<std::string> when not building a Windows DLL with MSVC.
1524-
// When exporting opt<std::string>, MSVC cl implicitly exports symbols for
1521+
#if !(defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && defined(_MSC_VER))
1522+
// Only instantiate opt<std::string> when not building a Windows DLL. When
1523+
// exporting opt<std::string>, MSVC implicitly exports symbols for
15251524
// std::basic_string through transitive inheritance via std::string. These
1526-
// symbols may appear in other TUs with different linkage, leading to duplicate
1527-
// symbol conflicts.
1525+
// symbols may appear in clients, leading to duplicate symbol conflicts.
15281526
extern template class LLVM_TEMPLATE_ABI opt<std::string>;
15291527
#endif
15301528

llvm/lib/Support/CommandLine.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ template class LLVM_EXPORT_TEMPLATE basic_parser<float>;
6868
template class LLVM_EXPORT_TEMPLATE basic_parser<std::string>;
6969
template class LLVM_EXPORT_TEMPLATE basic_parser<char>;
7070

71-
#if !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) || \
72-
!(defined(_MSC_VER) && !defined(__clang__))
73-
// Only instantiate opt<std::string> when not building a Windows DLL with MSVC.
74-
// When exporting opt<std::string>, MSVC cl implicitly exports symbols for
71+
#if !(defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && defined(_MSC_VER))
72+
// Only instantiate opt<std::string> when not building a Windows DLL. When
73+
// exporting opt<std::string>, MSVC implicitly exports symbols for
7574
// std::basic_string through transitive inheritance via std::string. These
76-
// symbols may appear in other TUs with different linkage, leading to duplicate
77-
// symbol conflicts.
75+
// symbols may appear in clients, leading to duplicate symbol conflicts.
7876
template class LLVM_EXPORT_TEMPLATE opt<std::string>;
7977
#endif
8078

0 commit comments

Comments
 (0)