Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Update to dmd master 20180918
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Sep 20, 2018
1 parent d440a1d commit be8ad18
Show file tree
Hide file tree
Showing 47 changed files with 318 additions and 400 deletions.
6 changes: 6 additions & 0 deletions gcc/d/ChangeLog
@@ -1,3 +1,9 @@
2018-09-18 Iain Buclaw <ibuclaw@gdcproject.org>

* d-lang.cc (deps_write): Use toChars accessor to get module path.
* decl.cc (get_symbol_decl): Use get_identifier_with_length to get
mangle override identifier node.

2018-09-10 Iain Buclaw <ibuclaw@gdcproject.org>

* d-lang.cc (d_init_options): Set-up global.params.argv0 as D array.
Expand Down
6 changes: 3 additions & 3 deletions gcc/d/d-lang.cc
Expand Up @@ -175,7 +175,7 @@ deps_write (Module *module, OutBuffer *buffer, unsigned colmax = 72)
}
else
{
str = module->objfile->name->str;
str = module->objfile->name.toChars ();
size = strlen (str);
}

Expand All @@ -189,7 +189,7 @@ deps_write (Module *module, OutBuffer *buffer, unsigned colmax = 72)
{
Module *depmod = modlist.pop ();

str = depmod->srcfile->name->str;
str = depmod->srcfile->name.toChars ();
size = strlen (str);

/* Skip dependencies that have already been written. */
Expand Down Expand Up @@ -256,7 +256,7 @@ deps_write (Module *module, OutBuffer *buffer, unsigned colmax = 72)
Module *m = phonylist[i];

buffer->writenl ();
buffer->writestring (m->srcfile->name->str);
buffer->writestring (m->srcfile->name.toChars ());
buffer->writestring (":\n");
}
}
Expand Down
8 changes: 6 additions & 2 deletions gcc/d/decl.cc
Expand Up @@ -1103,8 +1103,12 @@ get_symbol_decl (Declaration *decl)
{
tree mangled_name;

if (decl->mangleOverride)
mangled_name = get_identifier (decl->mangleOverride);
if (decl->mangleOverride.length)
{
mangled_name =
get_identifier_with_length (decl->mangleOverride.ptr,
decl->mangleOverride.length);
}
else
mangled_name = get_identifier (mangle_decl (decl));

Expand Down
2 changes: 0 additions & 2 deletions gcc/d/dmd/constfold.d
Expand Up @@ -389,8 +389,6 @@ UnionExp Div(const ref Loc loc, Type type, Expression e1, Expression e2)
if (type.isfloating())
{
auto c = complex_t(CTFloat.zero);
//e1.type.print();
//e2.type.print();
if (e2.type.isreal())
{
if (e1.type.isreal())
Expand Down
4 changes: 2 additions & 2 deletions gcc/d/dmd/cppmangle.d
Expand Up @@ -1045,7 +1045,7 @@ private final class CppMangleVisitor : Visitor
}
if (!substitute(s))
{
cpp_mangle_name(s, t.isConst());
cpp_mangle_name(s, false);
}
}
if (t.isConst())
Expand Down Expand Up @@ -1091,7 +1091,7 @@ private final class CppMangleVisitor : Visitor

if (!substitute(t.sym))
{
cpp_mangle_name(t.sym, t.isConst());
cpp_mangle_name(t.sym, false);
}
if (t.isConst())
append(null); // C++ would have an extra type here
Expand Down
4 changes: 0 additions & 4 deletions gcc/d/dmd/dcast.d
Expand Up @@ -2757,9 +2757,6 @@ Lagain:
t2 = Type.basic[ty2];
e1 = e1.castTo(sc, t1);
e2 = e2.castTo(sc, t2);
//printf("after typeCombine():\n");
//print();
//printf("ty = %d, ty1 = %d, ty2 = %d\n", ty, ty1, ty2);
goto Lret;
}

Expand Down Expand Up @@ -3322,7 +3319,6 @@ Lret:
printf("\tt2 = %s\n", e2.type.toChars());
printf("\ttype = %s\n", t.toChars());
}
//print();
return true;

Lt1:
Expand Down
2 changes: 1 addition & 1 deletion gcc/d/dmd/declaration.d
Expand Up @@ -290,7 +290,7 @@ extern (C++) abstract class Declaration : Dsymbol
int inuse; // used to detect cycles

// overridden symbol with pragma(mangle, "...")
const(char)* mangleOverride;
const(char)[] mangleOverride;

final extern (D) this(Identifier id)
{
Expand Down
2 changes: 1 addition & 1 deletion gcc/d/dmd/declaration.h
Expand Up @@ -126,7 +126,7 @@ class Declaration : public Dsymbol
Prot protection;
LINK linkage;
int inuse; // used to detect cycles
const char *mangleOverride; // overridden symbol with pragma(mangle, "...")
DArray<const char> mangleOverride; // overridden symbol with pragma(mangle, "...")

const char *kind() const;
d_uns64 size(const Loc &loc);
Expand Down
7 changes: 1 addition & 6 deletions gcc/d/dmd/dmangle.d
Expand Up @@ -530,11 +530,6 @@ public:
/************************************************************
* Write length prefixed string to buf.
*/
void toBuffer(const(char)* id, Dsymbol s)
{
toBuffer(id[0 .. strlen(id)], s);
}

extern (D) void toBuffer(const(char)[] id, Dsymbol s)
{
const len = id.length;
Expand Down Expand Up @@ -867,7 +862,7 @@ public:
if (s.ident)
mangleIdentifier(s.ident, s);
else
toBuffer(s.toChars(), s);
toBuffer(s.toString(), s);
//printf("Dsymbol.mangle() %s = %s\n", s.toChars(), id);
}

Expand Down
18 changes: 12 additions & 6 deletions gcc/d/dmd/dmodule.d
Expand Up @@ -572,23 +572,29 @@ extern (C++) final class Module : Package
*/
File* setOutfile(const(char)* name, const(char)* dir, const(char)* arg, const(char)* ext)
{
const(char)* docfilename;
return setOutfile(name.toDString(), dir.toDString(), arg.toDString(), ext.toDString());
}

/// Ditto
extern(D) File* setOutfile(const(char)[] name, const(char)[] dir, const(char)[] arg, const(char)[] ext)
{
const(char)[] docfilename;
if (name)
{
docfilename = name;
}
else
{
const(char)* argdoc;
const(char)[] argdoc;
OutBuffer buf;
if (!strcmp(arg, "__stdin.d"))
if (arg == "__stdin.d")
{
version (Posix)
import core.sys.posix.unistd : getpid;
else version (Windows)
import core.sys.windows.windows : getpid = GetCurrentProcessId;
buf.printf("__stdin_%d.d", getpid());
arg = buf.peekString();
arg = buf.peekSlice();
}
if (global.params.preservePaths)
argdoc = arg;
Expand All @@ -602,9 +608,9 @@ extern (C++) final class Module : Package
}
docfilename = FileName.forceExt(argdoc, ext);
}
if (FileName.equals(docfilename, srcfile.name.str))
if (FileName.equals(docfilename, srcfile.name.toString()))
{
error("source file and output file have same name '%s'", srcfile.name.str);
error("source file and output file have same name '%s'", srcfile.name.toChars());
fatal();
}
return new File(docfilename);
Expand Down

0 comments on commit be8ad18

Please sign in to comment.