Hidden visibility is almost the opposite of dllimport. We were
producing them before (dllimport wins in the existing llvm
implementation), but now the llvm verifier produces an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323361
91177308-0d34-0410-b5e6-
96231b3b80d8
void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
const NamedDecl *D,
ForDefinition_t IsForDefinition) const {
+ if (GV->hasDLLImportStorageClass())
+ return;
// Internal definitions always have default visibility.
if (GV->hasLocalLinkage()) {
GV->setVisibility(llvm::GlobalValue::DefaultVisibility);
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm -fvisibility-inlines-hidden -o - %s | FileCheck %s
+
+// We used to declare this hidden dllimport, which is contradictory.
+
+// CHECK: declare dllimport void @"\01?bar@foo@@QEAAXXZ"(%struct.foo*)
+
+struct __attribute__((dllimport)) foo {
+ void bar() {}
+};
+void zed(foo *p) { p->bar(); }