Skip to content

Commit 0abde0a

Browse files
committed
[llvm] define export annotations for Demangle library
1 parent 62f8377 commit 0abde0a

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

llvm/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,10 @@ if (LLVM_BUILD_LLVM_DYLIB OR LLVM_BUILD_SHARED_LIBS OR LLVM_ENABLE_PLUGINS)
10711071
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON)
10721072
endif()
10731073

1074-
# Because LLVM-C is built into the LLVM library, for now export its symbols
1075-
# whenever LLVM symbols are exported.
1074+
# Because LLVM-C and Demangle libraries are built into the LLVM library, for now
1075+
# we export their symbols if LLVM symbols are exported.
10761076
set(LLVM_ENABLE_LLVM_C_EXPORT_ANNOTATIONS ${LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS})
1077+
set(LLVM_ENABLE_DEMANGLE_EXPORT_ANNOTATIONS ${LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS})
10771078

10781079
set(LLVM_ENABLE_NEW_PASS_MANAGER TRUE CACHE BOOL
10791080
"Enable the new pass manager by default.")
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*===-- Demangle/Visibility.h - Visibility macros for Demangle --*- C++ -*-===*\
2+
|* *|
3+
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4+
|* Exceptions. *|
5+
|* See https://llvm.org/LICENSE.txt for license information. *|
6+
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7+
|* *|
8+
|*===----------------------------------------------------------------------===*|
9+
|* *|
10+
|* This header defines visibility macros used for the Demangle library. These *|
11+
|* macros are used to annotate functions that should be exported as part of a *|
12+
|* shared library or DLL. *|
13+
|* *|
14+
\*===----------------------------------------------------------------------===*/
15+
16+
#ifndef LLVM_DEMANGLE_VISIBILITY_H
17+
#define LLVM_DEMANGLE_VISIBILITY_H
18+
19+
#include "llvm/Config/llvm-config.h"
20+
#include "llvm/Demangle/DemangleConfig.h"
21+
22+
/// DEMANGLE_ABI is the export/visibility macro used to mark symbols delcared in
23+
/// llvm/Demangle as exported when built as a shared library.
24+
25+
#if !defined(LLVM_ABI_GENERATING_ANNOTATIONS)
26+
#if defined(LLVM_ENABLE_DEMANGLE_EXPORT_ANNOTATIONS) && \
27+
!defined(LLVM_BUILD_STATIC)
28+
#if defined(_WIN32) && !defined(__MINGW32__)
29+
#if defined(LLVM_EXPORTS)
30+
#define DEMANGLE_ABI __declspec(dllexport)
31+
#else
32+
#define DEMANGLE_ABI __declspec(dllimport)
33+
#endif
34+
#elif __has_attribute(visibility)
35+
#define DEMANGLE_ABI __attribute__((visibility("default")))
36+
#endif
37+
#endif
38+
#if !defined(DEMANGLE_ABI)
39+
#define DEMANGLE_ABI
40+
#endif
41+
#endif
42+
43+
#endif

0 commit comments

Comments
 (0)