Skip to content

[Clang][Cygwin] Fix symbol visibility definition #138118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mati865
Copy link
Contributor

@mati865 mati865 commented May 1, 2025

Currently building for Cygwin hits this error:

In file included from /h/projects/llvm-project/clang/lib/Basic/Attributes.cpp:17:
/h/projects/llvm-project/clang/include/clang/Basic/ParsedAttrInfo.h:180:73: error: invalid declarator before ‘;’ token
  180 | extern template class CLANG_TEMPLATE_ABI Registry<clang::ParsedAttrInfo>;

That's because CLANG_TEMPLATE_ABI ends up not being defined. The solution here is to follow MinGW case.

Split out from #134494

Currently building for Cygwin hits this error:
```
In file included from /h/projects/llvm-project/clang/lib/Basic/Attributes.cpp:17:
/h/projects/llvm-project/clang/include/clang/Basic/ParsedAttrInfo.h:180:73: error: invalid declarator before ‘;’ token
  180 | extern template class CLANG_TEMPLATE_ABI Registry<clang::ParsedAttrInfo>;
```
That's because `CLANG_TEMPLATE_ABI` ends up not being defined.
The solution here is to follow MinGW case.
@mstorsjo mstorsjo marked this pull request as ready for review May 1, 2025 12:33
@llvmbot llvmbot added the clang Clang issues not falling into any other category label May 1, 2025
Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@llvmbot
Copy link
Member

llvmbot commented May 1, 2025

@llvm/pr-subscribers-clang

Author: Mateusz Mikuła (mati865)

Changes

Currently building for Cygwin hits this error:

In file included from /h/projects/llvm-project/clang/lib/Basic/Attributes.cpp:17:
/h/projects/llvm-project/clang/include/clang/Basic/ParsedAttrInfo.h:180:73: error: invalid declarator before ‘;’ token
  180 | extern template class CLANG_TEMPLATE_ABI Registry&lt;clang::ParsedAttrInfo&gt;;

That's because CLANG_TEMPLATE_ABI ends up not being defined. The solution here is to follow MinGW case.

Split out from #134494


Full diff: https://github.com/llvm/llvm-project/pull/138118.diff

1 Files Affected:

  • (modified) clang/include/clang/Support/Compiler.h (+1-1)
diff --git a/clang/include/clang/Support/Compiler.h b/clang/include/clang/Support/Compiler.h
index 5a74f8e3b6723..e1ae3eda4ccc2 100644
--- a/clang/include/clang/Support/Compiler.h
+++ b/clang/include/clang/Support/Compiler.h
@@ -50,7 +50,7 @@
 #define CLANG_EXPORT_TEMPLATE
 #endif
 #elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) ||             \
-    defined(__MVS__)
+    defined(__MVS__) || defined(__CYGWIN__)
 #define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #define CLANG_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #define CLANG_EXPORT_TEMPLATE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants