d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688
D front-end changes: - Import dmd v2.107.0-beta.1. - A string literal as an assert condition is deprecated. - Added `@standalone` for module constructors. D runtime changes: - Import druntime v2.107.0-beta.1. Phobos changes: - Import phobos v2.107.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd d8e3976a58. * dmd/VERSION: Bump version to v2.107.0-beta.1. * d-lang.cc (d_parse_file): Update for new front-end interface. * modules.cc (struct module_info): Add standalonectors. (build_module_tree): Implement @standalone. (register_module_decl): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d8e3976a58. * src/MERGE: Merge upstream phobos 7a6e95688.
This commit is contained in:
parent
838e706fa5
commit
5470a9b176
196 changed files with 1204 additions and 704 deletions
|
@ -1209,7 +1209,7 @@ d_parse_file (void)
|
|||
message ("import %s", m->toChars ());
|
||||
|
||||
OutBuffer buf;
|
||||
genhdrfile (m, buf);
|
||||
genhdrfile (m, global.params.dihdr.fullOutput, buf);
|
||||
d_write_file (m->hdrfile.toChars (), buf.peekChars ());
|
||||
}
|
||||
|
||||
|
@ -1373,7 +1373,7 @@ d_parse_file (void)
|
|||
OutBuffer buf;
|
||||
buf.doindent = 1;
|
||||
|
||||
moduleToBuffer (buf, m);
|
||||
moduleToBuffer (buf, true, m);
|
||||
message ("%s", buf.peekChars ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
f1a045928e03239b9477f9497f43f2cf0e61e959
|
||||
d8e3976a58d6aef7c2c9371028a2ca4460b5b2ce
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/dmd repository.
|
||||
|
|
|
@ -1 +1 @@
|
|||
v2.106.1-rc.1
|
||||
v2.107.0-beta.1
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/attribute.html#visibility_attributes, Visibility Attributes)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/access.d, _access.d)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions),
|
||||
* $(LINK2 https://dlang.org/spec/class.html, Class).
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aggregate.d, _aggregate.d)
|
||||
|
@ -65,7 +65,7 @@ enum ClassKind : ubyte
|
|||
* Returns:
|
||||
* 0-terminated string for `c`
|
||||
*/
|
||||
const(char)* toChars(ClassKind c) @safe
|
||||
const(char)* ClassKindToChars(ClassKind c) @safe
|
||||
{
|
||||
final switch (c)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aliasthis.d, _aliasthis.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 2009-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 2009-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/arrays.html#array-operations, Array Operations)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arrayop.d, _arrayop.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Provide aliases for arrays of certain declarations or statements.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arraytypes.d, _arraytypes.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 2006-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 2006-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Defines the base class for all nodes which are part of the AST.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ast_node.d, _ast_node.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Defines enums common to dmd and dmd as parse library.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/astenums.d, _astenums.d)
|
||||
* Documentation: https://dlang.org/phobos/dmd_astenums.html
|
||||
|
@ -63,7 +63,7 @@ enum STC : ulong // transfer changes to declaration.h
|
|||
foreach_ = 0x4000, /// variable for foreach loop
|
||||
variadic = 0x8000, /// the `variadic` parameter in: T foo(T a, U b, V variadic...)
|
||||
|
||||
// = 0x1_0000,
|
||||
constscoperef = 0x1_0000, /// when `in` means const|scope|ref
|
||||
templateparameter = 0x2_0000, /// template parameter
|
||||
ref_ = 0x4_0000, /// `ref`
|
||||
scope_ = 0x8_0000, /// `scope`
|
||||
|
@ -112,7 +112,7 @@ enum STC : ulong // transfer changes to declaration.h
|
|||
volatile_ = 0x40_0000_0000_0000, /// destined for volatile in the back end
|
||||
|
||||
safeGroup = STC.safe | STC.trusted | STC.system,
|
||||
IOR = STC.in_ | STC.ref_ | STC.out_,
|
||||
IOR = STC.constscoperef | STC.in_ | STC.ref_ | STC.out_,
|
||||
TYPECTOR = (STC.const_ | STC.immutable_ | STC.shared_ | STC.wild),
|
||||
FUNCATTR = (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.property | STC.live |
|
||||
safeGroup),
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* - Protection (`private`, `public`)
|
||||
* - Deprecated declarations (`@deprecated`)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/attrib.d, _attrib.d)
|
||||
|
@ -137,7 +137,7 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
|
|||
return "attribute";
|
||||
}
|
||||
|
||||
override bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
Dsymbols* d = include(null);
|
||||
return Dsymbol.oneMembers(d, ps, ident);
|
||||
|
@ -225,10 +225,10 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
|
|||
sc.visibility, sc.explicitVisibility, sc.aligndecl, sc.inlining);
|
||||
}
|
||||
|
||||
override final bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override final bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
bool t = Dsymbol.oneMembers(decl, ps, ident);
|
||||
if (t && *ps)
|
||||
if (t && ps)
|
||||
{
|
||||
/* This is to deal with the following case:
|
||||
* struct Tick {
|
||||
|
@ -238,7 +238,7 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
|
|||
* before the semantic analysis of 'to', so that template overloading based on the
|
||||
* 'this' pointer can be successful.
|
||||
*/
|
||||
FuncDeclaration fd = (*ps).isFuncDeclaration();
|
||||
FuncDeclaration fd = ps.isFuncDeclaration();
|
||||
if (fd)
|
||||
{
|
||||
/* Use storage_class2 instead of storage_class otherwise when we do .di generation
|
||||
|
@ -743,7 +743,7 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
|
|||
return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
|
||||
}
|
||||
|
||||
override final bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override final bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
//printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition.inc);
|
||||
if (condition.inc != Include.notComputed)
|
||||
|
@ -753,8 +753,8 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
|
|||
}
|
||||
else
|
||||
{
|
||||
bool res = (Dsymbol.oneMembers(decl, ps, ident) && *ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && *ps is null);
|
||||
*ps = null;
|
||||
bool res = (Dsymbol.oneMembers(decl, ps, ident) && ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && ps is null);
|
||||
ps = null;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration
|
|||
Dsymbol.arraySyntaxCopy(decl));
|
||||
}
|
||||
|
||||
override bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
// Required to support IFTI on a template that contains a
|
||||
// `static foreach` declaration. `super.oneMember` calls
|
||||
|
@ -912,7 +912,7 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration
|
|||
{
|
||||
return super.oneMember(ps, ident);
|
||||
}
|
||||
*ps = null; // a `static foreach` declaration may in general expand to multiple symbols
|
||||
ps = null; // a `static foreach` declaration may in general expand to multiple symbols
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1296,3 +1296,27 @@ int foreachUdaNoSemantic(Dsymbol sym, int delegate(Expression) dg)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns: true if the given expression is an enum from `core.attribute` named `id`
|
||||
*/
|
||||
bool isEnumAttribute(Expression e, Identifier id)
|
||||
{
|
||||
import dmd.attrib : isCoreUda;
|
||||
import dmd.id : Id;
|
||||
|
||||
// Logic based on dmd.objc.Supported.declaredAsOptionalCount
|
||||
auto typeExp = e.isTypeExp;
|
||||
if (!typeExp)
|
||||
return false;
|
||||
|
||||
auto typeEnum = typeExp.type.isTypeEnum();
|
||||
if (!typeEnum)
|
||||
return false;
|
||||
|
||||
if (isCoreUda(typeEnum.sym, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
virtual Scope *newScope(Scope *sc);
|
||||
void addComment(const utf8_t *comment) override;
|
||||
const char *kind() const override;
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident) override;
|
||||
bool oneMember(Dsymbol *&ps, Identifier *ident) override;
|
||||
bool hasPointers() override final;
|
||||
bool hasStaticCtorOrDtor() override final;
|
||||
void checkCtorConstInit() override final;
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
StorageClassDeclaration *syntaxCopy(Dsymbol *s) override;
|
||||
Scope *newScope(Scope *sc) override;
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident) override final;
|
||||
bool oneMember(Dsymbol *&ps, Identifier *ident) override final;
|
||||
StorageClassDeclaration *isStorageClassDeclaration() override { return this; }
|
||||
|
||||
void accept(Visitor *v) override { v->visit(this); }
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
Dsymbols *elsedecl; // array of Dsymbol's for else block
|
||||
|
||||
ConditionalDeclaration *syntaxCopy(Dsymbol *s) override;
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident) override final;
|
||||
bool oneMember(Dsymbol *&ps, Identifier *ident) override final;
|
||||
Dsymbols *include(Scope *sc) override;
|
||||
void addComment(const utf8_t *comment) override final;
|
||||
void accept(Visitor *v) override { v->visit(this); }
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
Dsymbols *cache;
|
||||
|
||||
StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident) override;
|
||||
bool oneMember(Dsymbol *&ps, Identifier *ident) override;
|
||||
Dsymbols *include(Scope *sc) override;
|
||||
void addComment(const utf8_t *comment) override;
|
||||
const char *kind() const override;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Find out in what ways control flow can exit a statement block.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/blockexit.d, _blockexit.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Currently includes functions from `std.math`, `core.math` and `core.bitop`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/builtin.d, _builtin.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/function.html#nothrow-functions, Nothrow Functions)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/canthrow.d, _canthrow.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Check the arguments to `printf` and `scanf` against the `format` string.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/chkformat.d, _chkformat.d)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Builds struct member functions if needed and not defined by the user.
|
||||
* Includes `opEquals`, `opAssign`, post blit, copy constructor and destructor.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/clone.d, _clone.d)
|
||||
|
@ -1571,7 +1571,7 @@ private Statement generateCopyCtorBody(StructDeclaration sd)
|
|||
* `true` if one needs to be generated
|
||||
* `false` otherwise
|
||||
*/
|
||||
private bool needCopyCtor(StructDeclaration sd, out bool hasCpCtor)
|
||||
bool needCopyCtor(StructDeclaration sd, out bool hasCpCtor)
|
||||
{
|
||||
if (global.errors)
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* A library bitfields utility
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Dennis Korpel
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/bitfields.d, common/bitfields.d)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Functions and objects dedicated to file I/O and management. TODO: Move here artifacts
|
||||
* from places such as root/ so both the frontend and the backend have access to them.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Walter Bright, https://www.digitalmars.com
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/file.d, common/_file.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* An expandable buffer in which you can write text or binary data.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Walter Bright, https://www.digitalmars.com
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/outbuffer.d, root/_outbuffer.d)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Common string functions including filename manipulation.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Walter Bright, https://www.digitalmars.com
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/smallbuffer.d, common/_smallbuffer.d)
|
||||
|
@ -48,7 +48,7 @@ struct SmallBuffer(Element)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(len < sizeof.max / (2 * Element.sizeof));
|
||||
assert(len < size_t.max / (2 * Element.sizeof));
|
||||
_extent = (cast(typeof(_extent.ptr)) malloc(len * Element.sizeof))[0 .. len];
|
||||
_extent.ptr || assert(0, "Out of memory.");
|
||||
needsFree = true;
|
||||
|
@ -76,7 +76,7 @@ struct SmallBuffer(Element)
|
|||
else
|
||||
{
|
||||
__dtor();
|
||||
assert(len < sizeof.max / Element.sizeof);
|
||||
assert(len < size_t.max / Element.sizeof);
|
||||
_extent = (cast(typeof(_extent.ptr)) malloc(len * Element.sizeof))[0 .. len];
|
||||
_extent.ptr || assert(0, "Out of memory.");
|
||||
needsFree = true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Describes a back-end compiler and implements compiler-specific actions.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d, _compiler.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/version.html, Conditional Compilation)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cond.d, _cond.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/float.html#fp_const_folding, Floating Point Constant Folding)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/constfold.d, _constfold.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: C11
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cparse.d, _cparse.d)
|
||||
|
@ -605,16 +605,24 @@ final class CParser(AST) : Parser!AST
|
|||
{
|
||||
Identifier ident;
|
||||
nextToken();
|
||||
if (token.value != TOK.identifier)
|
||||
{
|
||||
error("identifier expected following `goto`");
|
||||
ident = null;
|
||||
}
|
||||
else
|
||||
if (token.value == TOK.identifier)
|
||||
{
|
||||
ident = token.ident;
|
||||
nextToken();
|
||||
}
|
||||
else if (token.value == TOK.mul)
|
||||
{
|
||||
/* https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
*/
|
||||
error("`goto *` computed goto extension is not supported");
|
||||
ident = null;
|
||||
cparseUnaryExp(); // parse and throw away
|
||||
}
|
||||
else
|
||||
{
|
||||
error("identifier expected following `goto`");
|
||||
ident = null;
|
||||
}
|
||||
s = new AST.GotoStatement(loc, ident);
|
||||
check(TOK.semicolon, "`goto` statement");
|
||||
break;
|
||||
|
@ -1056,6 +1064,14 @@ final class CParser(AST) : Parser!AST
|
|||
break;
|
||||
}
|
||||
|
||||
case TOK.andAnd:
|
||||
/* https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
*/
|
||||
error("unary `&&` computed goto extension is not supported");
|
||||
nextToken();
|
||||
e = cparseCastExp();
|
||||
break;
|
||||
|
||||
case TOK._Alignof:
|
||||
{
|
||||
nextToken();
|
||||
|
@ -1931,20 +1947,18 @@ final class CParser(AST) : Parser!AST
|
|||
}
|
||||
else if (auto tt = dt.isTypeTag())
|
||||
{
|
||||
if (tt.id || tt.tok == TOK.enum_)
|
||||
{
|
||||
if (!tt.id && id)
|
||||
/* This applies for enums declared as
|
||||
* typedef enum {A} E;
|
||||
*/
|
||||
tt.id = id;
|
||||
Specifier spec;
|
||||
declareTag(tt, spec);
|
||||
}
|
||||
if (!tt.id && id)
|
||||
/* This applies for enums declared as
|
||||
* typedef enum {A} E;
|
||||
*/
|
||||
tt.id = id;
|
||||
Specifier spec;
|
||||
declareTag(tt, spec);
|
||||
idt = tt.id;
|
||||
}
|
||||
if (isalias)
|
||||
{
|
||||
//printf("AliasDeclaration %s %s\n", id.toChars(), dt.toChars());
|
||||
auto ad = new AST.AliasDeclaration(token.loc, id, dt);
|
||||
if (id == idt)
|
||||
ad.adFlags |= ad.hidden; // do not print when generating .di files
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This is the POSIX side of the implementation.
|
||||
* It exports two functions to C++, `toCppMangleItanium` and `cppTypeInfoMangleItanium`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Walter Bright, https://www.digitalmars.com
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cppmangle.d, _cppmangle.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* CTFE for expressions involving pointers, slices, array concatenation etc.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ctfeexpr.d, _ctfeexpr.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Manage flow analysis for constructors.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ctorflow.d, _ctorflow.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Semantic analysis for cast-expressions.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dcast.d, _dcast.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/class.html, Classes)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dclass.d, _dclass.d)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Miscellaneous declarations, including typedef, alias, variable declarations including the
|
||||
* implicit this declaration, type tuples, ClassInfo, ModuleInfo and various TypeInfos.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/declaration.d, _declaration.d)
|
||||
|
@ -246,8 +246,6 @@ extern (C++) abstract class Declaration : Dsymbol
|
|||
enum nounderscore = 4; // don't prepend _ to mangled name
|
||||
enum hidden = 8; // don't print this in .di files
|
||||
|
||||
Symbol* isym; // import version of csym
|
||||
|
||||
// overridden symbol with pragma(mangle, "...")
|
||||
const(char)[] mangleOverride;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -54,7 +54,7 @@ struct AttributeViolation;
|
|||
#define STCforeach 0x4000ULL /// variable for foreach loop
|
||||
#define STCvariadic 0x8000ULL /// the `variadic` parameter in: T foo(T a, U b, V variadic...)
|
||||
|
||||
// 0x10000ULL
|
||||
#define STCconstscoperef 0x10000ULL /// when `in` means const|scope|ref
|
||||
#define STCtemplateparameter 0x20000ULL /// template parameter
|
||||
#define STCref 0x40000ULL /// `ref`
|
||||
#define STCscope 0x80000ULL /// `scope`
|
||||
|
@ -118,7 +118,6 @@ public:
|
|||
LINK _linkage; // may be `LINK::system`; use `resolvedLinkage()` to resolve it
|
||||
short inuse; // used to detect cycles
|
||||
uint8_t adFlags;
|
||||
Symbol* isym; // import version of csym
|
||||
DString mangleOverride; // overridden symbol with pragma(mangle, "...")
|
||||
|
||||
const char *kind() const override;
|
||||
|
@ -843,6 +842,7 @@ public:
|
|||
class SharedStaticCtorDeclaration final : public StaticCtorDeclaration
|
||||
{
|
||||
public:
|
||||
bool standalone;
|
||||
SharedStaticCtorDeclaration *syntaxCopy(Dsymbol *) override;
|
||||
|
||||
SharedStaticCtorDeclaration *isSharedStaticCtorDeclaration() override { return this; }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/function.html#lazy-params, Lazy Parameters)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/delegatize.d, _delegatize.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/enum.html, Enums)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/denum.d, _denum.d)
|
||||
|
@ -83,7 +83,7 @@ extern (C++) final class EnumDeclaration : ScopeDsymbol
|
|||
return ed;
|
||||
}
|
||||
|
||||
override bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
if (isAnonymous())
|
||||
return Dsymbol.oneMembers(members, ps, ident);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* A `Dsymbol` representing a renamed import.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dimport.d, _dimport.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: ($LINK2 https://dlang.org/spec/function.html#interpretation, Compile Time Function Execution (CTFE))
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dinterpret.d, _dinterpret.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Text macro processor for Ddoc.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmacro.d, _dmacro.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/abi.html#name_mangling, Name Mangling)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Walter Bright, https://www.digitalmars.com
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmangle.d, _dmangle.d)
|
||||
|
@ -528,7 +528,7 @@ void mangleParameter(Parameter p, ref OutBuffer buf, ref Backref backref)
|
|||
if (stc & STC.return_)
|
||||
buf.writestring("Nk"); // return
|
||||
|
||||
switch (stc & (STC.IOR | STC.lazy_))
|
||||
switch (stc & ((STC.IOR | STC.lazy_) & ~STC.constscoperef))
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/module.html, Modules)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmodule.d, _dmodule.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/ddoc.html, Documentation Generator)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/doc.d, _doc.d)
|
||||
|
@ -1296,7 +1296,7 @@ void toDocBuffer(Dsymbol s, ref OutBuffer buf, Scope* sc)
|
|||
Type origType = d.originalType ? d.originalType : d.type;
|
||||
if (origType.ty == Tfunction)
|
||||
{
|
||||
functionToBufferFull(cast(TypeFunction)origType, *buf, d.ident, &hgs, td);
|
||||
functionToBufferFull(cast(TypeFunction)origType, *buf, d.ident, hgs, td);
|
||||
}
|
||||
else
|
||||
toCBuffer(origType, *buf, d.ident, hgs);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Not to be confused with the `scope` storage class.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dscope.d, _dscope.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dstruct.d, _dstruct.d)
|
||||
|
@ -434,7 +434,11 @@ extern (C++) class StructDeclaration : AggregateDeclaration
|
|||
|
||||
ispod = ThreeState.yes;
|
||||
|
||||
if (enclosing || postblit || dtor || hasCopyCtor)
|
||||
import dmd.clone;
|
||||
bool hasCpCtorLocal;
|
||||
needCopyCtor(this, hasCpCtorLocal);
|
||||
|
||||
if (enclosing || search(this, loc, Id.postblit) || search(this, loc, Id.dtor) || hasCpCtorLocal)
|
||||
{
|
||||
ispod = ThreeState.no;
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* The base class for a D symbol, which can be a module, variable, function, enum, etc.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dsymbol.d, _dsymbol.d)
|
||||
|
@ -845,27 +845,27 @@ extern (C++) class Dsymbol : ASTNode
|
|||
/**************************************
|
||||
* Determine if this symbol is only one.
|
||||
* Returns:
|
||||
* false, *ps = NULL: There are 2 or more symbols
|
||||
* true, *ps = NULL: There are zero symbols
|
||||
* true, *ps = symbol: The one and only one symbol
|
||||
* false, ps = null: There are 2 or more symbols
|
||||
* true, ps = null: There are zero symbols
|
||||
* true, ps = symbol: The one and only one symbol
|
||||
*/
|
||||
bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
//printf("Dsymbol::oneMember()\n");
|
||||
*ps = this;
|
||||
ps = this;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* Same as Dsymbol::oneMember(), but look at an array of Dsymbols.
|
||||
*/
|
||||
extern (D) static bool oneMembers(Dsymbols* members, Dsymbol* ps, Identifier ident)
|
||||
extern (D) static bool oneMembers(Dsymbols* members, out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
//printf("Dsymbol::oneMembers() %d\n", members ? members.length : 0);
|
||||
Dsymbol s = null;
|
||||
if (!members)
|
||||
{
|
||||
*ps = null;
|
||||
ps = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -877,21 +877,21 @@ extern (C++) class Dsymbol : ASTNode
|
|||
if (!x)
|
||||
{
|
||||
//printf("\tfalse 1\n");
|
||||
assert(*ps is null);
|
||||
assert(ps is null);
|
||||
return false;
|
||||
}
|
||||
if (*ps)
|
||||
if (ps)
|
||||
{
|
||||
assert(ident);
|
||||
if (!(*ps).ident || !(*ps).ident.equals(ident))
|
||||
if (!ps.ident || !ps.ident.equals(ident))
|
||||
continue;
|
||||
if (!s)
|
||||
s = *ps;
|
||||
else if (s.isOverloadable() && (*ps).isOverloadable())
|
||||
s = ps;
|
||||
else if (s.isOverloadable() && ps.isOverloadable())
|
||||
{
|
||||
// keep head of overload set
|
||||
FuncDeclaration f1 = s.isFuncDeclaration();
|
||||
FuncDeclaration f2 = (*ps).isFuncDeclaration();
|
||||
FuncDeclaration f2 = ps.isFuncDeclaration();
|
||||
if (f1 && f2)
|
||||
{
|
||||
assert(!f1.isFuncAliasDeclaration());
|
||||
|
@ -908,13 +908,13 @@ extern (C++) class Dsymbol : ASTNode
|
|||
}
|
||||
else // more than one symbol
|
||||
{
|
||||
*ps = null;
|
||||
ps = null;
|
||||
//printf("\tfalse 2\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
*ps = s; // s is the one symbol, null if none
|
||||
ps = s; // s is the one symbol, null if none
|
||||
//printf("\ttrue\n");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
virtual bool needThis(); // need a 'this' pointer?
|
||||
virtual Visibility visible();
|
||||
virtual Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees
|
||||
virtual bool oneMember(Dsymbol **ps, Identifier *ident);
|
||||
virtual bool oneMember(Dsymbol *&ps, Identifier *ident);
|
||||
virtual bool hasPointers();
|
||||
virtual bool hasStaticCtorOrDtor();
|
||||
virtual void addObjcSymbols(ClassDeclarations *, ClassDeclarations *) { }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Does the semantic 1 pass on the AST, which looks at symbol declarations but not initializers
|
||||
* or function bodies.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dsymbolsem.d, _dsymbolsem.d)
|
||||
|
@ -947,7 +947,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
|
||||
// At this point we can add `scope` to the STC instead of `in`,
|
||||
// because we are never going to use this variable's STC for user messages
|
||||
if (dsym.storage_class & STC.in_ && global.params.previewIn)
|
||||
if (dsym.storage_class & STC.constscoperef)
|
||||
dsym.storage_class |= STC.scope_;
|
||||
|
||||
if (dsym.storage_class & STC.scope_)
|
||||
|
@ -2964,7 +2964,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
if (tempdecl.members)
|
||||
{
|
||||
Dsymbol s;
|
||||
if (Dsymbol.oneMembers(tempdecl.members, &s, tempdecl.ident) && s)
|
||||
if (Dsymbol.oneMembers(tempdecl.members, s, tempdecl.ident) && s)
|
||||
{
|
||||
tempdecl.onemember = s;
|
||||
s.parent = tempdecl;
|
||||
|
@ -4096,7 +4096,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
|
||||
auto fd = s.isFuncDeclaration();
|
||||
functionToBufferFull(cast(TypeFunction)(funcdecl.type), buf,
|
||||
new Identifier(funcdecl.toPrettyChars()), &hgs, null);
|
||||
new Identifier(funcdecl.toPrettyChars()), hgs, null);
|
||||
const(char)* funcdeclToChars = buf.peekChars();
|
||||
|
||||
if (fd)
|
||||
|
@ -4119,7 +4119,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
else
|
||||
{
|
||||
functionToBufferFull(cast(TypeFunction)(fd.type), buf1,
|
||||
new Identifier(fd.toPrettyChars()), &hgs, null);
|
||||
new Identifier(fd.toPrettyChars()), hgs, null);
|
||||
|
||||
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?",
|
||||
funcdeclToChars, buf1.peekChars());
|
||||
|
@ -4592,6 +4592,24 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
m.needmoduleinfo = 1;
|
||||
//printf("module1 %s needs moduleinfo\n", m.toChars());
|
||||
}
|
||||
|
||||
foreachUda(scd, sc, (Expression e) {
|
||||
import dmd.attrib : isEnumAttribute;
|
||||
if (!isEnumAttribute(e, Id.udaStandalone))
|
||||
return 0;
|
||||
|
||||
if (auto sharedCtor = scd.isSharedStaticCtorDeclaration())
|
||||
{
|
||||
auto trust = sharedCtor.type.isTypeFunction().trust;
|
||||
if (trust != TRUST.system && trust != TRUST.trusted)
|
||||
error(e.loc, "a module constructor using `@%s` must be `@system` or `@trusted`", Id.udaStandalone.toChars());
|
||||
sharedCtor.standalone = true;
|
||||
}
|
||||
else
|
||||
.error(e.loc, "`@%s` can only be used on shared static constructors", Id.udaStandalone.toChars());
|
||||
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
override void visit(StaticDtorDeclaration sdd)
|
||||
|
@ -4831,9 +4849,15 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
{
|
||||
if (ts.sym != sd)
|
||||
{
|
||||
auto ti = ts.sym.isInstantiated();
|
||||
TemplateInstance ti = ts.sym.isInstantiated();
|
||||
if (ti && isError(ti))
|
||||
ts.sym = sd;
|
||||
/* For C modules, if module A contains `struct S;` and
|
||||
* module B contains `struct S { members...}` then replace
|
||||
* the former with the latter
|
||||
*/
|
||||
else if (!ts.sym.members && sd.members)
|
||||
ts.sym = sd;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5357,7 +5381,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
cldec.classKind = ClassKind.cpp;
|
||||
if (cldec.classKind != cldec.baseClass.classKind)
|
||||
.error(cldec.loc, "%s `%s` with %s linkage cannot inherit from class `%s` with %s linkage", cldec.kind, cldec.toPrettyChars,
|
||||
cldec.classKind.toChars(), cldec.baseClass.toChars(), cldec.baseClass.classKind.toChars());
|
||||
ClassKindToChars(cldec.classKind), cldec.baseClass.toChars(), ClassKindToChars(cldec.baseClass.classKind));
|
||||
|
||||
if (cldec.baseClass.stack)
|
||||
cldec.stack = true;
|
||||
|
@ -6807,7 +6831,7 @@ void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList
|
|||
if (tempinst.members.length)
|
||||
{
|
||||
Dsymbol s;
|
||||
if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s)
|
||||
if (Dsymbol.oneMembers(tempinst.members, s, tempdecl.ident) && s)
|
||||
{
|
||||
//printf("tempdecl.ident = %s, s = `%s %s`\n", tempdecl.ident.toChars(), s.kind(), s.toPrettyChars());
|
||||
//printf("setting aliasdecl\n");
|
||||
|
@ -6852,7 +6876,7 @@ void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList
|
|||
if (tempinst.members.length)
|
||||
{
|
||||
Dsymbol s;
|
||||
if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s)
|
||||
if (Dsymbol.oneMembers(tempinst.members, s, tempdecl.ident) && s)
|
||||
{
|
||||
if (!tempinst.aliasdecl || tempinst.aliasdecl != s)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* arguments, and uses it if found.
|
||||
* - Otherwise, the rest of semantic is run on the `TemplateInstance`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dtemplate.d, _dtemplate.d)
|
||||
|
@ -615,7 +615,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
|||
return;
|
||||
|
||||
Dsymbol s;
|
||||
if (!Dsymbol.oneMembers(members, &s, ident) || !s)
|
||||
if (!Dsymbol.oneMembers(members, s, ident) || !s)
|
||||
return;
|
||||
|
||||
onemember = s;
|
||||
|
@ -6029,9 +6029,9 @@ extern (C++) class TemplateInstance : ScopeDsymbol
|
|||
return "template instance";
|
||||
}
|
||||
|
||||
override bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
*ps = null;
|
||||
ps = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7599,7 +7599,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
|
|||
if (members.length)
|
||||
{
|
||||
Dsymbol sa;
|
||||
if (Dsymbol.oneMembers(members, &sa, tempdecl.ident) && sa)
|
||||
if (Dsymbol.oneMembers(members, sa, tempdecl.ident) && sa)
|
||||
aliasdecl = sa;
|
||||
}
|
||||
done = true;
|
||||
|
@ -7820,7 +7820,7 @@ extern (C++) final class TemplateMixin : TemplateInstance
|
|||
return "mixin";
|
||||
}
|
||||
|
||||
override bool oneMember(Dsymbol* ps, Identifier ident)
|
||||
override bool oneMember(out Dsymbol ps, Identifier ident)
|
||||
{
|
||||
return Dsymbol.oneMember(ps, ident);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This module contains the implementation of the C++ header generation available through
|
||||
* the command line switch -Hc.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dtohd, _dtoh.d)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Specification: $(LINK2 https://dlang.org/spec/version.html#version-specification, Version Specification),
|
||||
* $(LINK2 https://dlang.org/spec/version.html#debug_specification, Debug Specification).
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dversion.d, _dversion.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification $(LINK2 https://dlang.org/spec/entity.html, Named Character Entities)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/entity.d, _entity.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
bool inuse(bool v);
|
||||
|
||||
EnumDeclaration *syntaxCopy(Dsymbol *s) override;
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident) override;
|
||||
bool oneMember(Dsymbol *&ps, Identifier *ident) override;
|
||||
Type *getType() override;
|
||||
const char *kind() const override;
|
||||
bool isDeprecated() const override; // is Dsymbol deprecated?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Functions for raising errors.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/errors.d, _errors.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Provides an abstraction for what to do with error messages.
|
||||
*
|
||||
* Copyright: Copyright (C) 2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 2023-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/errorsink.d, _errorsink.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Most of the logic to implement scoped pointers and scoped references is here.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/escape.d, _escape.d)
|
||||
|
@ -1296,7 +1296,7 @@ private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
|
|||
{
|
||||
if (log)
|
||||
{
|
||||
printf("byref `%s` %s\n", v.toChars(), toChars(buildScopeRef(v.storage_class)));
|
||||
printf("byref `%s` %s\n", v.toChars(), ScopeRefToChars(buildScopeRef(v.storage_class)));
|
||||
}
|
||||
|
||||
// 'featureState' tells us whether to emit an error or a deprecation,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/expression.d, _expression.d)
|
||||
|
@ -420,10 +420,7 @@ extern (C++) abstract class Expression : ASTNode
|
|||
|
||||
override const(char)* toChars() const
|
||||
{
|
||||
OutBuffer buf;
|
||||
HdrGenState hgs;
|
||||
toCBuffer(this, buf, hgs);
|
||||
return buf.extractChars();
|
||||
return .toChars(this);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
|
||||
union
|
||||
{
|
||||
Symbol *sym; // back end symbol to initialize with literal
|
||||
Symbol *sym; // back end symbol to initialize with literal (used as a Symbol*)
|
||||
|
||||
// those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer.
|
||||
StructLiteralExp *inlinecopy;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/expressionsem.d, _expressionsem.d)
|
||||
|
@ -6813,11 +6813,14 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
|||
{
|
||||
if (sc.func.fes)
|
||||
{
|
||||
deprecation(e.loc, "%s `%s` is shadowing %s `%s`. Rename the `foreach` variable.", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
|
||||
deprecation(e.loc, "%s `%s` is shadowing %s `%s`", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
|
||||
deprecationSupplemental(s2.loc, "declared here");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
error(e.loc, "%s `%s` is shadowing %s `%s`", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
|
||||
errorSupplemental(s2.loc, "declared here");
|
||||
return setError();
|
||||
}
|
||||
}
|
||||
|
@ -7592,6 +7595,13 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
|||
{
|
||||
printf("AssertExp::semantic('%s')\n", exp.toChars());
|
||||
}
|
||||
if (auto e = exp.e1.isStringExp())
|
||||
{
|
||||
// deprecated in 2.107
|
||||
deprecation(e.loc, "assert condition cannot be a string literal");
|
||||
deprecationSupplemental(e.loc, "If intentional, use `%s !is null` instead to preserve behaviour",
|
||||
e.toChars());
|
||||
}
|
||||
|
||||
const generateMsg = !exp.msg &&
|
||||
sc.needsCodegen() && // let ctfe interpreter handle the error message
|
||||
|
@ -15037,6 +15047,8 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
|
|||
*/
|
||||
Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
||||
{
|
||||
exp.loc = loc;
|
||||
|
||||
Expression visit(Expression exp)
|
||||
{
|
||||
if (auto unaExp = exp.isUnaExp())
|
||||
|
@ -15044,7 +15056,6 @@ Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
|
|||
unaExp.e1 = unaExp.e1.resolveLoc(loc, sc);
|
||||
return unaExp;
|
||||
}
|
||||
exp.loc = loc;
|
||||
return exp;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Read a file from disk and store it in memory.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/file_manager.d, _file_manager.d)
|
||||
* Documentation: https://dlang.org/phobos/dmd_file_manager.html
|
||||
|
@ -10,6 +10,7 @@
|
|||
|
||||
module dmd.file_manager;
|
||||
|
||||
import core.stdc.stdio;
|
||||
import dmd.root.stringtable : StringTable;
|
||||
import dmd.root.file : File, Buffer;
|
||||
import dmd.root.filename : FileName, isDirSeparator;
|
||||
|
@ -281,63 +282,103 @@ nothrow:
|
|||
return fb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the given filename from the internal file buffer table, and returns the lines within the file.
|
||||
* If the file does not already exist within the table, it will be read from the filesystem.
|
||||
* If it has been read before,
|
||||
*
|
||||
* Returns: the loaded source file if it was found in memory,
|
||||
* otherwise `null`
|
||||
/**********************************
|
||||
* Take `text` and turn it into an InputRange that emits
|
||||
* slices into `text` for each line.
|
||||
* Params:
|
||||
* text = array of characters
|
||||
* Returns:
|
||||
* InputRange accessing `text` as a sequence of lines
|
||||
* Reference:
|
||||
* `std.string.splitLines()`
|
||||
*/
|
||||
const(char)[][] getLines(FileName file)
|
||||
auto splitLines(const char[] text)
|
||||
{
|
||||
const(char)[][] lines;
|
||||
if (const buffer = lookup(file))
|
||||
struct Range
|
||||
{
|
||||
const slice = buffer;
|
||||
size_t start, end;
|
||||
for (auto i = 0; i < slice.length; i++)
|
||||
@safe:
|
||||
@nogc:
|
||||
nothrow:
|
||||
pure:
|
||||
private:
|
||||
|
||||
const char[] text;
|
||||
size_t index; // index of start of line
|
||||
size_t eolIndex; // index of end of line before newline characters
|
||||
size_t nextIndex; // index past end of line
|
||||
|
||||
public this(const char[] text)
|
||||
{
|
||||
const c = slice[i];
|
||||
if (c == '\n' || c == '\r')
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public bool empty() { return index == text.length; }
|
||||
|
||||
public void popFront() { advance(); index = nextIndex; }
|
||||
|
||||
public const(char)[] front() { advance(); return text[index .. eolIndex]; }
|
||||
|
||||
private void advance()
|
||||
{
|
||||
if (index != nextIndex) // if already advanced
|
||||
return;
|
||||
|
||||
for (size_t i = index; i < text.length; ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
switch (text[i])
|
||||
{
|
||||
end = i;
|
||||
// Appending lines one at a time will certainly be slow
|
||||
lines ~= cast(const(char)[])slice[start .. end];
|
||||
}
|
||||
// Check for Windows-style CRLF newlines
|
||||
if (c == '\r')
|
||||
{
|
||||
if (slice.length > i + 1 && slice[i + 1] == '\n')
|
||||
{
|
||||
// This is a CRLF sequence, skip over two characters
|
||||
start = i + 2;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just a CR sequence
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The next line should start after the LF sequence
|
||||
start = i + 1;
|
||||
case '\v', '\f', '\n':
|
||||
eolIndex = i;
|
||||
nextIndex = i + 1;
|
||||
return;
|
||||
|
||||
case '\r':
|
||||
if (i + 1 < text.length && text[i + 1] == '\n') // decode "\r\n"
|
||||
{
|
||||
eolIndex = i;
|
||||
nextIndex = i + 2;
|
||||
return;
|
||||
}
|
||||
eolIndex = i;
|
||||
nextIndex = i + 1;
|
||||
return;
|
||||
|
||||
/* Manually decode:
|
||||
* NEL is C2 85
|
||||
*/
|
||||
case 0xC2:
|
||||
if (i + 1 < text.length && text[i + 1] == 0x85)
|
||||
{
|
||||
eolIndex = i;
|
||||
nextIndex = i + 2;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Manually decode:
|
||||
* lineSep is E2 80 A8
|
||||
* paraSep is E2 80 A9
|
||||
*/
|
||||
case 0xE2:
|
||||
if (i + 2 < text.length &&
|
||||
text[i + 1] == 0x80 &&
|
||||
(text[i + 2] == 0xA8 || text[i + 2] == 0xA9)
|
||||
)
|
||||
{
|
||||
eolIndex = i;
|
||||
nextIndex = i + 3;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slice[$ - 1] != '\r' && slice[$ - 1] != '\n')
|
||||
{
|
||||
end = slice.length;
|
||||
lines ~= cast(const(char)[])slice[start .. end];
|
||||
}
|
||||
}
|
||||
|
||||
return lines;
|
||||
return Range(text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Utility to visit every variable in an expression.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/foreachvar.d, _foreachvar.d)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* - `invariant`
|
||||
* - `unittest`
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/func.d, _func.d)
|
||||
|
@ -4253,6 +4253,9 @@ extern (C++) class StaticCtorDeclaration : FuncDeclaration
|
|||
*/
|
||||
extern (C++) final class SharedStaticCtorDeclaration : StaticCtorDeclaration
|
||||
{
|
||||
/// Exclude this constructor from cyclic dependency check
|
||||
bool standalone;
|
||||
|
||||
extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc)
|
||||
{
|
||||
super(loc, endloc, "_sharedStaticCtor", stc);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Stores command line options and contains other miscellaneous declarations.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/globals.d, _globals.d)
|
||||
|
@ -275,7 +275,7 @@ extern (C++) struct Global
|
|||
{
|
||||
const(char)[] inifilename; /// filename of configuration file as given by `-conf=`, or default value
|
||||
|
||||
string copyright = "Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved";
|
||||
string copyright = "Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved";
|
||||
string written = "written by Walter Bright";
|
||||
|
||||
Array!(const(char)*)* path; /// Array of char*'s which form the import lookup path
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* This 'glues' either the DMC or GCC back-end to the front-end.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/gluelayer.d, _gluelayer.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Also used to convert AST nodes to D code in general, e.g. for error messages or `printf` debugging.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/hdrgen.d, _hdrgen.d)
|
||||
|
@ -35,7 +35,6 @@ import dmd.dtemplate;
|
|||
import dmd.dversion;
|
||||
import dmd.expression;
|
||||
import dmd.func;
|
||||
import dmd.globals;
|
||||
import dmd.id;
|
||||
import dmd.identifier;
|
||||
import dmd.init;
|
||||
|
@ -50,7 +49,6 @@ import dmd.rootobject;
|
|||
import dmd.root.string;
|
||||
import dmd.statement;
|
||||
import dmd.staticassert;
|
||||
import dmd.target;
|
||||
import dmd.tokens;
|
||||
import dmd.visitor;
|
||||
|
||||
|
@ -60,6 +58,8 @@ struct HdrGenState
|
|||
bool ddoc; /// true if generating Ddoc file
|
||||
bool fullDump; /// true if generating a full AST dump file
|
||||
bool importcHdr; /// true if generating a .di file from an ImportC file
|
||||
bool doFuncBodies; /// include function bodies in output
|
||||
bool vcg_ast; /// write out codegen-ast
|
||||
|
||||
bool fullQual; /// fully qualify types when printing
|
||||
int tpltMember;
|
||||
|
@ -78,9 +78,10 @@ enum TEST_EMIT_ALL = 0;
|
|||
* Generate a header (.di) file for Module m.
|
||||
* Params:
|
||||
* m = Module to generate header for
|
||||
* doFuncBodies = generate function definitions rather than just declarations
|
||||
* buf = buffer to write the data to
|
||||
*/
|
||||
extern (C++) void genhdrfile(Module m, ref OutBuffer buf)
|
||||
extern (C++) void genhdrfile(Module m, bool doFuncBodies, ref OutBuffer buf)
|
||||
{
|
||||
buf.doindent = 1;
|
||||
buf.printf("// D import file generated from '%s'", m.srcfile.toChars());
|
||||
|
@ -88,6 +89,7 @@ extern (C++) void genhdrfile(Module m, ref OutBuffer buf)
|
|||
HdrGenState hgs;
|
||||
hgs.hdrgen = true;
|
||||
hgs.importcHdr = (m.filetype == FileType.c);
|
||||
hgs.doFuncBodies = doFuncBodies;
|
||||
toCBuffer(m, buf, hgs);
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,14 @@ public extern (C++) const(char)* toChars(const Statement s)
|
|||
return buf.extractSlice().ptr;
|
||||
}
|
||||
|
||||
public extern (C++) const(char)* toChars(const Expression e)
|
||||
{
|
||||
HdrGenState hgs;
|
||||
OutBuffer buf;
|
||||
toCBuffer(e, buf, hgs);
|
||||
return buf.extractChars();
|
||||
}
|
||||
|
||||
public extern (C++) const(char)* toChars(const Initializer i)
|
||||
{
|
||||
OutBuffer buf;
|
||||
|
@ -116,6 +126,17 @@ public extern (C++) const(char)* toChars(const Initializer i)
|
|||
return buf.extractChars();
|
||||
}
|
||||
|
||||
public extern (C++) const(char)* toChars(const Type t)
|
||||
{
|
||||
OutBuffer buf;
|
||||
buf.reserve(16);
|
||||
HdrGenState hgs;
|
||||
hgs.fullQual = (t.ty == Tclass && !t.mod);
|
||||
|
||||
toCBuffer(t, buf, null, hgs);
|
||||
return buf.extractChars();
|
||||
}
|
||||
|
||||
public const(char)[] toString(const Initializer i)
|
||||
{
|
||||
OutBuffer buf;
|
||||
|
@ -128,16 +149,18 @@ public const(char)[] toString(const Initializer i)
|
|||
* Dumps the full contents of module `m` to `buf`.
|
||||
* Params:
|
||||
* buf = buffer to write to.
|
||||
* vcg_ast = write out codegen ast
|
||||
* m = module to visit all members of.
|
||||
*/
|
||||
extern (C++) void moduleToBuffer(ref OutBuffer buf, Module m)
|
||||
extern (C++) void moduleToBuffer(ref OutBuffer buf, bool vcg_ast, Module m)
|
||||
{
|
||||
HdrGenState hgs;
|
||||
hgs.fullDump = true;
|
||||
hgs.vcg_ast = vcg_ast;
|
||||
toCBuffer(m, buf, hgs);
|
||||
}
|
||||
|
||||
void moduleToBuffer2(Module m, ref OutBuffer buf, HdrGenState* hgs)
|
||||
void moduleToBuffer2(Module m, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
if (m.md)
|
||||
{
|
||||
|
@ -171,7 +194,7 @@ void moduleToBuffer2(Module m, ref OutBuffer buf, HdrGenState* hgs)
|
|||
}
|
||||
}
|
||||
|
||||
private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void statementToBuffer(Statement s, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
void visitDefaultCase(Statement s)
|
||||
{
|
||||
|
@ -240,7 +263,7 @@ private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
|
|||
auto d = ds.exp.isDeclarationExp().declaration;
|
||||
if (auto v = d.isVarDeclaration())
|
||||
{
|
||||
visitVarDecl(v, anywritten, buf, *hgs);
|
||||
visitVarDecl(v, anywritten, buf, hgs);
|
||||
}
|
||||
else
|
||||
d.dsymbolToBuffer(buf, hgs);
|
||||
|
@ -803,7 +826,7 @@ private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
|
|||
buf.level++;
|
||||
while (t)
|
||||
{
|
||||
buf.writestring(t.toChars());
|
||||
buf.writestring(t.toString());
|
||||
if (t.next &&
|
||||
t.value != TOK.min &&
|
||||
t.value != TOK.comma && t.next.value != TOK.comma &&
|
||||
|
@ -844,9 +867,9 @@ private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
|
|||
visit.VisitStatement(s);
|
||||
}
|
||||
|
||||
private void dsymbolToBuffer(Dsymbol s, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void dsymbolToBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
toCBuffer(s, buf, *hgs);
|
||||
toCBuffer(s, buf, hgs);
|
||||
}
|
||||
|
||||
void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
|
@ -860,13 +883,13 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
buf.writestring(s.kind());
|
||||
buf.writeByte('(');
|
||||
s.exp.expressionToBuffer(buf, &hgs);
|
||||
s.exp.expressionToBuffer(buf, hgs);
|
||||
if (s.msgs)
|
||||
{
|
||||
foreach (m; (*s.msgs)[])
|
||||
{
|
||||
buf.writestring(", ");
|
||||
m.expressionToBuffer(buf, &hgs);
|
||||
m.expressionToBuffer(buf, hgs);
|
||||
}
|
||||
}
|
||||
buf.writestring(");");
|
||||
|
@ -898,13 +921,13 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
void visitEnumMember(EnumMember em)
|
||||
{
|
||||
if (em.type)
|
||||
typeToBuffer(em.type, em.ident, buf, &hgs);
|
||||
typeToBuffer(em.type, em.ident, buf, hgs);
|
||||
else
|
||||
buf.writestring(em.ident.toString());
|
||||
if (em.value)
|
||||
{
|
||||
buf.writestring(" = ");
|
||||
em.value.expressionToBuffer(buf, &hgs);
|
||||
em.value.expressionToBuffer(buf, hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,7 +944,8 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
}
|
||||
foreach (const pid; imp.packages)
|
||||
{
|
||||
buf.printf("%s.", pid.toChars());
|
||||
buf.write(pid.toString());
|
||||
buf.writeByte('.');
|
||||
}
|
||||
buf.writestring(imp.id.toString());
|
||||
if (imp.names.length)
|
||||
|
@ -997,7 +1021,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
void visitDeprecatedDeclaration(DeprecatedDeclaration d)
|
||||
{
|
||||
buf.writestring("deprecated(");
|
||||
d.msg.expressionToBuffer(buf, &hgs);
|
||||
d.msg.expressionToBuffer(buf, hgs);
|
||||
buf.writestring(") ");
|
||||
visitAttribDeclaration(d);
|
||||
}
|
||||
|
@ -1050,7 +1074,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
if (i)
|
||||
buf.writeByte(' ');
|
||||
buf.printf("align (%s)", exp.toChars());
|
||||
buf.writestring("align (");
|
||||
toCBuffer(exp, buf, hgs);
|
||||
buf.writeByte(')');
|
||||
}
|
||||
if (d.decl && d.decl.length < 2)
|
||||
buf.writeByte(' ');
|
||||
|
@ -1085,7 +1111,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (d.args && d.args.length)
|
||||
{
|
||||
buf.writestring(", ");
|
||||
argsToBuffer(d.args, buf, &hgs);
|
||||
argsToBuffer(d.args, buf, hgs);
|
||||
}
|
||||
|
||||
buf.writeByte(')');
|
||||
|
@ -1093,17 +1119,17 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
// https://issues.dlang.org/show_bug.cgi?id=14690
|
||||
// Unconditionally perform a full output dump
|
||||
// for `pragma(inline)` declarations.
|
||||
bool savedFullDump = global.params.dihdr.fullOutput;
|
||||
const saved = hgs.doFuncBodies;
|
||||
if (d.ident == Id.Pinline)
|
||||
global.params.dihdr.fullOutput = true;
|
||||
hgs.doFuncBodies = true;
|
||||
|
||||
visitAttribDeclaration(d);
|
||||
global.params.dihdr.fullOutput = savedFullDump;
|
||||
hgs.doFuncBodies = saved;
|
||||
}
|
||||
|
||||
void visitConditionalDeclaration(ConditionalDeclaration d)
|
||||
{
|
||||
d.condition.conditionToBuffer(buf, &hgs);
|
||||
d.condition.conditionToBuffer(buf, hgs);
|
||||
if (d.decl || d.elsedecl)
|
||||
{
|
||||
buf.writenl();
|
||||
|
@ -1149,12 +1175,12 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (stcToBuffer(buf, p.storageClass))
|
||||
buf.writeByte(' ');
|
||||
if (p.type)
|
||||
typeToBuffer(p.type, p.ident, buf, &hgs);
|
||||
typeToBuffer(p.type, p.ident, buf, hgs);
|
||||
else
|
||||
buf.writestring(p.ident.toString());
|
||||
}
|
||||
buf.writestring("; ");
|
||||
s.aggr.expressionToBuffer(buf, &hgs);
|
||||
s.aggr.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(')');
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1166,13 +1192,13 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writestring(Token.toString(s.op));
|
||||
buf.writestring(" (");
|
||||
if (s.prm.type)
|
||||
typeToBuffer(s.prm.type, s.prm.ident, buf, &hgs);
|
||||
typeToBuffer(s.prm.type, s.prm.ident, buf, hgs);
|
||||
else
|
||||
buf.writestring(s.prm.ident.toString());
|
||||
buf.writestring("; ");
|
||||
s.lwr.expressionToBuffer(buf, &hgs);
|
||||
s.lwr.expressionToBuffer(buf, hgs);
|
||||
buf.writestring(" .. ");
|
||||
s.upr.expressionToBuffer(buf, &hgs);
|
||||
s.upr.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(')');
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1200,7 +1226,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
void visitMixinDeclaration(MixinDeclaration d)
|
||||
{
|
||||
buf.writestring("mixin(");
|
||||
argsToBuffer(d.exps, buf, &hgs, null);
|
||||
argsToBuffer(d.exps, buf, hgs, null);
|
||||
buf.writestring(");");
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1208,7 +1234,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
void visitUserAttributeDeclaration(UserAttributeDeclaration d)
|
||||
{
|
||||
buf.writestring("@(");
|
||||
argsToBuffer(d.atts, buf, &hgs);
|
||||
argsToBuffer(d.atts, buf, hgs);
|
||||
buf.writeByte(')');
|
||||
visitAttribDeclaration(d);
|
||||
}
|
||||
|
@ -1218,7 +1244,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (!constraint)
|
||||
return;
|
||||
buf.writestring(" if (");
|
||||
constraint.expressionToBuffer(buf, &hgs);
|
||||
constraint.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(')');
|
||||
}
|
||||
|
||||
|
@ -1236,7 +1262,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
assert(es.exp && es.exp.op == EXP.assert_);
|
||||
buf.writestring(" (");
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(')');
|
||||
buf.writenl();
|
||||
requireDo = false;
|
||||
|
@ -1244,7 +1270,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
else
|
||||
{
|
||||
buf.writenl();
|
||||
frequire.statementToBuffer(buf, &hgs);
|
||||
frequire.statementToBuffer(buf, hgs);
|
||||
requireDo = true;
|
||||
}
|
||||
}
|
||||
|
@ -1264,7 +1290,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writestring(fensure.id.toString());
|
||||
}
|
||||
buf.writestring("; ");
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(')');
|
||||
buf.writenl();
|
||||
requireDo = false;
|
||||
|
@ -1278,7 +1304,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writeByte(')');
|
||||
}
|
||||
buf.writenl();
|
||||
fensure.ensure.statementToBuffer(buf, &hgs);
|
||||
fensure.ensure.statementToBuffer(buf, hgs);
|
||||
requireDo = true;
|
||||
}
|
||||
}
|
||||
|
@ -1288,7 +1314,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
|
||||
void bodyToBuffer(FuncDeclaration f)
|
||||
{
|
||||
if (!f.fbody || (hgs.hdrgen && global.params.dihdr.fullOutput == false && !hgs.autoMember && !hgs.tpltMember && !hgs.insideFuncBody))
|
||||
if (!f.fbody || (hgs.hdrgen && hgs.doFuncBodies == false && !hgs.autoMember && !hgs.tpltMember && !hgs.insideFuncBody))
|
||||
{
|
||||
if (!f.fbody && (f.fensures || f.frequires))
|
||||
{
|
||||
|
@ -1326,7 +1352,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writeByte('{');
|
||||
buf.writenl();
|
||||
buf.level++;
|
||||
f.fbody.statementToBuffer(buf, &hgs);
|
||||
f.fbody.statementToBuffer(buf, hgs);
|
||||
buf.level--;
|
||||
buf.writeByte('}');
|
||||
buf.writenl();
|
||||
|
@ -1344,7 +1370,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
if (i)
|
||||
buf.writestring(", ");
|
||||
typeToBuffer(b.type, null, buf, &hgs);
|
||||
typeToBuffer(b.type, null, buf, hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1386,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
assert(fd.type);
|
||||
if (stcToBuffer(buf, fd.storage_class))
|
||||
buf.writeByte(' ');
|
||||
functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, &hgs, d);
|
||||
functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, hgs, d);
|
||||
visitTemplateConstraint(d.constraint);
|
||||
hgs.tpltMember++;
|
||||
bodyToBuffer(fd);
|
||||
|
@ -1402,7 +1428,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (stcToBuffer(buf, vd.storage_class))
|
||||
buf.writeByte(' ');
|
||||
if (vd.type)
|
||||
typeToBuffer(vd.type, vd.ident, buf, &hgs);
|
||||
typeToBuffer(vd.type, vd.ident, buf, hgs);
|
||||
else
|
||||
buf.writestring(vd.ident.toString());
|
||||
buf.writeByte('(');
|
||||
|
@ -1413,9 +1439,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writestring(" = ");
|
||||
ExpInitializer ie = vd._init.isExpInitializer();
|
||||
if (ie && (ie.exp.op == EXP.construct || ie.exp.op == EXP.blit))
|
||||
(cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, &hgs);
|
||||
(cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, hgs);
|
||||
else
|
||||
vd._init.initializerToBuffer(buf, &hgs);
|
||||
vd._init.initializerToBuffer(buf, hgs);
|
||||
}
|
||||
buf.writeByte(';');
|
||||
buf.writenl();
|
||||
|
@ -1463,21 +1489,21 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
void visitTemplateInstance(TemplateInstance ti)
|
||||
{
|
||||
buf.writestring(ti.name.toChars());
|
||||
tiargsToBuffer(ti, buf, &hgs);
|
||||
tiargsToBuffer(ti, buf, hgs);
|
||||
|
||||
if (hgs.fullDump)
|
||||
{
|
||||
buf.writenl();
|
||||
dumpTemplateInstance(ti, buf, &hgs);
|
||||
dumpTemplateInstance(ti, buf, hgs);
|
||||
}
|
||||
}
|
||||
|
||||
void visitTemplateMixin(TemplateMixin tm)
|
||||
{
|
||||
buf.writestring("mixin ");
|
||||
typeToBuffer(tm.tqual, null, buf, &hgs);
|
||||
tiargsToBuffer(tm, buf, &hgs);
|
||||
if (tm.ident && memcmp(tm.ident.toChars(), cast(const(char)*)"__mixin", 7) != 0)
|
||||
typeToBuffer(tm.tqual, null, buf, hgs);
|
||||
tiargsToBuffer(tm, buf, hgs);
|
||||
if (tm.ident && memcmp(tm.ident.toString().ptr, cast(const(char)*) "__mixin", 7) != 0)
|
||||
{
|
||||
buf.writeByte(' ');
|
||||
buf.writestring(tm.ident.toString());
|
||||
|
@ -1485,7 +1511,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writeByte(';');
|
||||
buf.writenl();
|
||||
if (hgs.fullDump)
|
||||
dumpTemplateInstance(tm, buf, &hgs);
|
||||
dumpTemplateInstance(tm, buf, hgs);
|
||||
}
|
||||
|
||||
void visitEnumDeclaration(EnumDeclaration d)
|
||||
|
@ -1501,7 +1527,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (d.memtype)
|
||||
{
|
||||
buf.writestring(" : ");
|
||||
typeToBuffer(d.memtype, null, buf, &hgs);
|
||||
typeToBuffer(d.memtype, null, buf, hgs);
|
||||
}
|
||||
if (!d.members)
|
||||
{
|
||||
|
@ -1649,7 +1675,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
if (stcToBuffer(buf, d.storage_class))
|
||||
buf.writeByte(' ');
|
||||
typeToBuffer(d.type, d.ident, buf, &hgs);
|
||||
typeToBuffer(d.type, d.ident, buf, hgs);
|
||||
}
|
||||
else if (d.ident)
|
||||
{
|
||||
|
@ -1658,7 +1684,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
buf.writestring(" = ");
|
||||
if (stcToBuffer(buf, d.storage_class))
|
||||
buf.writeByte(' ');
|
||||
typeToBuffer(d.type, null, buf, &hgs);
|
||||
typeToBuffer(d.type, null, buf, hgs);
|
||||
hgs.declstring = false;
|
||||
}
|
||||
buf.writeByte(';');
|
||||
|
@ -1672,7 +1698,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (d.aliassym)
|
||||
toCBuffer(d.aliassym, buf, hgs);
|
||||
else // d.type
|
||||
typeToBuffer(d.type, null, buf, &hgs);
|
||||
typeToBuffer(d.type, null, buf, hgs);
|
||||
buf.writeByte(';');
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1692,7 +1718,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (stcToBuffer(buf, f.storage_class))
|
||||
buf.writeByte(' ');
|
||||
auto tf = f.type.isTypeFunction();
|
||||
typeToBuffer(tf, f.ident, buf, &hgs);
|
||||
typeToBuffer(tf, f.ident, buf, hgs);
|
||||
|
||||
if (hgs.hdrgen)
|
||||
{
|
||||
|
@ -1706,7 +1732,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
bodyToBuffer(f);
|
||||
hgs.autoMember--;
|
||||
}
|
||||
else if (hgs.tpltMember == 0 && global.params.dihdr.fullOutput == false && !hgs.insideFuncBody)
|
||||
else if (hgs.tpltMember == 0 && hgs.doFuncBodies == false && !hgs.insideFuncBody)
|
||||
{
|
||||
if (!f.fbody)
|
||||
{
|
||||
|
@ -1740,8 +1766,8 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
TypeFunction tf = cast(TypeFunction)f.type;
|
||||
|
||||
if (!f.inferRetType && tf.next)
|
||||
typeToBuffer(tf.next, null, buf, &hgs);
|
||||
parametersToBuffer(tf.parameterList, buf, &hgs);
|
||||
typeToBuffer(tf.next, null, buf, hgs);
|
||||
parametersToBuffer(tf.parameterList, buf, hgs);
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=20074
|
||||
void printAttribute(string str)
|
||||
|
@ -1764,7 +1790,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (rs && rs.exp)
|
||||
{
|
||||
buf.writestring(" => ");
|
||||
rs.exp.expressionToBuffer(buf, &hgs);
|
||||
rs.exp.expressionToBuffer(buf, hgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1833,7 +1859,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
{
|
||||
assert(es.exp && es.exp.op == EXP.assert_);
|
||||
buf.writestring(" (");
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
|
||||
buf.writestring(");");
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1858,9 +1884,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (stcToBuffer(buf, d.storage_class))
|
||||
buf.writeByte(' ');
|
||||
Identifier id = d.isAnonymous() ? null : d.ident;
|
||||
typeToBuffer(d.type, id, buf, &hgs);
|
||||
typeToBuffer(d.type, id, buf, hgs);
|
||||
buf.writestring(" : ");
|
||||
d.width.expressionToBuffer(buf, &hgs);
|
||||
d.width.expressionToBuffer(buf, hgs);
|
||||
buf.writeByte(';');
|
||||
buf.writenl();
|
||||
}
|
||||
|
@ -1874,7 +1900,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
|
||||
void visitModule(Module m)
|
||||
{
|
||||
moduleToBuffer2(m, buf, &hgs);
|
||||
moduleToBuffer2(m, buf, hgs);
|
||||
}
|
||||
|
||||
extern (C++)
|
||||
|
@ -1963,9 +1989,9 @@ private void visitVarDecl(VarDeclaration v, bool anywritten, ref OutBuffer buf,
|
|||
{
|
||||
auto ie = v._init.isExpInitializer();
|
||||
if (ie && (ie.exp.op == EXP.construct || ie.exp.op == EXP.blit))
|
||||
(cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, &hgs);
|
||||
(cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, hgs);
|
||||
else
|
||||
v._init.initializerToBuffer(buf, &hgs);
|
||||
v._init.initializerToBuffer(buf, hgs);
|
||||
}
|
||||
|
||||
const commentIt = hgs.importcHdr && isSpecialCName(v.ident);
|
||||
|
@ -1988,7 +2014,7 @@ private void visitVarDecl(VarDeclaration v, bool anywritten, ref OutBuffer buf,
|
|||
if (stcToBuffer(buf, stc))
|
||||
buf.writeByte(' ');
|
||||
if (v.type)
|
||||
typeToBuffer(v.type, v.ident, buf, &hgs);
|
||||
typeToBuffer(v.type, v.ident, buf, hgs);
|
||||
else if (useTypeof)
|
||||
{
|
||||
buf.writestring("typeof(");
|
||||
|
@ -2033,7 +2059,7 @@ private bool isSpecialCName(Identifier id)
|
|||
/*********************************************
|
||||
* Print expression to buffer.
|
||||
*/
|
||||
private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
void visit(Expression e)
|
||||
{
|
||||
|
@ -2042,7 +2068,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
|
||||
void visitInteger(IntegerExp e)
|
||||
{
|
||||
const dinteger_t v = e.toInteger();
|
||||
const ulong v = e.toInteger();
|
||||
if (e.type)
|
||||
{
|
||||
Type t = e.type;
|
||||
|
@ -2059,7 +2085,8 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
{
|
||||
if ((cast(EnumMember)em).value.toInteger == v)
|
||||
{
|
||||
buf.printf("%s.%s", sym.toChars(), em.ident.toChars());
|
||||
const id = em.ident.toString();
|
||||
buf.printf("%s.%.*s", sym.toChars(), cast(int)id.length, id.ptr);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
@ -2119,15 +2146,13 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
break;
|
||||
case Tpointer:
|
||||
buf.writestring("cast(");
|
||||
buf.writestring(t.toChars());
|
||||
buf.writeByte(')');
|
||||
if (target.ptrsize == 8)
|
||||
goto case Tuns64;
|
||||
else if (target.ptrsize == 4 ||
|
||||
target.ptrsize == 2)
|
||||
goto case Tuns32;
|
||||
else
|
||||
assert(0);
|
||||
|
||||
HdrGenState hgs2; // should re-examine need for new hgs
|
||||
hgs2.fullQual = (t.ty == Tclass && !t.mod);
|
||||
toCBuffer(t, buf, null, hgs2);
|
||||
|
||||
buf.writestring(")cast(size_t)");
|
||||
goto case Tuns64;
|
||||
|
||||
case Tvoid:
|
||||
buf.writestring("cast(void)0");
|
||||
|
@ -2136,11 +2161,8 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
default:
|
||||
/* This can happen if errors, such as
|
||||
* the type is painted on like in fromConstInitializer().
|
||||
* Just ignore
|
||||
*/
|
||||
if (!global.errors)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2286,7 +2308,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
{
|
||||
e.sds.dsymbolToBuffer(buf, hgs);
|
||||
}
|
||||
else if (hgs !is null && hgs.ddoc)
|
||||
else if (hgs.ddoc)
|
||||
{
|
||||
// fixes bug 6491
|
||||
if (auto m = e.sds.isModule())
|
||||
|
@ -2403,7 +2425,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
// which isn't correct as regular D code.
|
||||
buf.writeByte('(');
|
||||
|
||||
visitVarDecl(var, false, buf, *hgs);
|
||||
visitVarDecl(var, false, buf, hgs);
|
||||
|
||||
buf.writeByte(';');
|
||||
buf.writeByte(')');
|
||||
|
@ -2446,7 +2468,10 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
typeToBuffer(e.targ, e.id, buf, hgs);
|
||||
if (e.tok2 != TOK.reserved)
|
||||
{
|
||||
buf.printf(" %s %s", Token.toChars(e.tok), Token.toChars(e.tok2));
|
||||
buf.writeByte(' ');
|
||||
buf.writestring(Token.toString(e.tok));
|
||||
buf.writeByte(' ');
|
||||
buf.writestring(Token.toString(e.tok2));
|
||||
}
|
||||
else if (e.tspec)
|
||||
{
|
||||
|
@ -2459,7 +2484,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
if (e.parameters && e.parameters.length)
|
||||
{
|
||||
buf.writestring(", ");
|
||||
visitTemplateParameters(e.parameters, buf, *hgs);
|
||||
visitTemplateParameters(e.parameters, buf, hgs);
|
||||
}
|
||||
buf.writeByte(')');
|
||||
}
|
||||
|
@ -2472,7 +2497,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
|
|||
|
||||
void visitLoweredAssignExp(LoweredAssignExp e)
|
||||
{
|
||||
if (global.params.vcg_ast)
|
||||
if (hgs.vcg_ast)
|
||||
{
|
||||
expressionToBuffer(e.lowering, buf, hgs);
|
||||
return;
|
||||
|
@ -2937,12 +2962,12 @@ public:
|
|||
if (tp.specType)
|
||||
{
|
||||
buf.writestring(" : ");
|
||||
typeToBuffer(tp.specType, null, *buf, hgs);
|
||||
typeToBuffer(tp.specType, null, *buf, *hgs);
|
||||
}
|
||||
if (tp.defaultType)
|
||||
{
|
||||
buf.writestring(" = ");
|
||||
typeToBuffer(tp.defaultType, null, *buf, hgs);
|
||||
typeToBuffer(tp.defaultType, null, *buf, *hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2956,33 +2981,33 @@ public:
|
|||
{
|
||||
buf.writestring("alias ");
|
||||
if (tp.specType)
|
||||
typeToBuffer(tp.specType, tp.ident, *buf, hgs);
|
||||
typeToBuffer(tp.specType, tp.ident, *buf, *hgs);
|
||||
else
|
||||
buf.writestring(tp.ident.toString());
|
||||
if (tp.specAlias)
|
||||
{
|
||||
buf.writestring(" : ");
|
||||
objectToBuffer(tp.specAlias, *buf, hgs);
|
||||
objectToBuffer(tp.specAlias, *buf, *hgs);
|
||||
}
|
||||
if (tp.defaultAlias)
|
||||
{
|
||||
buf.writestring(" = ");
|
||||
objectToBuffer(tp.defaultAlias, *buf, hgs);
|
||||
objectToBuffer(tp.defaultAlias, *buf, *hgs);
|
||||
}
|
||||
}
|
||||
|
||||
override void visit(TemplateValueParameter tp)
|
||||
{
|
||||
typeToBuffer(tp.valType, tp.ident, *buf, hgs);
|
||||
typeToBuffer(tp.valType, tp.ident, *buf, *hgs);
|
||||
if (tp.specValue)
|
||||
{
|
||||
buf.writestring(" : ");
|
||||
tp.specValue.expressionToBuffer(*buf, hgs);
|
||||
tp.specValue.expressionToBuffer(*buf, *hgs);
|
||||
}
|
||||
if (tp.defaultValue)
|
||||
{
|
||||
buf.writestring(" = ");
|
||||
tp.defaultValue.expressionToBuffer(*buf, hgs);
|
||||
tp.defaultValue.expressionToBuffer(*buf, *hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2993,9 +3018,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
private void conditionToBuffer(Condition c, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void conditionToBuffer(Condition c, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
scope v = new ConditionPrettyPrintVisitor(&buf, hgs);
|
||||
scope v = new ConditionPrettyPrintVisitor(&buf, &hgs);
|
||||
c.accept(v);
|
||||
}
|
||||
|
||||
|
@ -3035,19 +3060,19 @@ public:
|
|||
override void visit(StaticIfCondition c)
|
||||
{
|
||||
buf.writestring("static if (");
|
||||
c.exp.expressionToBuffer(*buf, hgs);
|
||||
c.exp.expressionToBuffer(*buf, *hgs);
|
||||
buf.writeByte(')');
|
||||
}
|
||||
}
|
||||
|
||||
void toCBuffer(const Statement s, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
(cast()s).statementToBuffer(buf, &hgs);
|
||||
(cast()s).statementToBuffer(buf, hgs);
|
||||
}
|
||||
|
||||
void toCBuffer(const Type t, ref OutBuffer buf, const Identifier ident, ref HdrGenState hgs)
|
||||
{
|
||||
typeToBuffer(cast() t, ident, buf, &hgs);
|
||||
typeToBuffer(cast() t, ident, buf, hgs);
|
||||
}
|
||||
|
||||
// used from TemplateInstance::toChars() and TemplateMixin::toChars()
|
||||
|
@ -3057,12 +3082,12 @@ void toCBufferInstance(const TemplateInstance ti, ref OutBuffer buf, bool qualif
|
|||
hgs.fullQual = qualifyTypes;
|
||||
|
||||
buf.writestring(ti.name.toChars());
|
||||
tiargsToBuffer(cast() ti, buf, &hgs);
|
||||
tiargsToBuffer(cast() ti, buf, hgs);
|
||||
}
|
||||
|
||||
void toCBuffer(const Initializer iz, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
initializerToBuffer(cast() iz, buf, &hgs);
|
||||
initializerToBuffer(cast() iz, buf, hgs);
|
||||
}
|
||||
|
||||
bool stcToBuffer(ref OutBuffer buf, StorageClass stc) @safe
|
||||
|
@ -3255,7 +3280,7 @@ extern (D) string visibilityToString(Visibility.Kind kind) nothrow pure @safe
|
|||
}
|
||||
|
||||
// Print the full function signature with correct ident, attributes and template args
|
||||
void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier ident, HdrGenState* hgs, TemplateDeclaration td)
|
||||
void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier ident, ref HdrGenState hgs, TemplateDeclaration td)
|
||||
{
|
||||
//printf("TypeFunction::toCBuffer() this = %p\n", this);
|
||||
visitFuncIdentWithPrefix(tf, ident, td, buf, hgs);
|
||||
|
@ -3265,12 +3290,12 @@ void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier i
|
|||
void functionToBufferWithIdent(TypeFunction tf, ref OutBuffer buf, const(char)* ident, bool isStatic)
|
||||
{
|
||||
HdrGenState hgs;
|
||||
visitFuncIdentWithPostfix(tf, ident.toDString(), buf, &hgs, isStatic);
|
||||
visitFuncIdentWithPostfix(tf, ident.toDString(), buf, hgs, isStatic);
|
||||
}
|
||||
|
||||
void toCBuffer(const Expression e, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
expressionPrettyPrint(cast()e, buf, &hgs);
|
||||
expressionPrettyPrint(cast()e, buf, hgs);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
|
@ -3285,7 +3310,7 @@ void argExpTypesToCBuffer(ref OutBuffer buf, Expressions* arguments)
|
|||
{
|
||||
if (i)
|
||||
buf.writestring(", ");
|
||||
typeToBuffer(arg.type, null, buf, &hgs);
|
||||
typeToBuffer(arg.type, null, buf, hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3298,7 +3323,7 @@ void arrayObjectsToBuffer(ref OutBuffer buf, Objects* objects)
|
|||
{
|
||||
if (i)
|
||||
buf.writestring(", ");
|
||||
objectToBuffer(o, buf, &hgs);
|
||||
objectToBuffer(o, buf, hgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3312,7 +3337,7 @@ extern (C++) const(char)* parametersTypeToChars(ParameterList pl)
|
|||
{
|
||||
OutBuffer buf;
|
||||
HdrGenState hgs;
|
||||
parametersToBuffer(pl, buf, &hgs);
|
||||
parametersToBuffer(pl, buf, hgs);
|
||||
return buf.extractChars();
|
||||
}
|
||||
|
||||
|
@ -3330,7 +3355,7 @@ const(char)* parameterToChars(Parameter parameter, TypeFunction tf, bool fullQua
|
|||
HdrGenState hgs;
|
||||
hgs.fullQual = fullQual;
|
||||
|
||||
parameterToBuffer(parameter, buf, &hgs);
|
||||
parameterToBuffer(parameter, buf, hgs);
|
||||
|
||||
if (tf.parameterList.varargs == VarArg.typesafe && parameter == tf.parameterList[tf.parameterList.parameters.length - 1])
|
||||
{
|
||||
|
@ -3348,7 +3373,7 @@ const(char)* parameterToChars(Parameter parameter, TypeFunction tf, bool fullQua
|
|||
* hgs = context
|
||||
*/
|
||||
|
||||
private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
buf.writeByte('(');
|
||||
foreach (i; 0 .. pl.length)
|
||||
|
@ -3386,7 +3411,7 @@ private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, HdrGenState
|
|||
* buf = buffer to write it to
|
||||
* hgs = context
|
||||
*/
|
||||
private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void parameterToBuffer(Parameter p, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
if (p.userAttribDecl)
|
||||
{
|
||||
|
@ -3409,7 +3434,7 @@ private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
|
|||
if (p.storageClass & STC.in_)
|
||||
{
|
||||
buf.writestring("in ");
|
||||
if (global.params.previewIn && p.storageClass & STC.ref_)
|
||||
if ((p.storageClass & (STC.constscoperef | STC.ref_)) == (STC.constscoperef | STC.ref_))
|
||||
stc &= ~STC.ref_;
|
||||
}
|
||||
else if (p.storageClass & STC.lazy_)
|
||||
|
@ -3424,14 +3449,15 @@ private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
|
|||
STC.return_ | STC.returninferred | STC.scope_ | STC.scopeinferred | STC.out_ | STC.ref_ | STC.returnScope)))
|
||||
buf.writeByte(' ');
|
||||
|
||||
const(char)[] s;
|
||||
if (p.storageClass & STC.alias_)
|
||||
{
|
||||
if (p.ident)
|
||||
buf.writestring(p.ident.toString());
|
||||
}
|
||||
else if (p.type.ty == Tident &&
|
||||
(cast(TypeIdentifier)p.type).ident.toString().length > 3 &&
|
||||
strncmp((cast(TypeIdentifier)p.type).ident.toChars(), "__T", 3) == 0)
|
||||
else if (p.type.isTypeIdentifier() &&
|
||||
(s = p.type.isTypeIdentifier().ident.toString()).length > 3 &&
|
||||
s[0..3] == "__T")
|
||||
{
|
||||
// print parameter name, instead of undetermined type parameter
|
||||
buf.writestring(p.ident.toString());
|
||||
|
@ -3458,7 +3484,7 @@ private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
|
|||
* basis = replace `null`s in argument list with this expression (for sparse array literals)
|
||||
* names = if non-null, use these as the names for the arguments
|
||||
*/
|
||||
private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, HdrGenState* hgs, Expression basis = null, Identifiers* names = null)
|
||||
private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, ref HdrGenState hgs, Expression basis = null, Identifiers* names = null)
|
||||
{
|
||||
if (!expressions || !expressions.length)
|
||||
return;
|
||||
|
@ -3509,35 +3535,32 @@ private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, HdrGenSta
|
|||
}
|
||||
}
|
||||
|
||||
private void sizeToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void sizeToBuffer(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
if (e.type == Type.tsize_t)
|
||||
{
|
||||
Expression ex = (e.op == EXP.cast_ ? (cast(CastExp)e).e1 : e);
|
||||
ex = ex.optimize(WANTvalue);
|
||||
const dinteger_t uval = ex.op == EXP.int64 ? ex.toInteger() : cast(dinteger_t)-1;
|
||||
if (cast(sinteger_t)uval >= 0)
|
||||
const ulong uval = ex.op == EXP.int64 ? ex.toInteger() : cast(ulong)-1;
|
||||
if (cast(long)uval >= 0)
|
||||
{
|
||||
dinteger_t sizemax = void;
|
||||
if (target.ptrsize == 8)
|
||||
sizemax = 0xFFFFFFFFFFFFFFFFUL;
|
||||
else if (target.ptrsize == 4)
|
||||
sizemax = 0xFFFFFFFFU;
|
||||
else if (target.ptrsize == 2)
|
||||
sizemax = 0xFFFFU;
|
||||
else
|
||||
assert(0);
|
||||
if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFUL)
|
||||
if (uval <= 0xFFFFU)
|
||||
{
|
||||
buf.print(uval);
|
||||
return;
|
||||
}
|
||||
if (uval <= 0x7FFF_FFFF_FFFF_FFFFUL)
|
||||
{
|
||||
buf.writestring("cast(size_t)");
|
||||
buf.print(uval);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
expToBuffer(e, PREC.assign, buf, hgs);
|
||||
}
|
||||
|
||||
private void expressionToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void expressionToBuffer(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
expressionPrettyPrint(e, buf, hgs);
|
||||
}
|
||||
|
@ -3546,7 +3569,7 @@ private void expressionToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hg
|
|||
* Write expression out to buf, but wrap it
|
||||
* in ( ) if its precedence is less than pr.
|
||||
*/
|
||||
private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
debug
|
||||
{
|
||||
|
@ -3580,7 +3603,7 @@ private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, HdrGenState*
|
|||
/**************************************************
|
||||
* An entry point to pretty-print type.
|
||||
*/
|
||||
private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, HdrGenState* hgs,
|
||||
private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, ref HdrGenState hgs,
|
||||
ubyte modMask = 0)
|
||||
{
|
||||
if (auto tf = t.isTypeFunction())
|
||||
|
@ -3596,7 +3619,7 @@ private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, Hdr
|
|||
}
|
||||
}
|
||||
|
||||
private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
// Tuples and functions don't use the type constructor syntax
|
||||
if (modMask == t.mod || t.ty == Tfunction || t.ty == Ttuple)
|
||||
|
@ -3632,7 +3655,7 @@ private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, HdrGenState
|
|||
}
|
||||
|
||||
|
||||
private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
buf.writeByte('{');
|
||||
buf.writenl();
|
||||
|
@ -3655,7 +3678,7 @@ private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, HdrGen
|
|||
|
||||
}
|
||||
|
||||
private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
buf.writeByte('!');
|
||||
if (ti.nest)
|
||||
|
@ -3675,7 +3698,9 @@ private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
|
|||
{
|
||||
if (t.equals(Type.tstring) || t.equals(Type.twstring) || t.equals(Type.tdstring) || t.mod == 0 && (t.isTypeBasic() || t.ty == Tident && (cast(TypeIdentifier)t).idents.length == 0))
|
||||
{
|
||||
buf.writestring(t.toChars());
|
||||
HdrGenState hgs2; // re-examine need for new hgs
|
||||
hgs2.fullQual = (t.ty == Tclass && !t.mod);
|
||||
toCBuffer(t, buf, null, hgs2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3683,7 +3708,7 @@ private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
|
|||
{
|
||||
if (e.op == EXP.int64 || e.op == EXP.float64 || e.op == EXP.null_ || e.op == EXP.string_ || e.op == EXP.this_)
|
||||
{
|
||||
buf.writestring(e.toChars());
|
||||
toCBuffer(e, buf, hgs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3704,7 +3729,7 @@ private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
|
|||
* This makes a 'pretty' version of the template arguments.
|
||||
* It's analogous to genIdent() which makes a mangled version.
|
||||
*/
|
||||
private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void objectToBuffer(RootObject oarg, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
//printf("objectToBuffer()\n");
|
||||
/* The logic of this should match what genIdent() does. The _dynamic_cast()
|
||||
|
@ -3725,8 +3750,10 @@ private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs
|
|||
}
|
||||
else if (Dsymbol s = isDsymbol(oarg))
|
||||
{
|
||||
const p = s.ident ? s.ident.toChars() : s.toChars();
|
||||
buf.writestring(p);
|
||||
if (s.ident)
|
||||
buf.writestring(s.ident.toString());
|
||||
else
|
||||
buf.writestring(s.toChars());
|
||||
}
|
||||
else if (auto v = isTuple(oarg))
|
||||
{
|
||||
|
@ -3757,7 +3784,7 @@ private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs
|
|||
}
|
||||
|
||||
|
||||
private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref OutBuffer buf, HdrGenState* hgs, bool isStatic)
|
||||
private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref OutBuffer buf, ref HdrGenState hgs, bool isStatic)
|
||||
{
|
||||
if (t.inuse)
|
||||
{
|
||||
|
@ -3802,7 +3829,7 @@ private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref O
|
|||
}
|
||||
|
||||
private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, TemplateDeclaration td,
|
||||
ref OutBuffer buf, HdrGenState* hgs)
|
||||
ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
if (t.inuse)
|
||||
{
|
||||
|
@ -3858,7 +3885,7 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
{
|
||||
if (i)
|
||||
buf.writestring(", ");
|
||||
toCBuffer(p, buf, *hgs);
|
||||
toCBuffer(p, buf, hgs);
|
||||
}
|
||||
buf.writeByte(')');
|
||||
}
|
||||
|
@ -3871,7 +3898,7 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
}
|
||||
|
||||
|
||||
private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void initializerToBuffer(Initializer inx, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
void visitError(ErrorInitializer iz)
|
||||
{
|
||||
|
@ -3944,7 +3971,7 @@ private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState
|
|||
if (d.exp)
|
||||
{
|
||||
buf.writeByte('[');
|
||||
toCBuffer(d.exp, buf, *hgs);
|
||||
toCBuffer(d.exp, buf, hgs);
|
||||
buf.writeByte(']');
|
||||
}
|
||||
else
|
||||
|
@ -3965,7 +3992,7 @@ private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState
|
|||
}
|
||||
|
||||
|
||||
private void typeToBufferx(Type t, ref OutBuffer buf, HdrGenState* hgs)
|
||||
private void typeToBufferx(Type t, ref OutBuffer buf, ref HdrGenState hgs)
|
||||
{
|
||||
void visitType(Type t)
|
||||
{
|
||||
|
@ -4155,13 +4182,13 @@ private void typeToBufferx(Type t, ref OutBuffer buf, HdrGenState* hgs)
|
|||
buf.writestring("const ");
|
||||
if (hgs.importcHdr && t.id)
|
||||
{
|
||||
buf.writestring(t.id.toChars());
|
||||
buf.writestring(t.id.toString());
|
||||
return;
|
||||
}
|
||||
buf.writestring(Token.toChars(t.tok));
|
||||
buf.writestring(Token.toString(t.tok));
|
||||
buf.writeByte(' ');
|
||||
if (t.id)
|
||||
buf.writestring(t.id.toChars());
|
||||
buf.writestring(t.id.toString());
|
||||
if (t.tok == TOK.enum_ && t.base && t.base.ty != TY.Tint32)
|
||||
{
|
||||
buf.writestring(" : ");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Dave Fladebo
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
class Module;
|
||||
|
||||
void genhdrfile(Module *m, OutBuffer &buf);
|
||||
void genhdrfile(Module *m, bool doFuncBodies, OutBuffer &buf);
|
||||
void genCppHdrFiles(Modules &ms);
|
||||
void moduleToBuffer(OutBuffer& buf, Module *m);
|
||||
void moduleToBuffer(OutBuffer& buf, bool vcg_ast, Module *m);
|
||||
const char *parametersTypeToChars(ParameterList pl);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/iasm.html, Inline Assembler)
|
||||
*
|
||||
* Copyright (C) 2018-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 2018-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/iasm.d, _iasm.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Inline assembler for the GCC D compiler.
|
||||
*
|
||||
* Copyright (C) 2018-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 2018-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: Iain Buclaw
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/iasmgcc.d, _iasmgcc.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Contains the `Id` struct with a list of predefined symbols the compiler knows about.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/id.d, _id.d)
|
||||
|
@ -521,6 +521,7 @@ immutable Msgtable[] msgtable =
|
|||
{ "udaSelector", "selector" },
|
||||
{ "udaOptional", "optional"},
|
||||
{ "udaMustUse", "mustuse" },
|
||||
{ "udaStandalone", "standalone" },
|
||||
|
||||
// C names, for undefined identifier error messages
|
||||
{ "NULL" },
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 2017-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 2017-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Defines an identifier, which is the name of a `Dsymbol`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/identifier.d, _identifier.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Specification: $(LINK2 https://dlang.org/spec/type.html#integer-promotions, Integer Promotions),
|
||||
* $(LINK2 https://dlang.org/spec/type.html#usual-arithmetic-conversions, Usual Arithmetic Conversions).
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/impcnvtab.d, _impcnvtab.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* For example, prompt to `import std.stdio` when using `writeln`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/imphint.d, _imphint.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: C11
|
||||
*
|
||||
* Copyright: Copyright (C) 2021-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 2021-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/importc.d, _importc.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Defines initializers of variables, e.g. the array literal in `int[3] x = [0, 1, 2]`.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/init.d, _init.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Semantic analysis of initializers.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/initsem.d, _initsem.d)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* The AST is traversed, and every function call is considered for inlining using `inlinecost.d`.
|
||||
* The function call is then inlined if this cost is below a threshold.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/inline.d, _inline.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Implement $(LINK2 https://digitalmars.com/articles/b62.html, Value Range Propagation).
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/intrange.d, _intrange.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Code for generating .json descriptions of the module when passing the `-X` flag to dmd.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/json.d, _json.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* The serialization is a string which contains the type of the parameters and the string
|
||||
* represantation of the lambda expression.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/lamdbacomp.d, _lambdacomp.d)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/lex.html, Lexical)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/lexer.d, _lexer.d)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Encapsulates file/line/column locations.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/location.d, _location.d)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Defines a D type.
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mtype.d, _mtype.d)
|
||||
|
@ -525,13 +525,7 @@ extern (C++) abstract class Type : ASTNode
|
|||
*/
|
||||
final override const(char)* toChars() const
|
||||
{
|
||||
OutBuffer buf;
|
||||
buf.reserve(16);
|
||||
HdrGenState hgs;
|
||||
hgs.fullQual = (ty == Tclass && !mod);
|
||||
|
||||
toCBuffer(this, buf, null, hgs);
|
||||
return buf.extractChars();
|
||||
return dmd.hdrgen.toChars(this);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
|
@ -4141,7 +4135,7 @@ extern (C++) final class TypeFunction : TypeNext
|
|||
auto stc = p.storageClass;
|
||||
|
||||
// When the preview switch is enable, `in` parameters are `scope`
|
||||
if (stc & STC.in_ && global.params.previewIn)
|
||||
if (stc & STC.constscoperef)
|
||||
return stc | STC.scope_;
|
||||
|
||||
if (stc & (STC.scope_ | STC.return_ | STC.lazy_) || purity == PURE.impure)
|
||||
|
@ -6433,28 +6427,22 @@ extern (C++) final class Parameter : ASTNode
|
|||
* Params:
|
||||
* returnByRef = true if the function returns by ref
|
||||
* p = Parameter to compare with
|
||||
* previewIn = Whether `-preview=in` is being used, and thus if
|
||||
* `in` means `scope [ref]`.
|
||||
*
|
||||
* Returns:
|
||||
* true = `this` can be used in place of `p`
|
||||
* false = nope
|
||||
*/
|
||||
bool isCovariant(bool returnByRef, const Parameter p, bool previewIn = global.params.previewIn)
|
||||
bool isCovariant(bool returnByRef, const Parameter p)
|
||||
const pure nothrow @nogc @safe
|
||||
{
|
||||
ulong thisSTC = this.storageClass;
|
||||
ulong otherSTC = p.storageClass;
|
||||
|
||||
if (previewIn)
|
||||
{
|
||||
if (thisSTC & STC.in_)
|
||||
thisSTC |= STC.scope_;
|
||||
if (otherSTC & STC.in_)
|
||||
otherSTC |= STC.scope_;
|
||||
}
|
||||
if (thisSTC & STC.constscoperef)
|
||||
thisSTC |= STC.scope_;
|
||||
if (otherSTC & STC.constscoperef)
|
||||
otherSTC |= STC.scope_;
|
||||
|
||||
const mask = STC.ref_ | STC.out_ | STC.lazy_ | (previewIn ? STC.in_ : 0);
|
||||
const mask = STC.ref_ | STC.out_ | STC.lazy_ | (((thisSTC | otherSTC) & STC.constscoperef) ? STC.in_ : 0);
|
||||
if ((thisSTC & mask) != (otherSTC & mask))
|
||||
return false;
|
||||
return isCovariantScope(returnByRef, thisSTC, otherSTC);
|
||||
|
@ -6739,7 +6727,7 @@ enum ScopeRef
|
|||
* Returns:
|
||||
* corresponding string
|
||||
*/
|
||||
const(char)* toChars(ScopeRef sr) pure nothrow @nogc @safe
|
||||
const(char)* ScopeRefToChars(ScopeRef sr) pure nothrow @nogc @safe
|
||||
{
|
||||
with (ScopeRef)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* Compiler implementation of the D programming language
|
||||
* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* written by Walter Bright
|
||||
* https://www.digitalmars.com
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
|
@ -39,6 +39,7 @@ typedef union tree_node type;
|
|||
typedef struct TYPE type;
|
||||
#endif
|
||||
|
||||
extern const char* toChars(const Type* const t);
|
||||
Type *typeSemantic(Type *t, const Loc &loc, Scope *sc);
|
||||
Type *merge(Type *type);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Compile-time checks associated with the @mustuse attribute.
|
||||
*
|
||||
* Copyright: Copyright (C) 2022-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 2022-2024 by The D Language Foundation, All Rights Reserved
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mustuse.d, _mustuse.d)
|
||||
* Documentation: https://dlang.org/phobos/dmd_mustuse.html
|
||||
|
@ -222,20 +222,7 @@ private bool hasMustUseAttribute(Dsymbol sym, Scope* sc)
|
|||
*/
|
||||
private bool isMustUseAttribute(Expression e)
|
||||
{
|
||||
import dmd.attrib : isCoreUda;
|
||||
import dmd.attrib : isEnumAttribute;
|
||||
import dmd.id : Id;
|
||||
|
||||
// Logic based on dmd.objc.Supported.declaredAsOptionalCount
|
||||
auto typeExp = e.isTypeExp;
|
||||
if (!typeExp)
|
||||
return false;
|
||||
|
||||
auto typeEnum = typeExp.type.isTypeEnum();
|
||||
if (!typeEnum)
|
||||
return false;
|
||||
|
||||
if (isCoreUda(typeEnum.sym, Id.udaMustUse))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return isEnumAttribute(e, Id.udaMustUse);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Specification: $(LINK2 https://dlang.org/spec/function.html#nogc-functions, No-GC Functions)
|
||||
*
|
||||
* Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
|
||||
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
|
||||
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
|
||||
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/nogc.d, _nogc.d)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue