https://github.com/kkent030315 created 
https://github.com/llvm/llvm-project/pull/171054

Fixes #152083 - duplicate symbols in `c-index-test`

- Eliminated the use of `CLANG_EXPORTS` for Clang component libraries.
- Removed unnecessary dllimport attributes from `Compiler.h`. They aren't 
strictly required (the linker will resolve them).

>From b78486abe00fe4a06594bbbc2abdb244c66bb4c8 Mon Sep 17 00:00:00 2001
From: kkent030315 <[email protected]>
Date: Mon, 8 Dec 2025 04:55:11 +0900
Subject: [PATCH] [Clang] Fix visibility macros for c-index-test

Fixes #152083 - duplicate symbols in `c-index-test`

- Eliminated the use of `CLANG_EXPORTS` for Clang component libraries.
- Removed unnecessary dllimport attributes from `Compiler.h`. They aren't 
strictly required (the linker will resolve them).
---
 clang/cmake/modules/AddClang.cmake     | 3 ---
 clang/include/clang/Support/Compiler.h | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/clang/cmake/modules/AddClang.cmake 
b/clang/cmake/modules/AddClang.cmake
index 4059fc3e986c7..9dcc77d5a5184 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -115,9 +115,6 @@ macro(add_clang_library name)
     if(TARGET "obj.${name}")
       target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
     endif()
-  elseif(TARGET "obj.${name}" AND NOT ARG_SHARED AND NOT ARG_STATIC)
-    # Clang component libraries linked to clang-cpp are declared without 
SHARED or STATIC
-    target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
   endif()
 
   set(libs ${name})
diff --git a/clang/include/clang/Support/Compiler.h 
b/clang/include/clang/Support/Compiler.h
index e1ae3eda4ccc2..1aab64e11521c 100644
--- a/clang/include/clang/Support/Compiler.h
+++ b/clang/include/clang/Support/Compiler.h
@@ -45,8 +45,8 @@
 #define CLANG_TEMPLATE_ABI
 #define CLANG_EXPORT_TEMPLATE __declspec(dllexport)
 #else
-#define CLANG_ABI __declspec(dllimport)
-#define CLANG_TEMPLATE_ABI __declspec(dllimport)
+#define CLANG_ABI
+#define CLANG_TEMPLATE_ABI
 #define CLANG_EXPORT_TEMPLATE
 #endif
 #elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) ||             
\

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to