Fix little C++ header regressions

This commit is contained in:
Martin Kinkelin 2021-02-28 15:56:58 +01:00
parent 879c8ba465
commit c0630840b7
6 changed files with 14 additions and 15 deletions

View file

@ -196,8 +196,8 @@ struct Param
bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract
bool vsafe; // use enhanced @safe checking bool vsafe; // use enhanced @safe checking
bool ehnogc; // use @nogc exception handling bool ehnogc; // use @nogc exception handling
bool dtorFields; // destruct fields of partially constructed objects FeatureState dtorFields; // destruct fields of partially constructed objects
// https://issues.dlang.org/show_bug.cgi?id=14246 // https://issues.dlang.org/show_bug.cgi?id=14246
bool fieldwise; // do struct equality testing field-wise rather than by memcmp() bool fieldwise; // do struct equality testing field-wise rather than by memcmp()
bool rvalueRefParam; // allow rvalues to be arguments to ref parameters bool rvalueRefParam; // allow rvalues to be arguments to ref parameters
CppStdRevision cplusplus; // version of C++ name mangling to support CppStdRevision cplusplus; // version of C++ name mangling to support

View file

@ -188,7 +188,7 @@ struct ModuleDeclaration
{ {
Loc loc; Loc loc;
Identifier *id; Identifier *id;
Identifiers *packages; // array of Identifier's representing packages DArray<Identifier*> packages; // array of Identifier's representing packages
bool isdeprecated; // if it is a deprecated module bool isdeprecated; // if it is a deprecated module
Expression *msg; Expression *msg;

View file

@ -101,6 +101,8 @@ enum ENUMTY
Tint128, Tint128,
Tuns128, Tuns128,
Ttraits, Ttraits,
Tmixin,
Tnoreturn,
TMAX TMAX
}; };
typedef unsigned char TY; // ENUMTY typedef unsigned char TY; // ENUMTY
@ -186,6 +188,7 @@ public:
static Type *tdstring; // immutable(dchar)[] static Type *tdstring; // immutable(dchar)[]
static Type *terror; // for error recovery static Type *terror; // for error recovery
static Type *tnull; // for null type static Type *tnull; // for null type
static Type *tnoreturn; // for bottom type typeof(*null)
static Type *tsize_t; // matches size_t alias static Type *tsize_t; // matches size_t alias
static Type *tptrdiff_t; // matches ptrdiff_t alias static Type *tptrdiff_t; // matches ptrdiff_t alias

View file

@ -25,12 +25,10 @@ bool isFromLDC_DCompute(Dsymbol *sym) {
auto moduleDecl = mod->md; auto moduleDecl = mod->md;
if (!moduleDecl) if (!moduleDecl)
return false; return false;
if (!moduleDecl->packages)
return false;
if (moduleDecl->packages->length != 1) if (moduleDecl->packages.length != 1)
return false; return false;
if ((*moduleDecl->packages)[0] != Id::ldc) if (moduleDecl->packages.ptr[0] != Id::ldc)
return false; return false;
return moduleDecl->id == Id::dcompute; return moduleDecl->id == Id::dcompute;

View file

@ -59,12 +59,10 @@ std::string hashSymbolName(llvm::StringRef name, Dsymbol *symb) {
{ {
auto moddecl = symb->getModule()->md; auto moddecl = symb->getModule()->md;
assert(moddecl); assert(moddecl);
if (auto packages = moddecl->packages) { for (size_t i = 0; i < moddecl->packages.length; ++i) {
for (auto package : *packages) { llvm::StringRef str = moddecl->packages.ptr[i]->toChars();
llvm::StringRef str = package->toChars(); ret += ldc::to_string(str.size());
ret += ldc::to_string(str.size()); ret += str;
ret += str;
}
} }
llvm::StringRef str = moddecl->id->toChars(); llvm::StringRef str = moddecl->id->toChars();
ret += ldc::to_string(str.size()); ret += ldc::to_string(str.size());

View file

@ -41,8 +41,8 @@ bool isMagicModule(const ModuleDeclaration *moduleDecl, const Identifier *id) {
return false; return false;
} }
if (moduleDecl->packages->length != 1 || if (moduleDecl->packages.length != 1 ||
(*moduleDecl->packages)[0] != Id::ldc) { moduleDecl->packages.ptr[0] != Id::ldc) {
return false; return false;
} }
return true; return true;