MS compatibility: always emit dllexported in-class initialized static data members (PR20140)
This makes us emit dllexported in-class initialized static data members (which are treated as definitions in MSVC), even when they're not referenced. It also makes their special linkage reflected in the GVA linkage instead of getting massaged in CodeGen. Differential Revision: http://reviews.llvm.org/D4563 llvm-svn: 213304
This commit is contained in:
@@ -128,6 +128,19 @@ namespace {
|
||||
return;
|
||||
|
||||
Builder->UpdateCompletedType(D);
|
||||
|
||||
// For MSVC compatibility, treat declarations of static data members with
|
||||
// inline initializers as definitions.
|
||||
if (Ctx->getLangOpts().MSVCCompat) {
|
||||
for (Decl *Member : D->decls()) {
|
||||
if (VarDecl *VD = dyn_cast<VarDecl>(Member)) {
|
||||
if (Ctx->isMSStaticDataMemberInlineDefinition(VD) &&
|
||||
Ctx->DeclMustBeEmitted(VD)) {
|
||||
Builder->EmitGlobal(VD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleTagDeclRequiredDefinition(const TagDecl *D) override {
|
||||
|
||||
Reference in New Issue
Block a user