// cannot be.
if (VD->isInAnonymousNamespace())
return true;
- if (VD->getStorageClass() == VarDecl::Static) {
+ if (VD->getLinkage() == VarDecl::InternalLinkage) {
// Initializer has side effects?
if (VD->getInit() && VD->getInit()->HasSideEffects(Context))
return false;
return CodeGenModule::GVA_TemplateInstantiation;
}
}
-
- // Static variables get internal linkage.
- if (VD->getStorageClass() == VarDecl::Static)
+
+ if (VD->getLinkage() == VarDecl::InternalLinkage)
return CodeGenModule::GVA_Internal;
return CodeGenModule::GVA_StrongExternal;
--- /dev/null
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+
+const int x = 10;
+const int y = 20;
+// CHECK-NOT: @x
+// CHECK: @y = internal constant i32 20
+const int& b() { return y; }
+