[libcxx-commits] [libcxxabi] 8210a58 - [Demangle] Guard DEMANGLE_ABI and add missing annotation (#202920)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 11 02:48:09 PDT 2026
Author: Fabrice de Gans
Date: 2026-06-11T02:48:04-07:00
New Revision: 8210a58044d1e6d86473fdf810396d285c86ff36
URL: https://github.com/llvm/llvm-project/commit/8210a58044d1e6d86473fdf810396d285c86ff36
DIFF: https://github.com/llvm/llvm-project/commit/8210a58044d1e6d86473fdf810396d285c86ff36.diff
LOG: [Demangle] Guard DEMANGLE_ABI and add missing annotation (#202920)
This updates the DEMANGLE_ABI annotation to only be defined if it is not
already defined. This is required to parse the Demangle headers with the
ids-check script.
In addition, this adds one missing DEMANGLE_ABI annotation.
This effort is tracked in #109483.
Added:
Modified:
libcxxabi/src/demangle/Utility.h
llvm/include/llvm/Demangle/DemangleConfig.h
llvm/include/llvm/Demangle/Utility.h
Removed:
################################################################################
diff --git a/libcxxabi/src/demangle/Utility.h b/libcxxabi/src/demangle/Utility.h
index df5b54dca492d..ca420bce66d9c 100644
--- a/libcxxabi/src/demangle/Utility.h
+++ b/libcxxabi/src/demangle/Utility.h
@@ -31,7 +31,7 @@ class Node;
// Stream that AST nodes write their string representation into after the AST
// has been parsed.
-class OutputBuffer {
+class DEMANGLE_ABI OutputBuffer {
char *Buffer = nullptr;
size_t CurrentPosition = 0;
size_t BufferCapacity = 0;
diff --git a/llvm/include/llvm/Demangle/DemangleConfig.h b/llvm/include/llvm/Demangle/DemangleConfig.h
index 5c48ae1972bec..9cd85efbbd232 100644
--- a/llvm/include/llvm/Demangle/DemangleConfig.h
+++ b/llvm/include/llvm/Demangle/DemangleConfig.h
@@ -97,24 +97,29 @@
#define DEMANGLE_NAMESPACE_BEGIN namespace llvm { namespace itanium_demangle {
#define DEMANGLE_NAMESPACE_END } }
-/// DEMANGLE_ABI is the export/visibility macro used to mark symbols delcared in
+/// DEMANGLE_ABI is the export/visibility macro used to mark symbols declared in
/// llvm/Demangle as exported when built as a shared library.
-#if defined(LLVM_BUILD_STATIC) || !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS)
-#define DEMANGLE_ABI
-#else
-#if defined(_WIN32) && !defined(__MINGW32__)
-#if defined(LLVM_EXPORTS)
-#define DEMANGLE_ABI __declspec(dllexport)
-#else
-#define DEMANGLE_ABI __declspec(dllimport)
-#endif
-#else
-#if __has_attribute(visibility)
-#define DEMANGLE_ABI __attribute__((__visibility__("default")))
-#else
-#define DEMANGLE_ABI
-#endif
-#endif
-#endif
+// clang-format off
+// Autoformatting removes indentation, making this harder to read.
+#if !defined(DEMANGLE_ABI)
+# if defined(LLVM_BUILD_STATIC) || !defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS)
+# define DEMANGLE_ABI
+# else
+# if defined(_WIN32) && !defined(__MINGW32__)
+# if defined(LLVM_EXPORTS)
+# define DEMANGLE_ABI __declspec(dllexport)
+# else
+# define DEMANGLE_ABI __declspec(dllimport)
+# endif
+# else
+# if __has_attribute(visibility)
+# define DEMANGLE_ABI __attribute__((__visibility__("default")))
+# else
+# define DEMANGLE_ABI
+# endif
+# endif
+# endif
+#endif
+// clang-format on
#endif
diff --git a/llvm/include/llvm/Demangle/Utility.h b/llvm/include/llvm/Demangle/Utility.h
index afdc1a397ca6f..56c052e6a2cf8 100644
--- a/llvm/include/llvm/Demangle/Utility.h
+++ b/llvm/include/llvm/Demangle/Utility.h
@@ -31,7 +31,7 @@ class Node;
// Stream that AST nodes write their string representation into after the AST
// has been parsed.
-class OutputBuffer {
+class DEMANGLE_ABI OutputBuffer {
char *Buffer = nullptr;
size_t CurrentPosition = 0;
size_t BufferCapacity = 0;
More information about the libcxx-commits
mailing list