|
|
|||
File indexing completed on 2026-05-10 08:37:10
0001 //===-- clang/Support/Compiler.h - Compiler abstraction support -*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file defines explicit visibility macros used to export symbols from 0010 // clang-cpp 0011 // 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef CLANG_SUPPORT_COMPILER_H 0015 #define CLANG_SUPPORT_COMPILER_H 0016 0017 #include "llvm/Support/Compiler.h" 0018 0019 /// CLANG_ABI is the main export/visibility macro to mark something as 0020 /// explicitly exported when clang is built as a shared library with everything 0021 /// else that is unannotated having hidden visibility. 0022 /// 0023 /// CLANG_EXPORT_TEMPLATE is used on explicit template instantiations in source 0024 /// files that were declared extern in a header. This macro is only set as a 0025 /// compiler export attribute on windows, on other platforms it does nothing. 0026 /// 0027 /// CLANG_TEMPLATE_ABI is for annotating extern template declarations in headers 0028 /// for both functions and classes. On windows its turned in to dllimport for 0029 /// library consumers, for other platforms its a default visibility attribute. 0030 #ifndef CLANG_ABI_GENERATING_ANNOTATIONS 0031 // Marker to add to classes or functions in public headers that should not have 0032 // export macros added to them by the clang tool 0033 #define CLANG_ABI_NOT_EXPORTED 0034 // Some libraries like those for tablegen are linked in to tools that used 0035 // in the build so can't depend on the llvm shared library. If export macros 0036 // were left enabled when building these we would get duplicate or 0037 // missing symbol linker errors on windows. 0038 #if defined(CLANG_BUILD_STATIC) 0039 #define CLANG_ABI 0040 #define CLANG_TEMPLATE_ABI 0041 #define CLANG_EXPORT_TEMPLATE 0042 #elif defined(_WIN32) && !defined(__MINGW32__) 0043 #if defined(CLANG_EXPORTS) 0044 #define CLANG_ABI __declspec(dllexport) 0045 #define CLANG_TEMPLATE_ABI 0046 #define CLANG_EXPORT_TEMPLATE __declspec(dllexport) 0047 #else 0048 #define CLANG_ABI __declspec(dllimport) 0049 #define CLANG_TEMPLATE_ABI __declspec(dllimport) 0050 #define CLANG_EXPORT_TEMPLATE 0051 #endif 0052 #elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \ 0053 defined(__MVS__) 0054 #define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT 0055 #define CLANG_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT 0056 #define CLANG_EXPORT_TEMPLATE 0057 #elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__) 0058 #define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT 0059 #define CLANG_TEMPLATE_ABI 0060 #define CLANG_EXPORT_TEMPLATE 0061 #endif 0062 #endif 0063 0064 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|