From e9630ac3389dee17754548ae056704fe8da89239 Mon Sep 17 00:00:00 2001 From: Elie Morisse Date: Sun, 3 Nov 2019 14:44:05 -0300 Subject: [PATCH] =?UTF-8?q?Bypass=20the=20class/struct=20reserved=20name?= =?UTF-8?q?=20check=20for=20C++=20aggregates=20and=20stop=20prefixing=20C+?= =?UTF-8?q?+=20aggregate=20names=20such=20as=20TypeInfo=5Fxxx,=20Exception?= =?UTF-8?q?,=20etc.=20with=20=E2=84=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents encountering MSVC linker directives with unsupported UTF-8 characters. --- dmd/cpp/calypso.cpp | 13 ------------- dmd/cpp/cppaggregate.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/dmd/cpp/calypso.cpp b/dmd/cpp/calypso.cpp index 0c272e1b657..c701dc6d8cd 100644 --- a/dmd/cpp/calypso.cpp +++ b/dmd/cpp/calypso.cpp @@ -490,19 +490,6 @@ Identifier *getIdentifierOrNull(const clang::NamedDecl *D, SpecValue *spec, bool } } - if (isa(D)) - { - // Prefix reserved class names with 'ℂ' - if (ident == Id::Object || ident == Id::Throwable || ident == Id::Exception || ident == Id::Error || - ident == Id::TypeInfo || ident == Id::TypeInfo_Class || ident == Id::TypeInfo_Interface || - ident == Id::TypeInfo_Struct || ident == Id::TypeInfo_Pointer || - ident == Id::TypeInfo_Array || ident == Id::TypeInfo_StaticArray || ident == Id::TypeInfo_AssociativeArray || - ident == Id::TypeInfo_Enum || ident == Id::TypeInfo_Function || ident == Id::TypeInfo_Delegate || - ident == Id::TypeInfo_Tuple || ident == Id::TypeInfo_Const || ident == Id::TypeInfo_Invariant || - ident == Id::TypeInfo_Shared || ident == Id::TypeInfo_Wild || ident == Id::TypeInfo_Vector) // thanks C++... - needsPrefixing = true; - } - if (needsPrefixing) ident = prefixConflictingIdentifier(ident); diff --git a/dmd/cpp/cppaggregate.cpp b/dmd/cpp/cppaggregate.cpp index 1daff943caa..2b9878bbef6 100644 --- a/dmd/cpp/cppaggregate.cpp +++ b/dmd/cpp/cppaggregate.cpp @@ -56,7 +56,8 @@ void LangPlugin::mangleAnonymousAggregate(::AggregateDeclaration* ad, OutBuffer StructDeclaration::StructDeclaration(Loc loc, Identifier* id, const clang::RecordDecl* RD) { - construct_StructDeclaration(this, loc, id); + construct_StructDeclaration(this, loc, calypso.id_Scpp); + this->ident = id; // bypassed the reserved struct names check this->RD = RD; } @@ -68,7 +69,8 @@ StructDeclaration::StructDeclaration(const StructDeclaration& o) ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols* members, const clang::CXXRecordDecl *RD) { - construct_ClassDeclaration(this, loc, id, baseclasses, members); + construct_ClassDeclaration(this, loc, calypso.id_Scpp, baseclasses, members); + this->ident = id; // bypassed the reserved class names check this->RD = RD; } @@ -80,7 +82,8 @@ ClassDeclaration::ClassDeclaration(const ClassDeclaration& o) UnionDeclaration::UnionDeclaration(Loc loc, Identifier* id, const clang::RecordDecl* RD) { - construct_UnionDeclaration(this, loc, id); + construct_UnionDeclaration(this, loc, calypso.id_Scpp); + this->ident = id; // bypassed the reserved struct names check this->RD = RD; }