Skip to content

Commit a122ec6

Browse files
committed
remove Demangle dependency on Support
1 parent bad6775 commit a122ec6

File tree

11 files changed

+31
-72
lines changed

11 files changed

+31
-72
lines changed

libcxxabi/src/demangle/DemangleConfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@
107107
#define DEMANGLE_NAMESPACE_BEGIN namespace { namespace itanium_demangle {
108108
#define DEMANGLE_NAMESPACE_END } }
109109

110+
// The DEMANGLE_ABI macro resolves to nothing when building libc++abi. Only
111+
// the llvm copy defines DEMANGLE_ABI as a visibility attribute.
112+
#define DEMANGLE_ABI
113+
110114
#endif // LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "DemangleConfig.h"
2020
#include "StringViewExtras.h"
2121
#include "Utility.h"
22-
#include "Visibility.h"
2322
#include <algorithm>
2423
#include <cctype>
2524
#include <cstdint>

libcxxabi/src/demangle/Visibility.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

libcxxabi/src/demangle/cp-to-llvm.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

3-
# Copies the 'demangle' library, excluding 'DemangleConfig.h' and
4-
# 'Visibility.h', to llvm. If no llvm directory is specified, then assume a
5-
# monorepo layout.
3+
# Copies the 'demangle' library, excluding 'DemangleConfig.h', to llvm. If no
4+
# llvm directory is specified, then assume a monorepo layout.
65

76
set -e
87

llvm/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,10 +1078,9 @@ if (LLVM_BUILD_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS OR LLVM_ENABLE_PLUGINS)
10781078
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON)
10791079
endif()
10801080

1081-
# Because LLVM-C and Demangle libraries are built into the LLVM library, for now
1082-
# we export their symbols if LLVM symbols are exported.
1081+
# Because LLVM-C is built into the LLVM library, for now export its symbols
1082+
# whenever LLVM symbols are exported.
10831083
set(LLVM_ENABLE_LLVM_C_EXPORT_ANNOTATIONS ${LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS})
1084-
set(LLVM_ENABLE_DEMANGLE_EXPORT_ANNOTATIONS ${LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS})
10851084

10861085
set(LLVM_ENABLE_NEW_PASS_MANAGER TRUE CACHE BOOL
10871086
"Enable the new pass manager by default.")

llvm/include/llvm/Demangle/Demangle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_DEMANGLE_DEMANGLE_H
1010
#define LLVM_DEMANGLE_DEMANGLE_H
1111

12-
#include "Visibility.h"
12+
#include "DemangleConfig.h"
1313
#include <cstddef>
1414
#include <optional>
1515
#include <string>

llvm/include/llvm/Demangle/DemangleConfig.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,24 @@
9494
#define DEMANGLE_NAMESPACE_BEGIN namespace llvm { namespace itanium_demangle {
9595
#define DEMANGLE_NAMESPACE_END } }
9696

97+
/// DEMANGLE_ABI is the export/visibility macro used to mark symbols delcared in
98+
/// llvm/Demangle as exported when built as a shared library.
99+
#if defined(LLVM_BUILD_STATIC) || !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS)
100+
#define DEMANGLE_ABI
101+
#else
102+
#if defined(_WIN32)
103+
#if defined(LLVM_EXPORTS)
104+
#define DEMANGLE_ABI __declspec(dllexport)
105+
#else
106+
#define DEMANGLE_ABI__declspec(dllimport)
107+
#endif
108+
#else
109+
#if __has_attribute(visibility)
110+
#define DEMANGLE_ABI __attribute__((__visibility__("default")))
111+
#else
112+
#define DEMANGLE_ABI
113+
#endif
114+
#endif
115+
#endif
116+
97117
#endif

llvm/include/llvm/Demangle/ItaniumDemangle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "DemangleConfig.h"
2020
#include "StringViewExtras.h"
2121
#include "Utility.h"
22-
#include "Visibility.h"
2322
#include <algorithm>
2423
#include <cctype>
2524
#include <cstdint>

llvm/include/llvm/Demangle/MicrosoftDemangle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#define LLVM_DEMANGLE_MICROSOFTDEMANGLE_H
1111

1212
#include "llvm/Demangle/Demangle.h"
13+
#include "llvm/Demangle/DemangleConfig.h"
1314
#include "llvm/Demangle/MicrosoftDemangleNodes.h"
14-
#include "llvm/Demangle/Visibility.h"
1515

1616
#include <cassert>
1717
#include <string_view>

llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_DEMANGLE_MICROSOFTDEMANGLENODES_H
1414
#define LLVM_DEMANGLE_MICROSOFTDEMANGLENODES_H
1515

16-
#include "Visibility.h"
16+
#include "DemangleConfig.h"
1717
#include <array>
1818
#include <cstdint>
1919
#include <string>

0 commit comments

Comments
 (0)