aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-03-13 23:58:49 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2025-03-16 13:04:34 +0100
commit348d41e1d105bef6eeb423e915ab8508988149c1 (patch)
treea8564c95b993c43ee41c78a6982c51d79c0991ee /gcc
parent53fc26e54fadb51c3f655286d4475625b82a12b1 (diff)
downloadgcc-348d41e1d105bef6eeb423e915ab8508988149c1.zip
gcc-348d41e1d105bef6eeb423e915ab8508988149c1.tar.gz
gcc-348d41e1d105bef6eeb423e915ab8508988149c1.tar.bz2
d: Merge upstream dmd, druntime ffbad272b6
D front-end changes: - Import latest fixes from dmd. D runtime changes: - Import latest fixes from druntime. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ffbad272b6. * d-tree.h (make_location_t): Add overload taking a const SourceLoc &. * d-codegen.cc (make_location_t): Likewise. * d-diagnostic.cc (d_diagnostic_report_diagnostic): Change first parameter type to const SourceLoc &. (verrorReport): Update for new front-end interface. (verrorReportSupplemental): Likewise. * d-frontend.cc (eval_builtin): Likewise. (getTypeInfoType): Likewise. * d-lang.cc (d_parse_file): Likewise. * d-target.cc (Target::va_listType): Likewise. (Target::getTargetInfo): Likewise. * decl.cc (build_decl_tree): Likewise. * imports.cc (ImportVisitor::visit (Module *)): Likewise. * modules.cc (get_internal_fn): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime ffbad272b6.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/d/d-codegen.cc21
-rw-r--r--gcc/d/d-diagnostic.cc13
-rw-r--r--gcc/d/d-frontend.cc4
-rw-r--r--gcc/d/d-lang.cc2
-rw-r--r--gcc/d/d-target.cc4
-rw-r--r--gcc/d/d-tree.h3
-rw-r--r--gcc/d/decl.cc2
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/aggregate.d4
-rw-r--r--gcc/d/dmd/aggregate.h8
-rw-r--r--gcc/d/dmd/aliasthis.d2
-rw-r--r--gcc/d/dmd/attrib.d38
-rw-r--r--gcc/d/dmd/attrib.h2
-rw-r--r--gcc/d/dmd/blockexit.d2
-rw-r--r--gcc/d/dmd/builtin.d2
-rw-r--r--gcc/d/dmd/chkformat.d4
-rw-r--r--gcc/d/dmd/cond.d22
-rw-r--r--gcc/d/dmd/constfold.d34
-rw-r--r--gcc/d/dmd/cparse.d9
-rw-r--r--gcc/d/dmd/ctfeexpr.d30
-rw-r--r--gcc/d/dmd/cxxfrontend.d18
-rw-r--r--gcc/d/dmd/dcast.d5
-rw-r--r--gcc/d/dmd/dclass.d6
-rw-r--r--gcc/d/dmd/declaration.d22
-rw-r--r--gcc/d/dmd/declaration.h12
-rw-r--r--gcc/d/dmd/denum.d4
-rw-r--r--gcc/d/dmd/dimport.d2
-rw-r--r--gcc/d/dmd/dinterpret.d20
-rw-r--r--gcc/d/dmd/dmodule.d20
-rw-r--r--gcc/d/dmd/dscope.d10
-rw-r--r--gcc/d/dmd/dstruct.d6
-rw-r--r--gcc/d/dmd/dsymbol.d10
-rw-r--r--gcc/d/dmd/dsymbol.h6
-rw-r--r--gcc/d/dmd/dsymbolsem.d57
-rw-r--r--gcc/d/dmd/dtemplate.d32
-rw-r--r--gcc/d/dmd/dversion.d8
-rw-r--r--gcc/d/dmd/enum.h2
-rw-r--r--gcc/d/dmd/enumsem.d4
-rw-r--r--gcc/d/dmd/errors.d63
-rw-r--r--gcc/d/dmd/errors.h14
-rw-r--r--gcc/d/dmd/errorsink.d60
-rw-r--r--gcc/d/dmd/expression.d308
-rw-r--r--gcc/d/dmd/expression.h36
-rw-r--r--gcc/d/dmd/expressionsem.d35
-rw-r--r--gcc/d/dmd/func.d38
-rw-r--r--gcc/d/dmd/funcsem.d12
-rw-r--r--gcc/d/dmd/globals.d2
-rw-r--r--gcc/d/dmd/globals.h38
-rw-r--r--gcc/d/dmd/iasmgcc.d3
-rw-r--r--gcc/d/dmd/identifier.d13
-rw-r--r--gcc/d/dmd/init.d14
-rw-r--r--gcc/d/dmd/json.d2
-rw-r--r--gcc/d/dmd/lexer.d50
-rw-r--r--gcc/d/dmd/location.d315
-rw-r--r--gcc/d/dmd/module.h4
-rw-r--r--gcc/d/dmd/mtype.d30
-rw-r--r--gcc/d/dmd/mtype.h24
-rw-r--r--gcc/d/dmd/nogc.d2
-rw-r--r--gcc/d/dmd/nspace.d2
-rw-r--r--gcc/d/dmd/ob.d12
-rw-r--r--gcc/d/dmd/opover.d2
-rw-r--r--gcc/d/dmd/optimize.d2
-rw-r--r--gcc/d/dmd/parse.d4
-rw-r--r--gcc/d/dmd/root/longdouble.d2
-rw-r--r--gcc/d/dmd/scope.h8
-rw-r--r--gcc/d/dmd/semantic3.d6
-rw-r--r--gcc/d/dmd/statement.d112
-rw-r--r--gcc/d/dmd/statement.h6
-rw-r--r--gcc/d/dmd/statementsem.d101
-rw-r--r--gcc/d/dmd/staticassert.d4
-rw-r--r--gcc/d/dmd/target.d4
-rw-r--r--gcc/d/dmd/target.h4
-rw-r--r--gcc/d/dmd/template.h10
-rw-r--r--gcc/d/dmd/typesem.d39
-rw-r--r--gcc/d/dmd/typinf.d4
-rw-r--r--gcc/d/dmd/typinf.h4
-rw-r--r--gcc/d/imports.cc2
-rw-r--r--gcc/d/modules.cc2
78 files changed, 1018 insertions, 827 deletions
diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc
index 4d8ed65..ad71486 100644
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -43,24 +43,33 @@ along with GCC; see the file COPYING3. If not see
#include "d-tree.h"
-/* Return the GCC location for the D frontend location LOC. */
+/* Return the GCC location for the D frontend source location LOC. */
location_t
-make_location_t (const Loc &loc)
+make_location_t (const SourceLoc &loc)
{
location_t gcc_location = input_location;
- if (const char *filename = loc.filename ())
+ if (loc.filename.length != 0)
{
- linemap_add (line_table, LC_ENTER, 0, filename, loc.linnum ());
- linemap_line_start (line_table, loc.linnum (), 0);
- gcc_location = linemap_position_for_column (line_table, loc.charnum ());
+ linemap_add (line_table, LC_ENTER, 0, loc.filename.ptr, loc.line);
+ linemap_line_start (line_table, loc.line, 0);
+ gcc_location = linemap_position_for_column (line_table, loc.column);
linemap_add (line_table, LC_LEAVE, 0, NULL, 0);
}
return gcc_location;
}
+/* Likewise, but converts LOC from a compact opaque location. */
+
+location_t
+make_location_t (const Loc loc)
+{
+ const SourceLoc sloc = loc.toSourceLoc ();
+ return make_location_t (sloc);
+}
+
/* Return the DECL_CONTEXT for symbol DSYM. */
tree
diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc
index 4749585..55cb42e 100644
--- a/gcc/d/d-diagnostic.cc
+++ b/gcc/d/d-diagnostic.cc
@@ -183,13 +183,14 @@ escape_d_format (const char *format)
front-end, which does not get translated by the gcc diagnostic routines. */
static void ATTRIBUTE_GCC_DIAG(3,0)
-d_diagnostic_report_diagnostic (const Loc &loc, int opt, const char *format,
- va_list ap, diagnostic_t kind, bool verbatim)
+d_diagnostic_report_diagnostic (const SourceLoc &loc, int opt,
+ const char *format, va_list ap,
+ diagnostic_t kind, bool verbatim)
{
va_list argp;
va_copy (argp, ap);
- if (loc.filename () || !verbatim)
+ if (loc.filename.length != 0 || !verbatim)
{
rich_location rich_loc (line_table, make_location_t (loc));
diagnostic_info diagnostic;
@@ -220,8 +221,8 @@ d_diagnostic_report_diagnostic (const Loc &loc, int opt, const char *format,
error count depending on how KIND is treated. */
void D_ATTRIBUTE_FORMAT(2,0) ATTRIBUTE_GCC_DIAG(2,0)
-verrorReport (const Loc& loc, const char *format, va_list ap, ErrorKind kind,
- const char *prefix1, const char *prefix2)
+verrorReport (const SourceLoc loc, const char *format, va_list ap,
+ ErrorKind kind, const char *prefix1, const char *prefix2)
{
diagnostic_t diag_kind = DK_UNSPECIFIED;
int opt = 0;
@@ -304,7 +305,7 @@ verrorReport (const Loc& loc, const char *format, va_list ap, ErrorKind kind,
explicit location LOC. This doesn't increase the global error count. */
void D_ATTRIBUTE_FORMAT(2,0) ATTRIBUTE_GCC_DIAG(2,0)
-verrorReportSupplemental (const Loc& loc, const char* format, va_list ap,
+verrorReportSupplemental (const SourceLoc loc, const char* format, va_list ap,
ErrorKind kind)
{
if (kind == ErrorKind::error)
diff --git a/gcc/d/d-frontend.cc b/gcc/d/d-frontend.cc
index 587579d..0927a3d 100644
--- a/gcc/d/d-frontend.cc
+++ b/gcc/d/d-frontend.cc
@@ -52,7 +52,7 @@ isBuiltin (FuncDeclaration *fd)
Return result; NULL if cannot evaluate it. */
Expression *
-eval_builtin (const Loc &loc, FuncDeclaration *fd, Expressions *arguments)
+eval_builtin (Loc loc, FuncDeclaration *fd, Expressions *arguments)
{
if (fd->builtin == BUILTIN::unimp)
return NULL;
@@ -79,7 +79,7 @@ eval_builtin (const Loc &loc, FuncDeclaration *fd, Expressions *arguments)
/* Build and return typeinfo type for TYPE. */
Type *
-getTypeInfoType (const Loc &loc, Type *type, Scope *sc)
+getTypeInfoType (Loc loc, Type *type, Scope *sc)
{
gcc_assert (type->ty != TY::Terror);
check_typeinfo_type (loc, sc);
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index 585737b..8e37fed 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -1113,7 +1113,7 @@ d_parse_file (void)
if (count < 0)
{
- error (Loc ("stdin", 0, 0), "%s", xstrerror (errno));
+ error (Loc::singleFilename ("stdin"), "%s", xstrerror (errno));
free (buffer);
continue;
}
diff --git a/gcc/d/d-target.cc b/gcc/d/d-target.cc
index e5d7e2b..ce25bf8 100644
--- a/gcc/d/d-target.cc
+++ b/gcc/d/d-target.cc
@@ -241,7 +241,7 @@ Target::fieldalign (Type *type)
/* Returns a Type for the va_list type of the target. */
Type *
-Target::va_listType (const Loc &, Scope *)
+Target::va_listType (Loc, Scope *)
{
if (this->tvalist)
return this->tvalist;
@@ -517,7 +517,7 @@ d_handle_target_object_format (void)
LOC is the location to use for the returned expression. */
Expression *
-Target::getTargetInfo (const char *key, const Loc &loc)
+Target::getTargetInfo (const char *key, Loc loc)
{
unsigned ix;
d_target_info_spec *spec;
diff --git a/gcc/d/d-tree.h b/gcc/d/d-tree.h
index eeecef3..b3e84d1 100644
--- a/gcc/d/d-tree.h
+++ b/gcc/d/d-tree.h
@@ -534,7 +534,8 @@ extern Expression *d_eval_constant_expression (const Loc &, tree);
extern void d_init_versions (void);
/* In d-codegen.cc. */
-extern location_t make_location_t (const Loc &);
+extern location_t make_location_t (const SourceLoc &);
+extern location_t make_location_t (const Loc);
extern tree d_decl_context (Dsymbol *);
extern tree copy_aggregate_type (tree);
extern bool declaration_reference_p (Declaration *);
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 1bad186..913a9b3 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1114,7 +1114,7 @@ build_decl_tree (Dsymbol *d)
if (d->loc.filename ())
input_location = make_location_t (d->loc);
else
- input_location = make_location_t (Loc ("<no_file>", 1, 0));
+ input_location = make_location_t (Loc::singleFilename ("<no_file>"));
DeclVisitor v = DeclVisitor ();
v.build_dsymbol (d);
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index c81fccb..59d5a18 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-d29e3eca45edaeef63b31f78c9846fc6e2870c49
+ffbad272b649b7ae3e88cfdc85688bfef3168994
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/aggregate.d b/gcc/d/dmd/aggregate.d
index 20bcafe..a193876 100644
--- a/gcc/d/dmd/aggregate.d
+++ b/gcc/d/dmd/aggregate.d
@@ -154,7 +154,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
bool disableNew; /// disallow allocations using `new`
Sizeok sizeok = Sizeok.none; /// set when structsize contains valid data
- final extern (D) this(const ref Loc loc, Identifier id)
+ final extern (D) this(Loc loc, Identifier id)
{
super(loc, id);
visibility = Visibility(Visibility.Kind.public_);
@@ -189,7 +189,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
abstract void finalizeSize();
- override final uinteger_t size(const ref Loc loc)
+ override final uinteger_t size(Loc loc)
{
//printf("+AggregateDeclaration::size() %s, scope = %p, sizeok = %d\n", toChars(), _scope, sizeok);
bool ok = determineSize(this, loc);
diff --git a/gcc/d/dmd/aggregate.h b/gcc/d/dmd/aggregate.h
index 8fd12e1..56f597b 100644
--- a/gcc/d/dmd/aggregate.h
+++ b/gcc/d/dmd/aggregate.h
@@ -45,7 +45,7 @@ namespace dmd
{
FuncDeclaration *search_toString(StructDeclaration *sd);
void semanticTypeInfoMembers(StructDeclaration *sd);
- bool fill(StructDeclaration* sd, const Loc &loc, Expressions &elements, bool ctorinit);
+ bool fill(StructDeclaration* sd, Loc loc, Expressions &elements, bool ctorinit);
}
enum class ClassKind : uint8_t
@@ -119,7 +119,7 @@ public:
virtual Scope *newScope(Scope *sc);
virtual void finalizeSize() = 0;
- uinteger_t size(const Loc &loc) override final;
+ uinteger_t size(Loc loc) override final;
Type *getType() override final;
bool isDeprecated() const override final; // is aggregate deprecated?
bool isNested() const;
@@ -168,7 +168,7 @@ public:
private:
uint16_t bitFields;
public:
- static StructDeclaration *create(const Loc &loc, Identifier *id, bool inObject);
+ static StructDeclaration *create(Loc loc, Identifier *id, bool inObject);
StructDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void finalizeSize() override final;
@@ -278,7 +278,7 @@ public:
ObjcClassDeclaration objc; // Data for a class declaration that is needed for the Objective-C integration
Symbol *cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr
- static ClassDeclaration *create(const Loc &loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
+ static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
const char *toPrettyChars(bool QualifyTypes = false) override;
ClassDeclaration *syntaxCopy(Dsymbol *s) override;
Scope *newScope(Scope *sc) override;
diff --git a/gcc/d/dmd/aliasthis.d b/gcc/d/dmd/aliasthis.d
index 0e063ca..620b016 100644
--- a/gcc/d/dmd/aliasthis.d
+++ b/gcc/d/dmd/aliasthis.d
@@ -31,7 +31,7 @@ extern (C++) final class AliasThis : Dsymbol
/// Whether this `alias this` is deprecated or not
bool isDeprecated_;
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, null); // it's anonymous (no identifier)
this.ident = ident;
diff --git a/gcc/d/dmd/attrib.d b/gcc/d/dmd/attrib.d
index 7a60ecb..f5618f1 100644
--- a/gcc/d/dmd/attrib.d
+++ b/gcc/d/dmd/attrib.d
@@ -60,13 +60,13 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
this.decl = decl;
}
- extern (D) this(const ref Loc loc, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Dsymbols* decl) @safe
{
super(loc, null);
this.decl = decl;
}
- extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Identifier ident, Dsymbols* decl) @safe
{
super(loc, ident);
this.decl = decl;
@@ -163,7 +163,7 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
this.stc = stc;
}
- extern (D) this(const ref Loc loc, StorageClass stc, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, StorageClass stc, Dsymbols* decl) @safe
{
super(loc, decl);
this.stc = stc;
@@ -253,14 +253,14 @@ extern (C++) final class LinkDeclaration : AttribDeclaration
{
LINK linkage; /// either explicitly set or `default_`
- extern (D) this(const ref Loc loc, LINK linkage, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, LINK linkage, Dsymbols* decl) @safe
{
super(loc, null, decl);
//printf("LinkDeclaration(linkage = %d, decl = %p)\n", linkage, decl);
this.linkage = linkage;
}
- static LinkDeclaration create(const ref Loc loc, LINK p, Dsymbols* decl) @safe
+ static LinkDeclaration create(Loc loc, LINK p, Dsymbols* decl) @safe
{
return new LinkDeclaration(loc, p, decl);
}
@@ -289,7 +289,7 @@ extern (C++) final class CPPMangleDeclaration : AttribDeclaration
{
CPPMANGLE cppmangle;
- extern (D) this(const ref Loc loc, CPPMANGLE cppmangle, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, CPPMANGLE cppmangle, Dsymbols* decl) @safe
{
super(loc, null, decl);
//printf("CPPMangleDeclaration(cppmangle = %d, decl = %p)\n", cppmangle, decl);
@@ -336,18 +336,18 @@ extern (C++) final class CPPNamespaceDeclaration : AttribDeclaration
/// CTFE-able expression, resolving to `TupleExp` or `StringExp`
Expression exp;
- extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Identifier ident, Dsymbols* decl) @safe
{
super(loc, ident, decl);
}
- extern (D) this(const ref Loc loc, Expression exp, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Expression exp, Dsymbols* decl) @safe
{
super(loc, null, decl);
this.exp = exp;
}
- extern (D) this(const ref Loc loc, Identifier ident, Expression exp, Dsymbols* decl,
+ extern (D) this(Loc loc, Identifier ident, Expression exp, Dsymbols* decl,
CPPNamespaceDeclaration parent) @safe
{
super(loc, ident, decl);
@@ -387,7 +387,7 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration
* visibility = visibility attribute data
* decl = declarations which are affected by this visibility attribute
*/
- extern (D) this(const ref Loc loc, Visibility visibility, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Visibility visibility, Dsymbols* decl) @safe
{
super(loc, null, decl);
this.visibility = visibility;
@@ -400,7 +400,7 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration
* pkg_identifiers = list of identifiers for a qualified package name
* decl = declarations which are affected by this visibility attribute
*/
- extern (D) this(const ref Loc loc, Identifier[] pkg_identifiers, Dsymbols* decl)
+ extern (D) this(Loc loc, Identifier[] pkg_identifiers, Dsymbols* decl)
{
super(loc, null, decl);
this.visibility.kind = Visibility.Kind.package_;
@@ -462,7 +462,7 @@ extern (C++) final class AlignDeclaration : AttribDeclaration
structalign_t salign;
- extern (D) this(const ref Loc loc, Expression exp, Dsymbols* decl)
+ extern (D) this(Loc loc, Expression exp, Dsymbols* decl)
{
super(loc, null, decl);
if (exp)
@@ -472,13 +472,13 @@ extern (C++) final class AlignDeclaration : AttribDeclaration
}
}
- extern (D) this(const ref Loc loc, Expressions* exps, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Expressions* exps, Dsymbols* decl) @safe
{
super(loc, null, decl);
this.exps = exps;
}
- extern (D) this(const ref Loc loc, structalign_t salign, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, structalign_t salign, Dsymbols* decl) @safe
{
super(loc, null, decl);
this.salign = salign;
@@ -509,7 +509,7 @@ extern (C++) final class AnonDeclaration : AttribDeclaration
uint anonstructsize; /// size of anonymous struct
uint anonalignsize; /// size of anonymous struct for alignment purposes
- extern (D) this(const ref Loc loc, bool isunion, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, bool isunion, Dsymbols* decl) @safe
{
super(loc, null, decl);
this.isunion = isunion;
@@ -547,7 +547,7 @@ extern (C++) final class PragmaDeclaration : AttribDeclaration
{
Expressions* args; /// parameters of this pragma
- extern (D) this(const ref Loc loc, Identifier ident, Expressions* args, Dsymbols* decl) @safe
+ extern (D) this(Loc loc, Identifier ident, Expressions* args, Dsymbols* decl) @safe
{
super(loc, ident, decl);
this.args = args;
@@ -582,7 +582,7 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
Condition condition; /// condition deciding whether decl or elsedecl applies
Dsymbols* elsedecl; /// array of Dsymbol's for else block
- extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe
+ extern (D) this(Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe
{
super(loc, null, decl);
//printf("ConditionalDeclaration::ConditionalDeclaration()\n");
@@ -629,7 +629,7 @@ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration
bool addisdone = false; /// true if members have been added to scope
bool onStack = false; /// true if a call to `include` is currently active
- extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe
+ extern (D) this(Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl) @safe
{
super(loc, condition, decl, elsedecl);
//printf("StaticIfDeclaration::StaticIfDeclaration()\n");
@@ -779,7 +779,7 @@ extern (C++) final class MixinDeclaration : AttribDeclaration
ScopeDsymbol scopesym;
bool compiled;
- extern (D) this(const ref Loc loc, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expressions* exps) @safe
{
super(loc, null, null);
//printf("MixinDeclaration(loc = %d)\n", loc.linnum);
diff --git a/gcc/d/dmd/attrib.h b/gcc/d/dmd/attrib.h
index 1c9bd96..79b0cb0 100644
--- a/gcc/d/dmd/attrib.h
+++ b/gcc/d/dmd/attrib.h
@@ -65,7 +65,7 @@ class LinkDeclaration final : public AttribDeclaration
public:
LINK linkage;
- static LinkDeclaration *create(const Loc &loc, LINK p, Dsymbols *decl);
+ static LinkDeclaration *create(Loc loc, LINK p, Dsymbols *decl);
LinkDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
diff --git a/gcc/d/dmd/blockexit.d b/gcc/d/dmd/blockexit.d
index 2125fb9..a63130a 100644
--- a/gcc/d/dmd/blockexit.d
+++ b/gcc/d/dmd/blockexit.d
@@ -510,7 +510,7 @@ int blockExit(Statement s, FuncDeclaration func, ErrorSink eSink)
+
+ Returns: `BE.[err]throw` depending on the type of `exp`
+/
-BE checkThrow(ref const Loc loc, Expression exp, FuncDeclaration func, ErrorSink eSink)
+BE checkThrow(Loc loc, Expression exp, FuncDeclaration func, ErrorSink eSink)
{
Type t = exp.type.toBasetype();
ClassDeclaration cd = t.isClassHandle();
diff --git a/gcc/d/dmd/builtin.d b/gcc/d/dmd/builtin.d
index d29092b..80cf92f 100644
--- a/gcc/d/dmd/builtin.d
+++ b/gcc/d/dmd/builtin.d
@@ -28,4 +28,4 @@ public extern (C++) BUILTIN isBuiltin(FuncDeclaration fd);
* Evaluate builtin function.
* Return result; NULL if cannot evaluate it.
*/
-public extern (C++) Expression eval_builtin(const ref Loc loc, FuncDeclaration fd, Expressions* arguments);
+public extern (C++) Expression eval_builtin(Loc loc, FuncDeclaration fd, Expressions* arguments);
diff --git a/gcc/d/dmd/chkformat.d b/gcc/d/dmd/chkformat.d
index 6cbc45b..e879900 100644
--- a/gcc/d/dmd/chkformat.d
+++ b/gcc/d/dmd/chkformat.d
@@ -63,7 +63,7 @@ import dmd.target;
* https://www.cplusplus.com/reference/cstdio/printf/
*/
public
-bool checkPrintfFormat(ref const Loc loc, scope const char[] format, scope Expression[] args, bool isVa_list, ErrorSink eSink)
+bool checkPrintfFormat(Loc loc, scope const char[] format, scope Expression[] args, bool isVa_list, ErrorSink eSink)
{
//printf("checkPrintFormat('%.*s')\n", cast(int)format.length, format.ptr);
size_t n; // index in args
@@ -339,7 +339,7 @@ bool checkPrintfFormat(ref const Loc loc, scope const char[] format, scope Expre
* https://www.cplusplus.com/reference/cstdio/scanf/
*/
public
-bool checkScanfFormat(ref const Loc loc, scope const char[] format, scope Expression[] args, bool isVa_list, ErrorSink eSink)
+bool checkScanfFormat(Loc loc, scope const char[] format, scope Expression[] args, bool isVa_list, ErrorSink eSink)
{
size_t n = 0;
for (size_t i = 0; i < format.length;)
diff --git a/gcc/d/dmd/cond.d b/gcc/d/dmd/cond.d
index 186efb0..48b73e4 100644
--- a/gcc/d/dmd/cond.d
+++ b/gcc/d/dmd/cond.d
@@ -64,7 +64,7 @@ extern (C++) abstract class Condition : ASTNode
return DYNCAST.condition;
}
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
this.loc = loc;
}
@@ -126,7 +126,7 @@ extern (C++) final class StaticForeach : RootObject
*/
bool needExpansion = false;
- extern (D) this(const ref Loc loc, ForeachStatement aggrfe, ForeachRangeStatement rangefe) @safe
+ extern (D) this(Loc loc, ForeachStatement aggrfe, ForeachRangeStatement rangefe) @safe
{
assert(!!aggrfe ^ !!rangefe);
@@ -198,7 +198,7 @@ extern (C++) final class StaticForeach : RootObject
* Returns:
* AST of the expression `(){ s; }()` with location loc.
*/
- private extern(D) Expression wrapAndCall(const ref Loc loc, Statement s)
+ private extern(D) Expression wrapAndCall(Loc loc, Statement s)
{
auto tf = new TypeFunction(ParameterList(), null, LINK.default_, 0);
auto fd = new FuncLiteralDeclaration(loc, loc, tf, TOK.reserved, null);
@@ -221,7 +221,7 @@ extern (C++) final class StaticForeach : RootObject
* `foreach (parameters; lower .. upper) s;`
* Where aggregate/lower, upper are as for the current StaticForeach.
*/
- private extern(D) Statement createForeach(const ref Loc loc, Parameters* parameters, Statement s)
+ private extern(D) Statement createForeach(Loc loc, Parameters* parameters, Statement s)
{
if (aggrfe)
{
@@ -254,7 +254,7 @@ extern (C++) final class StaticForeach : RootObject
* }
*/
- private extern(D) TypeStruct createTupleType(const ref Loc loc, Expressions* e, Scope* sc)
+ private extern(D) TypeStruct createTupleType(Loc loc, Expressions* e, Scope* sc)
{ // TODO: move to druntime?
auto sid = Identifier.generateId("Tuple");
auto sdecl = new StructDeclaration(loc, sid, false);
@@ -280,7 +280,7 @@ extern (C++) final class StaticForeach : RootObject
* An AST for the expression `Tuple(e)`.
*/
- private extern(D) Expression createTuple(const ref Loc loc, TypeStruct type, Expressions* e) @safe
+ private extern(D) Expression createTuple(Loc loc, TypeStruct type, Expressions* e) @safe
{ // TODO: move to druntime?
return new CallExp(loc, new TypeExp(loc, type), e);
}
@@ -496,7 +496,7 @@ extern (C++) class DVCondition : Condition
Identifier ident;
Module mod;
- extern (D) this(const ref Loc loc, Module mod, Identifier ident) @safe
+ extern (D) this(Loc loc, Module mod, Identifier ident) @safe
{
super(loc);
this.mod = mod;
@@ -558,7 +558,7 @@ extern (C++) final class DebugCondition : DVCondition
* If `null`, this conditiion will use an integer level.
* loc = Location in the source file
*/
- extern (D) this(const ref Loc loc, Module mod, Identifier ident) @safe
+ extern (D) this(Loc loc, Module mod, Identifier ident) @safe
{
super(loc, mod, ident);
}
@@ -757,7 +757,7 @@ extern (C++) final class VersionCondition : DVCondition
* loc = Where the identifier is set
* ident = identifier being checked (ident[$] must be '\0')
*/
- extern(D) static void checkReserved(const ref Loc loc, const(char)[] ident)
+ extern(D) static void checkReserved(Loc loc, const(char)[] ident)
{
if (isReserved(ident))
error(loc, "version identifier `%s` is reserved and cannot be set",
@@ -833,7 +833,7 @@ extern (C++) final class VersionCondition : DVCondition
* If `null`, this conditiion will use an integer level.
* loc = Location in the source file
*/
- extern (D) this(const ref Loc loc, Module mod, Identifier ident) @safe
+ extern (D) this(Loc loc, Module mod, Identifier ident) @safe
{
super(loc, mod, ident);
}
@@ -890,7 +890,7 @@ extern (C++) final class StaticIfCondition : Condition
{
Expression exp;
- extern (D) this(const ref Loc loc, Expression exp) @safe
+ extern (D) this(Loc loc, Expression exp) @safe
{
super(loc);
this.exp = exp;
diff --git a/gcc/d/dmd/constfold.d b/gcc/d/dmd/constfold.d
index 9d5aa96..8e49238 100644
--- a/gcc/d/dmd/constfold.d
+++ b/gcc/d/dmd/constfold.d
@@ -107,7 +107,7 @@ UnionExp Not(Type type, Expression e1)
return ue;
}
-UnionExp Add(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Add(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
static if (LOG)
@@ -212,7 +212,7 @@ UnionExp Add(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Min(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Min(Loc loc, Type type, Expression e1, Expression e2)
{
// Compute e1-e2 as e1+(-e2)
UnionExp neg = Neg(e2.type, e2);
@@ -220,7 +220,7 @@ UnionExp Min(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Mul(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Mul(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
if (type.isFloating())
@@ -269,7 +269,7 @@ UnionExp Mul(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Div(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Div(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
if (type.isFloating())
@@ -344,7 +344,7 @@ UnionExp Div(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Mod(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Mod(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
if (type.isFloating())
@@ -409,7 +409,7 @@ UnionExp Mod(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Pow(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Pow(Loc loc, Type type, Expression e1, Expression e2)
{
//printf("Pow()\n");
UnionExp ue;
@@ -489,14 +489,14 @@ UnionExp Pow(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Shl(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Shl(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
emplaceExp!(IntegerExp)(&ue, loc, e1.toInteger() << e2.toInteger(), type);
return ue;
}
-UnionExp Shr(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Shr(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
dinteger_t value = e1.toInteger();
@@ -542,7 +542,7 @@ UnionExp Shr(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp Ushr(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Ushr(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
dinteger_t value = e1.toInteger();
@@ -582,21 +582,21 @@ UnionExp Ushr(const ref Loc loc, Type type, Expression e1, Expression e2)
return ue;
}
-UnionExp And(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp And(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
emplaceExp!(IntegerExp)(&ue, loc, e1.toInteger() & e2.toInteger(), type);
return ue;
}
-UnionExp Or(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Or(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
emplaceExp!(IntegerExp)(&ue, loc, e1.toInteger() | e2.toInteger(), type);
return ue;
}
-UnionExp Xor(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Xor(Loc loc, Type type, Expression e1, Expression e2)
{
//printf("Xor(linnum = %d, e1 = %s, e2 = %s)\n", loc.linnum, e1.toChars(), e2.toChars());
UnionExp ue = void;
@@ -606,7 +606,7 @@ UnionExp Xor(const ref Loc loc, Type type, Expression e1, Expression e2)
/* Also returns EXP.cantExpression if cannot be computed.
*/
-UnionExp Equal(EXP op, const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Equal(EXP op, Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
int cmp = 0;
@@ -804,7 +804,7 @@ UnionExp Equal(EXP op, const ref Loc loc, Type type, Expression e1, Expression e
return ue;
}
-UnionExp Identity(EXP op, const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Identity(EXP op, Loc loc, Type type, Expression e1, Expression e2)
{
//printf("Identity %s %s\n", e1.toChars(), e2.toChars());
UnionExp ue = void;
@@ -849,7 +849,7 @@ UnionExp Identity(EXP op, const ref Loc loc, Type type, Expression e1, Expressio
return ue;
}
-UnionExp Cmp(EXP op, const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Cmp(EXP op, Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
dinteger_t n;
@@ -913,7 +913,7 @@ UnionExp Cmp(EXP op, const ref Loc loc, Type type, Expression e1, Expression e2)
* to: type to cast to
* type: type to paint the result
*/
-UnionExp Cast(const ref Loc loc, Type type, Type to, Expression e1)
+UnionExp Cast(Loc loc, Type type, Type to, Expression e1)
{
UnionExp ue = void;
Type tb = to.toBasetype();
@@ -1396,7 +1396,7 @@ private Expressions* copyElements(Expression e1, Expression e2 = null)
/* Also return EXP.cantExpression if this fails
*/
-UnionExp Cat(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp Cat(Loc loc, Type type, Expression e1, Expression e2)
{
UnionExp ue = void;
Expression e = CTFEExp.cantexp;
diff --git a/gcc/d/dmd/cparse.d b/gcc/d/dmd/cparse.d
index bef1ec9..548bee9 100644
--- a/gcc/d/dmd/cparse.d
+++ b/gcc/d/dmd/cparse.d
@@ -5620,7 +5620,7 @@ final class CParser(AST) : Parser!AST
* Params:
* startloc = location to use for error messages
*/
- private void uupragmaDirective(const ref Loc startloc)
+ private void uupragmaDirective(Loc startloc)
{
const loc = startloc;
nextToken(); // move past __pragma
@@ -5668,7 +5668,7 @@ final class CParser(AST) : Parser!AST
* the preprocessed output. Ignore them.
* Upon return, p is at start of next line.
*/
- private void pragmaDirective(const ref Loc loc)
+ private void pragmaDirective(Loc loc)
{
Token n;
scan(&n);
@@ -5689,7 +5689,7 @@ final class CParser(AST) : Parser!AST
* startloc = location to use for error messages
* useScan = use scan() to retrieve next token, instead of nextToken()
*/
- private void pragmaPack(const ref Loc startloc, bool useScan)
+ private void pragmaPack(Loc startloc, bool useScan)
{
const loc = startloc;
@@ -5889,7 +5889,7 @@ final class CParser(AST) : Parser!AST
* Params:
* startloc = location to use for error messages
*/
- private void pragmaAttribute(const ref Loc startloc)
+ private void pragmaAttribute(Loc startloc)
{
const loc = startloc;
@@ -6324,7 +6324,6 @@ final class CParser(AST) : Parser!AST
while (*p)
++p;
++p; // advance to start of next line
- scanloc.linnum = scanloc.linnum + 1;
}
if (newSymbols.length)
diff --git a/gcc/d/dmd/ctfeexpr.d b/gcc/d/dmd/ctfeexpr.d
index 9a92781..8801288 100644
--- a/gcc/d/dmd/ctfeexpr.d
+++ b/gcc/d/dmd/ctfeexpr.d
@@ -522,7 +522,7 @@ uinteger_t resolveArrayLength(Expression e)
* Returns:
* Constructed ArrayLiteralExp
*/
-ArrayLiteralExp createBlockDuplicatedArrayLiteral(UnionExp* pue, const ref Loc loc, Type type, Expression elem, size_t dim)
+ArrayLiteralExp createBlockDuplicatedArrayLiteral(UnionExp* pue, Loc loc, Type type, Expression elem, size_t dim)
{
if (type.ty == Tsarray && type.nextOf().ty == Tsarray && elem.type.ty != Tsarray)
{
@@ -553,7 +553,7 @@ ArrayLiteralExp createBlockDuplicatedArrayLiteral(UnionExp* pue, const ref Loc l
* Helper for NewExp
* Create a string literal consisting of 'value' duplicated 'dim' times.
*/
-StringExp createBlockDuplicatedStringLiteral(UnionExp* pue, const ref Loc loc, Type type, dchar value, size_t dim, ubyte sz)
+StringExp createBlockDuplicatedStringLiteral(UnionExp* pue, Loc loc, Type type, dchar value, size_t dim, ubyte sz)
{
auto s = cast(char*)mem.xcalloc(dim, sz);
foreach (elemi; 0 .. dim)
@@ -741,7 +741,7 @@ bool pointToSameMemoryBlock(Expression agg1, Expression agg2)
}
// return e1 - e2 as an integer, or error if not possible
-Expression pointerDifference(UnionExp* pue, const ref Loc loc, Type type, Expression e1, Expression e2)
+Expression pointerDifference(UnionExp* pue, Loc loc, Type type, Expression e1, Expression e2)
{
dinteger_t ofs1, ofs2;
Expression agg1 = getAggregateFromPointer(e1, &ofs1);
@@ -774,7 +774,7 @@ Expression pointerDifference(UnionExp* pue, const ref Loc loc, Type type, Expres
// Return eptr op e2, where eptr is a pointer, e2 is an integer,
// and op is EXP.add or EXP.min
-Expression pointerArithmetic(UnionExp* pue, const ref Loc loc, EXP op, Type type, Expression eptr, Expression e2)
+Expression pointerArithmetic(UnionExp* pue, Loc loc, EXP op, Type type, Expression eptr, Expression e2)
{
if (eptr.type.nextOf().ty == Tvoid)
{
@@ -1052,7 +1052,7 @@ bool realCmp(EXP op, real_t r1, real_t r2) @safe nothrow
* Returns:
* -1,0,1
*/
-private int ctfeCmpArrays(const ref Loc loc, Expression e1, Expression e2, uinteger_t len)
+private int ctfeCmpArrays(Loc loc, Expression e1, Expression e2, uinteger_t len)
{
// Resolve slices, if necessary
uinteger_t lo1 = 0;
@@ -1138,7 +1138,7 @@ private bool isArray(const Expression e) @safe nothrow
* For strings, return <0 if e1 < e2, 0 if e1==e2, >0 if e1 > e2.
* For all other types, return 0 if e1 == e2, !=0 if e1 != e2.
*/
-private int ctfeRawCmp(const ref Loc loc, Expression e1, Expression e2, bool identity = false)
+private int ctfeRawCmp(Loc loc, Expression e1, Expression e2, bool identity = false)
{
if (e1.op == EXP.classReference || e2.op == EXP.classReference)
{
@@ -1310,13 +1310,13 @@ private int ctfeRawCmp(const ref Loc loc, Expression e1, Expression e2, bool ide
}
/// Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1
-bool ctfeEqual(const ref Loc loc, EXP op, Expression e1, Expression e2)
+bool ctfeEqual(Loc loc, EXP op, Expression e1, Expression e2)
{
return !ctfeRawCmp(loc, e1, e2) ^ (op == EXP.notEqual);
}
/// Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1
-bool ctfeIdentity(const ref Loc loc, EXP op, Expression e1, Expression e2)
+bool ctfeIdentity(Loc loc, EXP op, Expression e1, Expression e2)
{
//printf("ctfeIdentity %s %s\n", e1.toChars(), e2.toChars());
//printf("ctfeIdentity op = '%s', e1 = %s %s, e2 = %s %s\n", EXPtoString(op).ptr,
@@ -1348,7 +1348,7 @@ bool ctfeIdentity(const ref Loc loc, EXP op, Expression e1, Expression e2)
}
/// Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1
-bool ctfeCmp(const ref Loc loc, EXP op, Expression e1, Expression e2)
+bool ctfeCmp(Loc loc, EXP op, Expression e1, Expression e2)
{
Type t1 = e1.type.toBasetype();
Type t2 = e2.type.toBasetype();
@@ -1365,7 +1365,7 @@ bool ctfeCmp(const ref Loc loc, EXP op, Expression e1, Expression e2)
return intSignedCmp(op, e1.toInteger(), e2.toInteger());
}
-UnionExp ctfeCat(const ref Loc loc, Type type, Expression e1, Expression e2)
+UnionExp ctfeCat(Loc loc, Type type, Expression e1, Expression e2)
{
Type t1 = e1.type.toBasetype();
Type t2 = e2.type.toBasetype();
@@ -1459,7 +1459,7 @@ UnionExp ctfeCat(const ref Loc loc, Type type, Expression e1, Expression e2)
/* Given an AA literal 'ae', and a key 'e2':
* Return ae[e2] if present, or NULL if not found.
*/
-Expression findKeyInAA(const ref Loc loc, AssocArrayLiteralExp ae, Expression e2)
+Expression findKeyInAA(Loc loc, AssocArrayLiteralExp ae, Expression e2)
{
/* Search the keys backwards, in case there are duplicate keys
*/
@@ -1480,7 +1480,7 @@ Expression findKeyInAA(const ref Loc loc, AssocArrayLiteralExp ae, Expression e2
* dynamic arrays, and strings. We know that e1 is an
* interpreted CTFE expression, so it cannot have side-effects.
*/
-Expression ctfeIndex(UnionExp* pue, const ref Loc loc, Type type, Expression e1, uinteger_t indx)
+Expression ctfeIndex(UnionExp* pue, Loc loc, Type type, Expression e1, uinteger_t indx)
{
//printf("ctfeIndex(e1 = %s)\n", e1.toChars());
assert(e1.type);
@@ -1509,7 +1509,7 @@ Expression ctfeIndex(UnionExp* pue, const ref Loc loc, Type type, Expression e1,
assert(0);
}
-Expression ctfeCast(UnionExp* pue, const ref Loc loc, Type type, Type to, Expression e, bool explicitCast = false)
+Expression ctfeCast(UnionExp* pue, Loc loc, Type type, Type to, Expression e, bool explicitCast = false)
{
Expression paint()
{
@@ -1649,7 +1649,7 @@ void assignInPlace(Expression dest, Expression src)
}
// Given an AA literal aae, set aae[index] = newval and return newval.
-Expression assignAssocArrayElement(const ref Loc loc, AssocArrayLiteralExp aae, Expression index, Expression newval)
+Expression assignAssocArrayElement(Loc loc, AssocArrayLiteralExp aae, Expression index, Expression newval)
{
/* Create new associative array literal reflecting updated key/value
*/
@@ -1679,7 +1679,7 @@ Expression assignAssocArrayElement(const ref Loc loc, AssocArrayLiteralExp aae,
/// Given array literal oldval of type ArrayLiteralExp or StringExp, of length
/// oldlen, change its length to newlen. If the newlen is longer than oldlen,
/// all new elements will be set to the default initializer for the element type.
-Expression changeArrayLiteralLength(UnionExp* pue, const ref Loc loc, TypeArray arrayType, Expression oldval, size_t oldlen, size_t newlen)
+Expression changeArrayLiteralLength(UnionExp* pue, Loc loc, TypeArray arrayType, Expression oldval, size_t oldlen, size_t newlen)
{
Type elemType = arrayType.next;
assert(elemType);
diff --git a/gcc/d/dmd/cxxfrontend.d b/gcc/d/dmd/cxxfrontend.d
index 3807c1d..dfc76ff 100644
--- a/gcc/d/dmd/cxxfrontend.d
+++ b/gcc/d/dmd/cxxfrontend.d
@@ -153,7 +153,7 @@ void addMember(Dsymbol dsym, Scope* sc, ScopeDsymbol sds)
return dmd.dsymbolsem.addMember(dsym, sc, sds);
}
-Dsymbol search(Dsymbol d, const ref Loc loc, Identifier ident, SearchOptFlags
+Dsymbol search(Dsymbol d, Loc loc, Identifier ident, SearchOptFlags
flags = SearchOpt.all)
{
import dmd.dsymbolsem;
@@ -233,7 +233,7 @@ void genCppHdrFiles(ref Modules ms)
/***********************************************************
* enumsem.d
*/
-Expression getDefaultValue(EnumDeclaration ed, const ref Loc loc)
+Expression getDefaultValue(EnumDeclaration ed, Loc loc)
{
import dmd.enumsem;
return dmd.enumsem.getDefaultValue(ed, loc);
@@ -256,7 +256,7 @@ Expression expressionSemantic(Expression e, Scope* sc)
return dmd.expressionsem.expressionSemantic(e, sc);
}
-bool fill(StructDeclaration sd, const ref Loc loc,
+bool fill(StructDeclaration sd, Loc loc,
ref Expressions elements, bool ctorinit)
{
import dmd.expressionsem;
@@ -470,13 +470,13 @@ bool hasPointers(Type t)
return dmd.typesem.hasPointers(t);
}
-Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
+Type typeSemantic(Type type, Loc loc, Scope* sc)
{
import dmd.typesem;
return dmd.typesem.typeSemantic(type, loc, sc);
}
-Type trySemantic(Type type, const ref Loc loc, Scope* sc)
+Type trySemantic(Type type, Loc loc, Scope* sc)
{
import dmd.typesem;
return dmd.typesem.trySemantic(type, loc, sc);
@@ -494,7 +494,7 @@ Type merge2(Type type)
return dmd.typesem.merge2(type);
}
-Expression defaultInit(Type mt, const ref Loc loc, const bool isCfile = false)
+Expression defaultInit(Type mt, Loc loc, const bool isCfile = false)
{
import dmd.typesem;
return dmd.typesem.defaultInit(mt, loc, isCfile);
@@ -513,7 +513,7 @@ Covariant covariant(Type src, Type t, StorageClass* pstc = null, bool
return dmd.typesem.covariant(src, t, pstc, cppCovariant);
}
-bool isZeroInit(Type t, const ref Loc loc)
+bool isZeroInit(Type t, Loc loc)
{
import dmd.typesem;
return dmd.typesem.isZeroInit(t, loc);
@@ -663,7 +663,7 @@ uinteger_t size(Type type)
return dmd.typesem.size(type);
}
-uinteger_t size(Type type, const ref Loc loc)
+uinteger_t size(Type type, Loc loc)
{
import dmd.typesem;
return dmd.typesem.size(type, loc);
@@ -684,7 +684,7 @@ MATCH constConv(Type from, Type to)
/***********************************************************
* typinf.d
*/
-bool genTypeInfo(Expression e, const ref Loc loc, Type torig, Scope* sc)
+bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
{
import dmd.typinf;
return dmd.typinf.genTypeInfo(e, loc, torig, sc);
diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d
index bb85318..f42a061 100644
--- a/gcc/d/dmd/dcast.d
+++ b/gcc/d/dmd/dcast.d
@@ -2738,7 +2738,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
if (auto tsa = tb.isTypeSArray())
{
if (e.elements.length != tsa.dim.toInteger())
- goto L1;
+ return visit(ae);
}
ae = e.copy().isArrayLiteralExp();
@@ -2776,7 +2776,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
const edim = e.elements.length;
const tbasedim = tbase.dim.toInteger();
if (edim > tbasedim)
- goto L1;
+ return visit(ae);
ae = e.copy().isArrayLiteralExp();
ae.type = tbase; // https://issues.dlang.org/show_bug.cgi?id=12642
@@ -2800,7 +2800,6 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
ev = ev.expressionSemantic(sc);
return ev;
}
- L1:
return visit(ae);
}
diff --git a/gcc/d/dmd/dclass.d b/gcc/d/dmd/dclass.d
index c99d275..b59c520 100644
--- a/gcc/d/dmd/dclass.d
+++ b/gcc/d/dmd/dclass.d
@@ -198,7 +198,7 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
Symbol* cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr
- final extern (D) this(const ref Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject)
+ final extern (D) this(Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject)
{
objc = ObjcClassDeclaration(this);
@@ -375,7 +375,7 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
.error(loc, fmt, kind, toPrettyChars, arg);
}
- static ClassDeclaration create(const ref Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject)
+ static ClassDeclaration create(Loc loc, Identifier id, BaseClasses* baseclasses, Dsymbols* members, bool inObject)
{
return new ClassDeclaration(loc, id, baseclasses, members, inObject);
}
@@ -956,7 +956,7 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
*/
extern (C++) final class InterfaceDeclaration : ClassDeclaration
{
- extern (D) this(const ref Loc loc, Identifier id, BaseClasses* baseclasses)
+ extern (D) this(Loc loc, Identifier id, BaseClasses* baseclasses)
{
super(loc, id, baseclasses, null, false);
if (id == Id.IUnknown) // IUnknown is the root of all COM interfaces
diff --git a/gcc/d/dmd/declaration.d b/gcc/d/dmd/declaration.d
index c94443d..26887f8 100644
--- a/gcc/d/dmd/declaration.d
+++ b/gcc/d/dmd/declaration.d
@@ -107,7 +107,7 @@ extern (C++) abstract class Declaration : Dsymbol
visibility = Visibility(Visibility.Kind.undefined);
}
- final extern (D) this(const ref Loc loc, Identifier ident) @safe
+ final extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, ident);
visibility = Visibility(Visibility.Kind.undefined);
@@ -118,7 +118,7 @@ extern (C++) abstract class Declaration : Dsymbol
return "declaration";
}
- override final uinteger_t size(const ref Loc loc)
+ override final uinteger_t size(Loc loc)
{
assert(type);
const sz = type.size();
@@ -289,7 +289,7 @@ extern (C++) final class TupleDeclaration : Declaration
bool isexp; // true: expression tuple
bool building; // it's growing in AliasAssign semantic
- extern (D) this(const ref Loc loc, Identifier ident, Objects* objects) @safe
+ extern (D) this(Loc loc, Identifier ident, Objects* objects) @safe
{
super(loc, ident);
this.objects = objects;
@@ -440,7 +440,7 @@ extern (C++) final class AliasDeclaration : Declaration
Dsymbol overnext; // next in overload list
Dsymbol _import; // !=null if unresolved internal alias for selective import
- extern (D) this(const ref Loc loc, Identifier ident, Type type) @safe
+ extern (D) this(Loc loc, Identifier ident, Type type) @safe
{
super(loc, ident);
//debug printf("AliasDeclaration(id = '%s', type = `%s`, %p)\n", ident.toChars(), dmd.hdrgen.toChars(type), type.isTypeIdentifier());
@@ -448,7 +448,7 @@ extern (C++) final class AliasDeclaration : Declaration
assert(type);
}
- extern (D) this(const ref Loc loc, Identifier ident, Dsymbol s) @safe
+ extern (D) this(Loc loc, Identifier ident, Dsymbol s) @safe
{
super(loc, ident);
//debug printf("AliasDeclaration(id = '%s', s = `%s`)\n", ident.toChars(), s.toChars());
@@ -457,7 +457,7 @@ extern (C++) final class AliasDeclaration : Declaration
assert(s);
}
- static AliasDeclaration create(const ref Loc loc, Identifier id, Type type) @safe
+ static AliasDeclaration create(Loc loc, Identifier id, Type type) @safe
{
return new AliasDeclaration(loc, id, type);
}
@@ -882,7 +882,7 @@ extern (C++) class VarDeclaration : Declaration
byte canassign; // it can be assigned to
ubyte isdataseg; // private data for isDataseg 0 unset, 1 true, 2 false
- final extern (D) this(const ref Loc loc, Type type, Identifier ident, Initializer _init, StorageClass storage_class = STC.undefined_)
+ final extern (D) this(Loc loc, Type type, Identifier ident, Initializer _init, StorageClass storage_class = STC.undefined_)
in
{
assert(ident);
@@ -907,7 +907,7 @@ extern (C++) class VarDeclaration : Declaration
this.storage_class = storage_class;
}
- static VarDeclaration create(const ref Loc loc, Type type, Identifier ident, Initializer _init, StorageClass storage_class = STC.undefined_)
+ static VarDeclaration create(Loc loc, Type type, Identifier ident, Initializer _init, StorageClass storage_class = STC.undefined_)
{
return new VarDeclaration(loc, type, ident, _init, storage_class);
}
@@ -1244,7 +1244,7 @@ extern (C++) class BitFieldDeclaration : VarDeclaration
uint fieldWidth;
uint bitOffset;
- final extern (D) this(const ref Loc loc, Type type, Identifier ident, Expression width)
+ final extern (D) this(Loc loc, Type type, Identifier ident, Expression width)
{
super(loc, type, ident, null);
@@ -1305,7 +1305,7 @@ extern (C++) final class SymbolDeclaration : Declaration
{
AggregateDeclaration dsym;
- extern (D) this(const ref Loc loc, AggregateDeclaration dsym) @safe
+ extern (D) this(Loc loc, AggregateDeclaration dsym) @safe
{
super(loc, dsym.ident);
this.dsym = dsym;
@@ -1795,7 +1795,7 @@ extern (C++) final class TypeInfoVectorDeclaration : TypeInfoDeclaration
*/
extern (C++) final class ThisDeclaration : VarDeclaration
{
- extern (D) this(const ref Loc loc, Type t)
+ extern (D) this(Loc loc, Type t)
{
super(loc, t, Id.This, null);
storage_class |= STC.nodtor;
diff --git a/gcc/d/dmd/declaration.h b/gcc/d/dmd/declaration.h
index e2ac13e..4fd35ee 100644
--- a/gcc/d/dmd/declaration.h
+++ b/gcc/d/dmd/declaration.h
@@ -128,7 +128,7 @@ public:
DString mangleOverride; // overridden symbol with pragma(mangle, "...")
const char *kind() const override;
- uinteger_t size(const Loc &loc) override final;
+ uinteger_t size(Loc loc) override final;
bool isStatic() const { return (storage_class & STCstatic) != 0; }
@@ -194,7 +194,7 @@ public:
Dsymbol *overnext; // next in overload list
Dsymbol *_import; // !=NULL if unresolved internal alias for selective import
- static AliasDeclaration *create(const Loc &loc, Identifier *id, Type *type);
+ static AliasDeclaration *create(Loc loc, Identifier *id, Type *type);
AliasDeclaration *syntaxCopy(Dsymbol *) override;
bool overloadInsert(Dsymbol *s) override;
const char *kind() const override;
@@ -284,7 +284,7 @@ public:
#endif
bool systemInferred() const;
bool systemInferred(bool v);
- static VarDeclaration *create(const Loc &loc, Type *t, Identifier *id, Initializer *init, StorageClass storage_class = STCundefined);
+ static VarDeclaration *create(Loc loc, Type *t, Identifier *id, Initializer *init, StorageClass storage_class = STCundefined);
VarDeclaration *syntaxCopy(Dsymbol *) override;
const char *kind() const override;
AggregateDeclaration *isThis() override final;
@@ -535,7 +535,7 @@ enum class BUILTIN : unsigned char
toPrecReal
};
-Expression *eval_builtin(const Loc &loc, FuncDeclaration *fd, Expressions *arguments);
+Expression *eval_builtin(Loc loc, FuncDeclaration *fd, Expressions *arguments);
BUILTIN isBuiltin(FuncDeclaration *fd);
struct ContractInfo;
@@ -684,7 +684,7 @@ public:
// integration.
ObjcFuncDeclaration objc;
- static FuncDeclaration *create(const Loc &loc, const Loc &endloc, Identifier *id, StorageClass storage_class, Type *type, bool noreturn = false);
+ static FuncDeclaration *create(Loc loc, Loc endloc, Identifier *id, StorageClass storage_class, Type *type, bool noreturn = false);
FuncDeclaration *syntaxCopy(Dsymbol *) override;
Statements *frequires();
Ensures *fensures();
@@ -706,7 +706,7 @@ public:
bool overloadInsert(Dsymbol *s) override;
bool inUnittest();
- LabelDsymbol *searchLabel(Identifier *ident, const Loc &loc);
+ LabelDsymbol *searchLabel(Identifier *ident, Loc loc);
const char *toPrettyChars(bool QualifyTypes = false) override;
const char *toFullSignature(); // for diagnostics, e.g. 'int foo(int x, int y) pure'
bool isMain() const;
diff --git a/gcc/d/dmd/denum.d b/gcc/d/dmd/denum.d
index 5c739ee..a650425 100644
--- a/gcc/d/dmd/denum.d
+++ b/gcc/d/dmd/denum.d
@@ -64,7 +64,7 @@ extern (C++) final class EnumDeclaration : ScopeDsymbol
Symbol* sinit;
- extern (D) this(const ref Loc loc, Identifier ident, Type memtype)
+ extern (D) this(Loc loc, Identifier ident, Type memtype)
{
super(loc, ident);
//printf("EnumDeclaration() %p %s : %s\n", this, toChars(), memtype.toChars());
@@ -154,7 +154,7 @@ extern (C++) final class EnumMember : VarDeclaration
EnumDeclaration ed;
- extern (D) this(const ref Loc loc, Identifier id, Expression value, Type origType)
+ extern (D) this(Loc loc, Identifier id, Expression value, Type origType)
{
super(loc, null, id ? id : Id.empty, new ExpInitializer(loc, value));
this.origValue = value;
diff --git a/gcc/d/dmd/dimport.d b/gcc/d/dmd/dimport.d
index ec7abb5..8a2c271 100644
--- a/gcc/d/dmd/dimport.d
+++ b/gcc/d/dmd/dimport.d
@@ -40,7 +40,7 @@ extern (C++) final class Import : Dsymbol
// corresponding AliasDeclarations for alias=name pairs
AliasDeclarations aliasdecls;
- extern (D) this(const ref Loc loc, Identifier[] packages, Identifier id, Identifier aliasId, int isstatic)
+ extern (D) this(Loc loc, Identifier[] packages, Identifier id, Identifier aliasId, int isstatic)
{
Identifier selectIdent()
{
diff --git a/gcc/d/dmd/dinterpret.d b/gcc/d/dmd/dinterpret.d
index 648c5b4..5dbab09 100644
--- a/gcc/d/dmd/dinterpret.d
+++ b/gcc/d/dmd/dinterpret.d
@@ -758,7 +758,7 @@ private Expression interpretFunction(UnionExp* pue, FuncDeclaration fd, InterSta
}
/// used to collect coverage information in ctfe
-void incUsageCtfe(InterState* istate, const ref Loc loc)
+void incUsageCtfe(InterState* istate, Loc loc)
{
if (global.params.ctfe_cov && istate)
{
@@ -2052,7 +2052,7 @@ public:
}
}
- static Expression getVarExp(const ref Loc loc, InterState* istate, Declaration d, CTFEGoal goal)
+ static Expression getVarExp(Loc loc, InterState* istate, Declaration d, CTFEGoal goal)
{
Expression e = CTFEExp.cantexp;
if (VarDeclaration v = d.isVarDeclaration())
@@ -2752,7 +2752,7 @@ public:
// Create an array literal of type 'newtype' with dimensions given by
// 'arguments'[argnum..$]
- static Expression recursivelyCreateArrayLiteral(UnionExp* pue, const ref Loc loc, Type newtype, InterState* istate, Expressions* arguments, int argnum)
+ static Expression recursivelyCreateArrayLiteral(UnionExp* pue, Loc loc, Type newtype, InterState* istate, Expressions* arguments, int argnum)
{
Expression lenExpr = interpret(pue, (*arguments)[argnum], istate);
if (exceptionOrCantInterpret(lenExpr))
@@ -3005,8 +3005,8 @@ public:
}
}
- private alias fp_t = extern (D) UnionExp function(const ref Loc loc, Type, Expression, Expression);
- private alias fp2_t = extern (D) bool function(const ref Loc loc, EXP, Expression, Expression);
+ private alias fp_t = extern (D) UnionExp function(Loc loc, Type, Expression, Expression);
+ private alias fp2_t = extern (D) bool function(Loc loc, EXP, Expression, Expression);
extern (D) private void interpretCommon(BinExp e, fp_t fp)
{
@@ -6530,7 +6530,7 @@ public:
/// Interpret `throw <exp>` found at the specified location `loc`
private
-void interpretThrow(ref Expression result, Expression exp, const ref Loc loc, InterState* istate)
+void interpretThrow(ref Expression result, Expression exp, Loc loc, InterState* istate)
{
incUsageCtfe(istate, loc);
@@ -6671,7 +6671,7 @@ Expressions* copyArrayOnWrite(Expressions* exps, Expressions* original)
true if it is safe to return, false if an error was generated.
*/
private
-bool stopPointersEscaping(const ref Loc loc, Expression e)
+bool stopPointersEscaping(Loc loc, Expression e)
{
import dmd.typesem : hasPointers;
if (!e.type.hasPointers())
@@ -6721,7 +6721,7 @@ bool stopPointersEscaping(const ref Loc loc, Expression e)
// Check all elements of an array for escaping local variables. Return false if error
private
-bool stopPointersEscapingFromArray(const ref Loc loc, Expressions* elems)
+bool stopPointersEscapingFromArray(Loc loc, Expressions* elems)
{
foreach (e; *elems)
{
@@ -6785,7 +6785,7 @@ ThrownExceptionExp chainExceptions(ThrownExceptionExp oldest, ThrownExceptionExp
* 1. all slices must be resolved.
* 2. all .ownedByCtfe set to OwnedBy.code
*/
-private Expression scrubReturnValue(const ref Loc loc, Expression e)
+private Expression scrubReturnValue(Loc loc, Expression e)
{
/* Returns: true if e is void,
* or is an array literal or struct literal of void elements.
@@ -7505,7 +7505,7 @@ private Expression foreachApplyUtf(UnionExp* pue, InterState* istate, Expression
/* If this is a built-in function, return the interpreted result,
* Otherwise, return NULL.
*/
-private Expression evaluateIfBuiltin(UnionExp* pue, InterState* istate, const ref Loc loc, FuncDeclaration fd, Expressions* arguments, Expression pthis)
+private Expression evaluateIfBuiltin(UnionExp* pue, InterState* istate, Loc loc, FuncDeclaration fd, Expressions* arguments, Expression pthis)
{
Expression e = null;
size_t nargs = arguments ? arguments.length : 0;
diff --git a/gcc/d/dmd/dmodule.d b/gcc/d/dmd/dmodule.d
index d599d9c..3264c34 100644
--- a/gcc/d/dmd/dmodule.d
+++ b/gcc/d/dmd/dmodule.d
@@ -175,7 +175,7 @@ extern (C++) class Package : ScopeDsymbol
uint tag; // auto incremented tag, used to mask package tree in scopes
Module mod; // !=null if isPkgMod == PKG.module_
- final extern (D) this(const ref Loc loc, Identifier ident) nothrow
+ final extern (D) this(Loc loc, Identifier ident) nothrow
{
super(loc, ident);
__gshared uint packageTag;
@@ -442,7 +442,7 @@ extern (C++) final class Module : Package
size_t nameoffset; // offset of module name from start of ModuleInfo
size_t namelen; // length of module name in characters
- extern (D) this(const ref Loc loc, const(char)[] filename, Identifier ident, int doDocComment, int doHdrGen)
+ extern (D) this(Loc loc, const(char)[] filename, Identifier ident, int doDocComment, int doHdrGen)
{
super(loc, ident);
const(char)[] srcfilename;
@@ -512,12 +512,12 @@ extern (C++) final class Module : Package
return ret;
}
- extern (C++) static Module load(const ref Loc loc, Identifiers* packages, Identifier ident)
+ extern (C++) static Module load(Loc loc, Identifiers* packages, Identifier ident)
{
return load(loc, packages ? (*packages)[] : null, ident);
}
- extern (D) static Module load(const ref Loc loc, Identifier[] packages, Identifier ident, ImportPathInfo pathInfo = ImportPathInfo.init)
+ extern (D) static Module load(Loc loc, Identifier[] packages, Identifier ident, ImportPathInfo pathInfo = ImportPathInfo.init)
{
//printf("Module::load(ident = '%s')\n", ident.toChars());
// Build module filename by turning:
@@ -638,7 +638,7 @@ extern (C++) final class Module : Package
* Params:
* loc = The location at which the file read originated (e.g. import)
*/
- private void onFileReadError(const ref Loc loc)
+ private void onFileReadError(Loc loc)
{
const name = srcfile.toString();
if (FileName.equals(name, "object.d"))
@@ -695,7 +695,7 @@ extern (C++) final class Module : Package
*
* Returns: `true` if successful
*/
- bool read(const ref Loc loc)
+ bool read(Loc loc)
{
if (this.src)
return true; // already read
@@ -805,7 +805,7 @@ extern (C++) final class Module : Package
checkCompiledImport();
members = p.parseModule();
assert(!p.md); // C doesn't have module declarations
- numlines = p.scanloc.linnum;
+ numlines = p.linnum;
}
else
{
@@ -829,7 +829,7 @@ extern (C++) final class Module : Package
checkCompiledImport();
members = p.parseModuleContent();
- numlines = p.scanloc.linnum;
+ numlines = p.linnum;
}
/* The symbol table into which the module is to be inserted.
@@ -969,7 +969,7 @@ extern (C++) final class Module : Package
* sc = the scope into which we are imported
* loc = the location of the import statement
*/
- void checkImportDeprecation(const ref Loc loc, Scope* sc)
+ void checkImportDeprecation(Loc loc, Scope* sc)
{
if (md && md.isdeprecated && !sc.isDeprecated)
{
@@ -1294,7 +1294,7 @@ extern (C++) struct ModuleDeclaration
bool isdeprecated; // if it is a deprecated module
Expression msg;
- extern (D) this(const ref Loc loc, Identifier[] packages, Identifier id, Expression msg, bool isdeprecated) @safe
+ extern (D) this(Loc loc, Identifier[] packages, Identifier id, Expression msg, bool isdeprecated) @safe
{
this.loc = loc;
this.packages = packages;
diff --git a/gcc/d/dmd/dscope.d b/gcc/d/dmd/dscope.d
index a683d9c..3001bd7 100644
--- a/gcc/d/dmd/dscope.d
+++ b/gcc/d/dmd/dscope.d
@@ -131,10 +131,10 @@ extern (C++) struct Scope
VarDeclaration varDecl; /// variable we are in during semantic2
Dsymbol parent; /// parent to use
LabelStatement slabel; /// enclosing labelled statement
- SwitchStatement sw; /// enclosing switch statement
+ SwitchStatement switchStatement;/// enclosing switch statement
Statement tryBody; /// enclosing _body of TryCatchStatement or TryFinallyStatement
- TryFinallyStatement tf; /// enclosing try finally statement
- ScopeGuardStatement os; /// enclosing scope(xxx) statement
+ TryFinallyStatement tryFinally; /// enclosing try finally statement
+ ScopeGuardStatement scopeGuard; /// enclosing scope(xxx) statement
Statement sbreak; /// enclosing statement that supports "break"
Statement scontinue; /// enclosing statement that supports "continue"
ForeachStatement fes; /// if nested function for ForeachStatement, this is it
@@ -382,7 +382,7 @@ extern (C++) struct Scope
* loc = for error messages
* ctorflow = flow results to merge in
*/
- extern (D) void merge(const ref Loc loc, const ref CtorFlow ctorflow)
+ extern (D) void merge(Loc loc, const ref CtorFlow ctorflow)
{
if (!mergeCallSuper(this.ctorflow.callSuper, ctorflow.callSuper))
error(loc, "one path skips constructor");
@@ -422,7 +422,7 @@ extern (C++) struct Scope
* Returns:
* symbol if found, null if not
*/
- extern (C++) Dsymbol search(const ref Loc loc, Identifier ident, out Dsymbol pscopesym, SearchOptFlags flags = SearchOpt.all)
+ extern (C++) Dsymbol search(Loc loc, Identifier ident, out Dsymbol pscopesym, SearchOptFlags flags = SearchOpt.all)
{
version (LOGSEARCH)
{
diff --git a/gcc/d/dmd/dstruct.d b/gcc/d/dmd/dstruct.d
index 9a9058f..0a0b366 100644
--- a/gcc/d/dmd/dstruct.d
+++ b/gcc/d/dmd/dstruct.d
@@ -116,7 +116,7 @@ extern (C++) class StructDeclaration : AggregateDeclaration
import dmd.common.bitfields : generateBitFields;
mixin(generateBitFields!(BitFields, ushort));
- extern (D) this(const ref Loc loc, Identifier id, bool inObject)
+ extern (D) this(Loc loc, Identifier id, bool inObject)
{
super(loc, id);
zeroInit = false; // assume false until we do semantic processing
@@ -131,7 +131,7 @@ extern (C++) class StructDeclaration : AggregateDeclaration
}
}
- static StructDeclaration create(const ref Loc loc, Identifier id, bool inObject)
+ static StructDeclaration create(Loc loc, Identifier id, bool inObject)
{
return new StructDeclaration(loc, id, inObject);
}
@@ -540,7 +540,7 @@ bool _isZeroInit(Expression exp)
*/
extern (C++) final class UnionDeclaration : StructDeclaration
{
- extern (D) this(const ref Loc loc, Identifier id)
+ extern (D) this(Loc loc, Identifier id)
{
super(loc, id, false);
}
diff --git a/gcc/d/dmd/dsymbol.d b/gcc/d/dmd/dsymbol.d
index 2f2c017..bad9ca2 100644
--- a/gcc/d/dmd/dsymbol.d
+++ b/gcc/d/dmd/dsymbol.d
@@ -285,7 +285,7 @@ extern (C++) class Dsymbol : ASTNode
this.ident = ident;
}
- final extern (D) this(const ref Loc loc, Identifier ident) nothrow @safe
+ final extern (D) this(Loc loc, Identifier ident) nothrow @safe
{
//printf("Dsymbol::Dsymbol(%p, ident)\n", this);
this.loc = loc;
@@ -701,7 +701,7 @@ extern (C++) class Dsymbol : ASTNode
* Returns:
* SIZE_INVALID when the size cannot be determined
*/
- uinteger_t size(const ref Loc loc)
+ uinteger_t size(Loc loc)
{
.error(loc, "%s `%s` symbol `%s` has no size", kind, toPrettyChars, toChars());
return SIZE_INVALID;
@@ -1099,7 +1099,7 @@ public:
super(ident);
}
- final extern (D) this(const ref Loc loc, Identifier ident) nothrow @safe
+ final extern (D) this(Loc loc, Identifier ident) nothrow @safe
{
super(loc, ident);
}
@@ -1241,7 +1241,7 @@ public:
return (members is null);
}
- static void multiplyDefined(const ref Loc loc, Dsymbol s1, Dsymbol s2)
+ static void multiplyDefined(Loc loc, Dsymbol s1, Dsymbol s2)
{
version (none)
{
@@ -1559,7 +1559,7 @@ extern (C++) final class AliasAssign : Dsymbol
Dsymbol aliassym; /// replace previous RHS of AliasDeclaration with `aliassym`
/// only one of type and aliassym can be != null
- extern (D) this(const ref Loc loc, Identifier ident, Type type, Dsymbol aliassym) nothrow @safe
+ extern (D) this(Loc loc, Identifier ident, Type type, Dsymbol aliassym) nothrow @safe
{
super(loc, null);
this.ident = ident;
diff --git a/gcc/d/dmd/dsymbol.h b/gcc/d/dmd/dsymbol.h
index c83b8d1..6d223bf 100644
--- a/gcc/d/dmd/dsymbol.h
+++ b/gcc/d/dmd/dsymbol.h
@@ -220,7 +220,7 @@ public:
virtual Dsymbol *toAlias(); // resolve real symbol
virtual Dsymbol *toAlias2();
virtual bool overloadInsert(Dsymbol *s);
- virtual uinteger_t size(const Loc &loc);
+ virtual uinteger_t size(Loc loc);
virtual bool isforwardRef();
virtual AggregateDeclaration *isThis(); // is a 'this' required to access the member
virtual bool isExport() const; // is Dsymbol exported?
@@ -329,7 +329,7 @@ public:
virtual void importScope(Dsymbol *s, Visibility visibility);
virtual bool isPackageAccessible(Package *p, Visibility visibility, SearchOptFlags flags = (SearchOptFlags)SearchOpt::all);
bool isforwardRef() override final;
- static void multiplyDefined(const Loc &loc, Dsymbol *s1, Dsymbol *s2);
+ static void multiplyDefined(Loc loc, Dsymbol *s1, Dsymbol *s2);
const char *kind() const override;
virtual Dsymbol *symtabInsert(Dsymbol *s);
virtual Dsymbol *symtabLookup(Dsymbol *s, Identifier *id);
@@ -429,7 +429,7 @@ public:
namespace dmd
{
void addMember(Dsymbol *dsym, Scope *sc, ScopeDsymbol *sds);
- Dsymbol *search(Dsymbol *d, const Loc &loc, Identifier *ident, SearchOptFlags flags = (SearchOptFlags)SearchOpt::localsOnly);
+ Dsymbol *search(Dsymbol *d, Loc loc, Identifier *ident, SearchOptFlags flags = (SearchOptFlags)SearchOpt::localsOnly);
Dsymbols *include(Dsymbol *d, Scope *sc);
void setScope(Dsymbol *d, Scope *sc);
void importAll(Dsymbol *d, Scope *sc);
diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d
index 378ef9a..3e7f9b9 100644
--- a/gcc/d/dmd/dsymbolsem.d
+++ b/gcc/d/dmd/dsymbolsem.d
@@ -174,7 +174,7 @@ const(char)* getMessage(DeprecatedDeclaration dd)
return dd.msgstr;
}
-bool checkDeprecated(Dsymbol d, const ref Loc loc, Scope* sc)
+bool checkDeprecated(Dsymbol d, Loc loc, Scope* sc)
{
if (global.params.useDeprecated == DiagnosticReporting.off)
return false;
@@ -211,7 +211,7 @@ bool checkDeprecated(Dsymbol d, const ref Loc loc, Scope* sc)
/*********************************
* Check type to see if it is based on a deprecated symbol.
*/
-private void checkDeprecated(Type type, const ref Loc loc, Scope* sc)
+private void checkDeprecated(Type type, Loc loc, Scope* sc)
{
if (Dsymbol s = type.toDsymbol(sc))
{
@@ -396,7 +396,7 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool find
* Returns:
* Whether the alias this was reported as deprecated.
*/
-private bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc)
+private bool checkDeprecatedAliasThis(AliasThis at, Loc loc, Scope* sc)
{
if (global.params.useDeprecated != DiagnosticReporting.off
&& at.isDeprecated() && !sc.isDeprecated())
@@ -1848,8 +1848,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
buf.writeByte(0);
const str = buf.extractSlice()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
- auto loc = adjustLocForMixin(str, cd.loc, global.params.mixinOut);
- scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ adjustLocForMixin(str, cd.loc, *p.baseLoc, global.params.mixinOut);
+ p.linnum = p.baseLoc.startLine;
p.nextToken();
auto d = p.parseDeclDefs(0);
@@ -5895,34 +5896,40 @@ private CallExp doAtomicOp (string op, Identifier var, Expression arg)
* Set up loc for a parse of a mixin. Append the input text to the mixin.
* Params:
* input = mixin text
- * loc = location to adjust
+ * loc = location of expansion
+ * baseLoc = location to adjust
* mixinOut = sink for mixin text data
* Returns:
* adjusted loc suitable for Parser
*/
-Loc adjustLocForMixin(const(char)[] input, ref const Loc loc, ref Output mixinOut)
+void adjustLocForMixin(const(char)[] input, Loc loc, ref BaseLoc baseLoc, ref Output mixinOut)
{
- Loc result;
if (mixinOut.doOutput)
{
const lines = mixinOut.bufferLines;
writeMixin(input, loc, mixinOut.bufferLines, *mixinOut.buffer);
- result = Loc(mixinOut.name.ptr, lines + 2, loc.charnum);
+ baseLoc.startLine = lines + 2;
+ baseLoc.filename = mixinOut.name;
+ return;
}
- else if (loc.filename)
+
+ SourceLoc sl = SourceLoc(loc);
+ if (sl.filename.length == 0)
{
- /* Create a pseudo-filename for the mixin string, as it may not even exist
- * in the source file.
- */
- auto len = strlen(loc.filename) + 7 + (loc.linnum).sizeof * 3 + 1;
- char* filename = cast(char*)mem.xmalloc(len);
- snprintf(filename, len, "%s-mixin-%d", loc.filename, cast(int)loc.linnum);
- result = Loc(filename, loc.linnum, loc.charnum);
+ // Rare case of compiler-generated mixin exp, e.g. __xtoHash
+ baseLoc.filename = "";
+ return;
}
- else
- result = loc;
- return result;
+
+ /* Create a pseudo-filename for the mixin string, as it may not even exist
+ * in the source file.
+ */
+ auto len = sl.filename.length + 7 + (sl.linnum).sizeof * 3 + 1;
+ char* filename = cast(char*) mem.xmalloc(len);
+ snprintf(filename, len, "%.*s-mixin-%d", cast(int) sl.filename.length, sl.filename.ptr, cast(int) sl.linnum);
+ baseLoc.startLine = sl.line;
+ baseLoc.filename = filename.toDString;
}
/**************************************
@@ -5934,7 +5941,7 @@ Loc adjustLocForMixin(const(char)[] input, ref const Loc loc, ref Output mixinOu
* lines = line count to update
* output = sink for output
*/
-private void writeMixin(const(char)[] s, ref const Loc loc, ref int lines, ref OutBuffer buf)
+private void writeMixin(const(char)[] s, Loc loc, ref int lines, ref OutBuffer buf)
{
buf.writestring("// expansion at ");
buf.writestring(loc.toChars());
@@ -5981,7 +5988,7 @@ private void writeMixin(const(char)[] s, ref const Loc loc, ref int lines, ref O
* Returns:
* null if not found
*/
-Dsymbol search(Dsymbol d, const ref Loc loc, Identifier ident, SearchOptFlags flags = SearchOpt.all)
+Dsymbol search(Dsymbol d, Loc loc, Identifier ident, SearchOptFlags flags = SearchOpt.all)
{
scope v = new SearchVisitor(loc, ident, flags);
d.accept(v);
@@ -6028,7 +6035,7 @@ private extern(C++) class SearchVisitor : Visitor
SearchOptFlags flags;
Dsymbol result;
- this(const ref Loc loc, Identifier ident, SearchOptFlags flags) @safe
+ this(Loc loc, Identifier ident, SearchOptFlags flags) @safe
{
this.loc = loc;
this.ident = ident;
@@ -6244,7 +6251,7 @@ private extern(C++) class SearchVisitor : Visitor
VarDeclaration* pvar;
Expression ce;
- static Dsymbol dollarFromTypeTuple(const ref Loc loc, TypeTuple tt, Scope* sc)
+ static Dsymbol dollarFromTypeTuple(Loc loc, TypeTuple tt, Scope* sc)
{
/* $ gives the number of type entries in the type tuple
@@ -7827,7 +7834,7 @@ private Expression callScopeDtor(VarDeclaration vd, Scope* sc)
* Returns:
* false if failed to determine the size.
*/
-bool determineSize(AggregateDeclaration ad, const ref Loc loc)
+bool determineSize(AggregateDeclaration ad, Loc loc)
{
//printf("AggregateDeclaration::determineSize() %s, sizeok = %d\n", toChars(), sizeok);
diff --git a/gcc/d/dmd/dtemplate.d b/gcc/d/dmd/dtemplate.d
index 296c10c..1aab94d 100644
--- a/gcc/d/dmd/dtemplate.d
+++ b/gcc/d/dmd/dtemplate.d
@@ -595,7 +595,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
Array!Expression lastConstraintNegs; /// its negative parts
Objects* lastConstraintTiargs; /// template instance arguments for `lastConstraint`
- extern (D) this(const ref Loc loc, Identifier ident, TemplateParameters* parameters, Expression constraint, Dsymbols* decldefs, bool ismixin = false, bool literal = false)
+ extern (D) this(Loc loc, Identifier ident, TemplateParameters* parameters, Expression constraint, Dsymbols* decldefs, bool ismixin = false, bool literal = false)
{
super(loc, ident);
static if (LOG)
@@ -3171,7 +3171,7 @@ extern (C++) class TemplateParameter : ASTNode
bool dependent;
/* ======================== TemplateParameter =============================== */
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
this.loc = loc;
this.ident = ident;
@@ -3210,7 +3210,7 @@ extern (C++) class TemplateParameter : ASTNode
abstract RootObject specialization();
- abstract RootObject defaultArg(const ref Loc instLoc, Scope* sc);
+ abstract RootObject defaultArg(Loc instLoc, Scope* sc);
abstract bool hasDefaultArg();
@@ -3242,7 +3242,7 @@ extern (C++) class TemplateTypeParameter : TemplateParameter
extern (D) __gshared Type tdummy = null;
- extern (D) this(const ref Loc loc, Identifier ident, Type specType, Type defaultType) @safe
+ extern (D) this(Loc loc, Identifier ident, Type specType, Type defaultType) @safe
{
super(loc, ident);
this.specType = specType;
@@ -3288,7 +3288,7 @@ extern (C++) class TemplateTypeParameter : TemplateParameter
return specType;
}
- override final RootObject defaultArg(const ref Loc instLoc, Scope* sc)
+ override final RootObject defaultArg(Loc instLoc, Scope* sc)
{
Type t = defaultType;
if (t)
@@ -3317,7 +3317,7 @@ extern (C++) class TemplateTypeParameter : TemplateParameter
*/
extern (C++) final class TemplateThisParameter : TemplateTypeParameter
{
- extern (D) this(const ref Loc loc, Identifier ident, Type specType, Type defaultType) @safe
+ extern (D) this(Loc loc, Identifier ident, Type specType, Type defaultType) @safe
{
super(loc, ident, specType, defaultType);
}
@@ -3351,7 +3351,7 @@ extern (C++) final class TemplateValueParameter : TemplateParameter
extern (D) __gshared Expression[void*] edummies;
- extern (D) this(const ref Loc loc, Identifier ident, Type valType,
+ extern (D) this(Loc loc, Identifier ident, Type valType,
Expression specValue, Expression defaultValue) @safe
{
super(loc, ident);
@@ -3408,7 +3408,7 @@ extern (C++) final class TemplateValueParameter : TemplateParameter
return specValue;
}
- override RootObject defaultArg(const ref Loc instLoc, Scope* sc)
+ override RootObject defaultArg(Loc instLoc, Scope* sc)
{
Expression e = defaultValue;
if (!e)
@@ -3467,7 +3467,7 @@ extern (C++) final class TemplateAliasParameter : TemplateParameter
extern (D) __gshared Dsymbol sdummy = null;
- extern (D) this(const ref Loc loc, Identifier ident, Type specType, RootObject specAlias, RootObject defaultAlias) @safe
+ extern (D) this(Loc loc, Identifier ident, Type specType, RootObject specAlias, RootObject defaultAlias) @safe
{
super(loc, ident);
this.specType = specType;
@@ -3505,7 +3505,7 @@ extern (C++) final class TemplateAliasParameter : TemplateParameter
return specAlias;
}
- override RootObject defaultArg(const ref Loc instLoc, Scope* sc)
+ override RootObject defaultArg(Loc instLoc, Scope* sc)
{
RootObject da = defaultAlias;
if (auto ta = isType(defaultAlias))
@@ -3546,7 +3546,7 @@ extern (C++) final class TemplateAliasParameter : TemplateParameter
*/
extern (C++) final class TemplateTupleParameter : TemplateParameter
{
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, ident);
}
@@ -3600,7 +3600,7 @@ extern (C++) final class TemplateTupleParameter : TemplateParameter
return null;
}
- override RootObject defaultArg(const ref Loc instLoc, Scope* sc)
+ override RootObject defaultArg(Loc instLoc, Scope* sc)
{
return null;
}
@@ -3724,7 +3724,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
}
}
- extern (D) this(const ref Loc loc, Identifier ident, Objects* tiargs) scope
+ extern (D) this(Loc loc, Identifier ident, Objects* tiargs) scope
{
super(loc, null);
static if (LOG)
@@ -3739,7 +3739,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
* This constructor is only called when we figured out which function
* template to instantiate.
*/
- extern (D) this(const ref Loc loc, TemplateDeclaration td, Objects* tiargs) scope
+ extern (D) this(Loc loc, TemplateDeclaration td, Objects* tiargs) scope
{
super(loc, null);
static if (LOG)
@@ -4477,7 +4477,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
* Returns:
* false if one or more arguments have errors.
*/
- extern (D) static bool semanticTiargs(const ref Loc loc, Scope* sc, Objects* tiargs, int flags, TupleDeclaration atd = null)
+ extern (D) static bool semanticTiargs(Loc loc, Scope* sc, Objects* tiargs, int flags, TupleDeclaration atd = null)
{
// Run semantic on each argument, place results in tiargs[]
//printf("+TemplateInstance.semanticTiargs()\n");
@@ -5477,7 +5477,7 @@ extern (C++) final class TemplateMixin : TemplateInstance
{
TypeQualified tqual;
- extern (D) this(const ref Loc loc, Identifier ident, TypeQualified tqual, Objects* tiargs)
+ extern (D) this(Loc loc, Identifier ident, TypeQualified tqual, Objects* tiargs)
{
super(loc,
tqual.idents.length ? cast(Identifier)tqual.idents[tqual.idents.length - 1] : (cast(TypeIdentifier)tqual).ident,
diff --git a/gcc/d/dmd/dversion.d b/gcc/d/dmd/dversion.d
index d8c8b24..5fd740f 100644
--- a/gcc/d/dmd/dversion.d
+++ b/gcc/d/dmd/dversion.d
@@ -32,12 +32,12 @@ import dmd.visitor;
*/
extern (C++) final class DebugSymbol : Dsymbol
{
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, ident);
}
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, null);
}
@@ -73,12 +73,12 @@ extern (C++) final class DebugSymbol : Dsymbol
extern (C++) final class VersionSymbol : Dsymbol
{
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, ident);
}
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, null);
}
diff --git a/gcc/d/dmd/enum.h b/gcc/d/dmd/enum.h
index 4e6fbe2..a51c50c 100644
--- a/gcc/d/dmd/enum.h
+++ b/gcc/d/dmd/enum.h
@@ -20,7 +20,7 @@ class Expression;
namespace dmd
{
// in enumsem.d
- Expression *getDefaultValue(EnumDeclaration *ed, const Loc &loc);
+ Expression *getDefaultValue(EnumDeclaration *ed, Loc loc);
}
class EnumDeclaration final : public ScopeDsymbol
diff --git a/gcc/d/dmd/enumsem.d b/gcc/d/dmd/enumsem.d
index e22bdba..cd49d29 100644
--- a/gcc/d/dmd/enumsem.d
+++ b/gcc/d/dmd/enumsem.d
@@ -347,7 +347,7 @@ void enumSemantic(Scope* sc, EnumDeclaration ed)
//printf("members = %s\n", members.toChars());
}
-Expression getDefaultValue(EnumDeclaration ed, const ref Loc loc)
+Expression getDefaultValue(EnumDeclaration ed, Loc loc)
{
Expression handleErrors(){
ed.defaultval = ErrorExp.get();
@@ -399,7 +399,7 @@ Expression getDefaultValue(EnumDeclaration ed, const ref Loc loc)
return handleErrors();
}
-Type getMemtype(EnumDeclaration ed, const ref Loc loc)
+Type getMemtype(EnumDeclaration ed, Loc loc)
{
if (ed._scope)
{
diff --git a/gcc/d/dmd/errors.d b/gcc/d/dmd/errors.d
index ddab8a8..822cdfa 100644
--- a/gcc/d/dmd/errors.d
+++ b/gcc/d/dmd/errors.d
@@ -16,6 +16,7 @@ public import dmd.root.string: fTuple;
import dmd.errorsink;
import dmd.globals;
import dmd.location;
+import dmd.root.string;
nothrow:
@@ -38,37 +39,37 @@ class ErrorSinkCompiler : ErrorSink
extern (C++):
override:
- void verror(const ref Loc loc, const(char)* format, va_list ap)
+ void verror(Loc loc, const(char)* format, va_list ap)
{
verrorReport(loc, format, ap, ErrorKind.error);
}
- void verrorSupplemental(const ref Loc loc, const(char)* format, va_list ap)
+ void verrorSupplemental(Loc loc, const(char)* format, va_list ap)
{
verrorReportSupplemental(loc, format, ap, ErrorKind.error);
}
- void vwarning(const ref Loc loc, const(char)* format, va_list ap)
+ void vwarning(Loc loc, const(char)* format, va_list ap)
{
verrorReport(loc, format, ap, ErrorKind.warning);
}
- void vwarningSupplemental(const ref Loc loc, const(char)* format, va_list ap)
+ void vwarningSupplemental(Loc loc, const(char)* format, va_list ap)
{
verrorReportSupplemental(loc, format, ap, ErrorKind.warning);
}
- void vdeprecation(const ref Loc loc, const(char)* format, va_list ap)
+ void vdeprecation(Loc loc, const(char)* format, va_list ap)
{
verrorReport(loc, format, ap, ErrorKind.deprecation);
}
- void vdeprecationSupplemental(const ref Loc loc, const(char)* format, va_list ap)
+ void vdeprecationSupplemental(Loc loc, const(char)* format, va_list ap)
{
verrorReportSupplemental(loc, format, ap, ErrorKind.deprecation);
}
- void vmessage(const ref Loc loc, const(char)* format, va_list ap)
+ void vmessage(Loc loc, const(char)* format, va_list ap)
{
verrorReport(loc, format, ap, ErrorKind.message);
}
@@ -110,9 +111,9 @@ enum Color : int
static if (__VERSION__ < 2092)
- private extern (C++) void noop(const ref Loc loc, const(char)* format, ...) {}
+ private extern (C++) void noop(Loc loc, const(char)* format, ...) {}
else
- pragma(printf) private extern (C++) void noop(const ref Loc loc, const(char)* format, ...) {}
+ pragma(printf) private extern (C++) void noop(Loc loc, const(char)* format, ...) {}
package auto previewErrorFunc(bool isDeprecated, FeatureState featureState) @safe @nogc pure nothrow
@@ -154,7 +155,7 @@ package auto previewSupplementalFunc(bool isDeprecated, FeatureState featureStat
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void error(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void error(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -162,7 +163,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void error(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void error(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -182,7 +183,7 @@ else
static if (__VERSION__ < 2092)
extern (C++) void error(const(char)* filename, uint linnum, uint charnum, const(char)* format, ...)
{
- const loc = Loc(filename, linnum, charnum);
+ const loc = SourceLoc(filename.toDString, linnum, charnum);
va_list ap;
va_start(ap, format);
verrorReport(loc, format, ap, ErrorKind.error);
@@ -191,7 +192,7 @@ static if (__VERSION__ < 2092)
else
pragma(printf) extern (C++) void error(const(char)* filename, uint linnum, uint charnum, const(char)* format, ...)
{
- const loc = Loc(filename, linnum, charnum);
+ const loc = SourceLoc(filename.toDString, linnum, charnum);
va_list ap;
va_start(ap, format);
verrorReport(loc, format, ap, ErrorKind.error);
@@ -201,7 +202,7 @@ else
/// Callback for when the backend wants to report an error
extern(C++) void errorBackend(const(char)* filename, uint linnum, uint charnum, const(char)* format, ...)
{
- const loc = Loc(filename, linnum, charnum);
+ const loc = SourceLoc(filename.toDString, linnum, charnum);
va_list ap;
va_start(ap, format);
verrorReport(loc, format, ap, ErrorKind.error);
@@ -217,7 +218,7 @@ extern(C++) void errorBackend(const(char)* filename, uint linnum, uint charnum,
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void errorSupplemental(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void errorSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -225,7 +226,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void errorSupplemental(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void errorSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -241,7 +242,7 @@ else
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void warning(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void warning(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -249,7 +250,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void warning(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void warning(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -266,7 +267,7 @@ else
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void warningSupplemental(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void warningSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -274,7 +275,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void warningSupplemental(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void warningSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -291,7 +292,7 @@ else
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void deprecation(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void deprecation(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -299,7 +300,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void deprecation(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void deprecation(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -316,7 +317,7 @@ else
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void deprecationSupplemental(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void deprecationSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -324,7 +325,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void deprecationSupplemental(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void deprecationSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -341,7 +342,7 @@ else
* ... = printf-style variadic arguments
*/
static if (__VERSION__ < 2092)
- extern (C++) void message(const ref Loc loc, const(char)* format, ...)
+ extern (C++) void message(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -349,7 +350,7 @@ static if (__VERSION__ < 2092)
va_end(ap);
}
else
- pragma(printf) extern (C++) void message(const ref Loc loc, const(char)* format, ...)
+ pragma(printf) extern (C++) void message(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -431,7 +432,10 @@ else
* p1 = additional message prefix
* p2 = additional message prefix
*/
-private extern(C++) void verrorReport(const ref Loc loc, const(char)* format, va_list ap, ErrorKind kind, const(char)* p1 = null, const(char)* p2 = null);
+private extern(C++) void verrorReport(Loc loc, const(char)* format, va_list ap, ErrorKind kind, const(char)* p1 = null, const(char)* p2 = null)
+{
+ return verrorReport(loc.SourceLoc, format, ap, kind, p1, p2);
+}
/// ditto
private extern(C++) void verrorReport(const SourceLoc loc, const(char)* format, va_list ap, ErrorKind kind, const(char)* p1 = null, const(char)* p2 = null);
@@ -447,7 +451,10 @@ private extern(C++) void verrorReport(const SourceLoc loc, const(char)* format,
* ap = printf-style variadic arguments
* kind = kind of error being printed
*/
-private extern(C++) void verrorReportSupplemental(const ref Loc loc, const(char)* format, va_list ap, ErrorKind kind);
+private extern(C++) void verrorReportSupplemental(Loc loc, const(char)* format, va_list ap, ErrorKind kind)
+{
+ return verrorReportSupplemental(loc.SourceLoc, format, ap, kind);
+}
/// ditto
private extern(C++) void verrorReportSupplemental(const SourceLoc loc, const(char)* format, va_list ap, ErrorKind kind);
diff --git a/gcc/d/dmd/errors.h b/gcc/d/dmd/errors.h
index 448a4f6..013244c 100644
--- a/gcc/d/dmd/errors.h
+++ b/gcc/d/dmd/errors.h
@@ -31,15 +31,15 @@ enum class ErrorKind
#endif
// Print a warning, deprecation, or error, accepts printf-like format specifiers.
-D_ATTRIBUTE_FORMAT(2, 3) void warning(const Loc& loc, const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void warningSupplemental(const Loc& loc, const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void deprecation(const Loc& loc, const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void deprecationSupplemental(const Loc& loc, const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void error(const Loc& loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void warning(Loc loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void warningSupplemental(Loc loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void deprecation(Loc loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void deprecationSupplemental(Loc loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void error(Loc loc, const char *format, ...);
D_ATTRIBUTE_FORMAT(4, 5) void error(const char *filename, unsigned linnum, unsigned charnum, const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void errorSupplemental(const Loc& loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void errorSupplemental(Loc loc, const char *format, ...);
D_ATTRIBUTE_FORMAT(1, 2) void message(const char *format, ...);
-D_ATTRIBUTE_FORMAT(2, 3) void message(const Loc& loc, const char *format, ...);
+D_ATTRIBUTE_FORMAT(2, 3) void message(Loc loc, const char *format, ...);
D_ATTRIBUTE_FORMAT(1, 2) void tip(const char *format, ...);
#if defined(__GNUC__) || defined(__clang__)
diff --git a/gcc/d/dmd/errorsink.d b/gcc/d/dmd/errorsink.d
index 9884112..58a0ec3 100644
--- a/gcc/d/dmd/errorsink.d
+++ b/gcc/d/dmd/errorsink.d
@@ -23,15 +23,15 @@ abstract class ErrorSink
nothrow:
extern (C++):
- void verror(const ref Loc loc, const(char)* format, va_list ap);
- void verrorSupplemental(const ref Loc loc, const(char)* format, va_list ap);
- void vwarning(const ref Loc loc, const(char)* format, va_list ap);
- void vwarningSupplemental(const ref Loc loc, const(char)* format, va_list ap);
- void vmessage(const ref Loc loc, const(char)* format, va_list ap);
- void vdeprecation(const ref Loc loc, const(char)* format, va_list ap);
- void vdeprecationSupplemental(const ref Loc loc, const(char)* format, va_list ap);
-
- void error(const ref Loc loc, const(char)* format, ...)
+ void verror(Loc loc, const(char)* format, va_list ap);
+ void verrorSupplemental(Loc loc, const(char)* format, va_list ap);
+ void vwarning(Loc loc, const(char)* format, va_list ap);
+ void vwarningSupplemental(Loc loc, const(char)* format, va_list ap);
+ void vmessage(Loc loc, const(char)* format, va_list ap);
+ void vdeprecation(Loc loc, const(char)* format, va_list ap);
+ void vdeprecationSupplemental(Loc loc, const(char)* format, va_list ap);
+
+ void error(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -39,7 +39,7 @@ abstract class ErrorSink
va_end(ap);
}
- void errorSupplemental(const ref Loc loc, const(char)* format, ...)
+ void errorSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -47,7 +47,7 @@ abstract class ErrorSink
va_end(ap);
}
- void warning(const ref Loc loc, const(char)* format, ...)
+ void warning(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -55,7 +55,7 @@ abstract class ErrorSink
va_end(ap);
}
- void warningSupplemental(const ref Loc loc, const(char)* format, ...)
+ void warningSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -63,7 +63,7 @@ abstract class ErrorSink
va_end(ap);
}
- void message(const ref Loc loc, const(char)* format, ...)
+ void message(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -71,7 +71,7 @@ abstract class ErrorSink
va_end(ap);
}
- void deprecation(const ref Loc loc, const(char)* format, ...)
+ void deprecation(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -79,7 +79,7 @@ abstract class ErrorSink
va_end(ap);
}
- void deprecationSupplemental(const ref Loc loc, const(char)* format, ...)
+ void deprecationSupplemental(Loc loc, const(char)* format, ...)
{
va_list ap;
va_start(ap, format);
@@ -106,19 +106,19 @@ class ErrorSinkNull : ErrorSink
extern (C++):
override:
- void verror(const ref Loc loc, const(char)* format, va_list ap) { }
+ void verror(Loc loc, const(char)* format, va_list ap) { }
- void verrorSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void verrorSupplemental(Loc loc, const(char)* format, va_list ap) { }
- void vwarning(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vwarning(Loc loc, const(char)* format, va_list ap) { }
- void vwarningSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vwarningSupplemental(Loc loc, const(char)* format, va_list ap) { }
- void vmessage(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vmessage(Loc loc, const(char)* format, va_list ap) { }
- void vdeprecation(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vdeprecation(Loc loc, const(char)* format, va_list ap) { }
- void vdeprecationSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vdeprecationSupplemental(Loc loc, const(char)* format, va_list ap) { }
}
/*****************************************
@@ -132,7 +132,7 @@ class ErrorSinkLatch : ErrorSinkNull
bool sawErrors;
- void verror(const ref Loc loc, const(char)* format, va_list ap) { sawErrors = true; }
+ void verror(Loc loc, const(char)* format, va_list ap) { sawErrors = true; }
}
/*****************************************
@@ -148,7 +148,7 @@ class ErrorSinkStderr : ErrorSink
extern (C++):
override:
- void verror(const ref Loc loc, const(char)* format, va_list ap)
+ void verror(Loc loc, const(char)* format, va_list ap)
{
fputs("Error: ", stderr);
const p = loc.toChars();
@@ -162,9 +162,9 @@ class ErrorSinkStderr : ErrorSink
fputc('\n', stderr);
}
- void verrorSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void verrorSupplemental(Loc loc, const(char)* format, va_list ap) { }
- void vwarning(const ref Loc loc, const(char)* format, va_list ap)
+ void vwarning(Loc loc, const(char)* format, va_list ap)
{
fputs("Warning: ", stderr);
const p = loc.toChars();
@@ -178,9 +178,9 @@ class ErrorSinkStderr : ErrorSink
fputc('\n', stderr);
}
- void vwarningSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vwarningSupplemental(Loc loc, const(char)* format, va_list ap) { }
- void vdeprecation(const ref Loc loc, const(char)* format, va_list ap)
+ void vdeprecation(Loc loc, const(char)* format, va_list ap)
{
fputs("Deprecation: ", stderr);
const p = loc.toChars();
@@ -194,7 +194,7 @@ class ErrorSinkStderr : ErrorSink
fputc('\n', stderr);
}
- void vmessage(const ref Loc loc, const(char)* format, va_list ap)
+ void vmessage(Loc loc, const(char)* format, va_list ap)
{
const p = loc.toChars();
if (*p)
@@ -207,5 +207,5 @@ class ErrorSinkStderr : ErrorSink
fputc('\n', stderr);
}
- void vdeprecationSupplemental(const ref Loc loc, const(char)* format, va_list ap) { }
+ void vdeprecationSupplemental(Loc loc, const(char)* format, va_list ap) { }
}
diff --git a/gcc/d/dmd/expression.d b/gcc/d/dmd/expression.d
index c8e7309..6827612 100644
--- a/gcc/d/dmd/expression.d
+++ b/gcc/d/dmd/expression.d
@@ -203,7 +203,7 @@ TemplateDeclaration getFuncTemplateDecl(Dsymbol s) @safe
* (foo).size
* cast(foo).size
*/
-DotIdExp typeDotIdExp(const ref Loc loc, Type type, Identifier ident) @safe
+DotIdExp typeDotIdExp(Loc loc, Type type, Identifier ident) @safe
{
return new DotIdExp(loc, new TypeExp(loc, type), ident);
}
@@ -310,7 +310,7 @@ extern (C++) abstract class Expression : ASTNode
import dmd.common.bitfields;
mixin(generateBitFields!(BitFields, ubyte));
- extern (D) this(const ref Loc loc, EXP op) scope @safe
+ extern (D) this(Loc loc, EXP op) scope @safe
{
//printf("Expression::Expression(op = %d) this = %p\n", op, this);
this.loc = loc;
@@ -757,7 +757,7 @@ extern (C++) final class IntegerExp : Expression
{
private dinteger_t value;
- extern (D) this(const ref Loc loc, dinteger_t value, Type type)
+ extern (D) this(Loc loc, dinteger_t value, Type type)
{
super(loc, EXP.int64);
//printf("IntegerExp(value = %lld, type = '%s')\n", value, type ? type.toChars() : "");
@@ -780,7 +780,7 @@ extern (C++) final class IntegerExp : Expression
this.value = cast(int)value;
}
- static IntegerExp create(const ref Loc loc, dinteger_t value, Type type)
+ static IntegerExp create(Loc loc, dinteger_t value, Type type)
{
return new IntegerExp(loc, value, type);
}
@@ -1021,7 +1021,7 @@ extern (C++) final class RealExp : Expression
{
real_t value;
- extern (D) this(const ref Loc loc, real_t value, Type type) @safe
+ extern (D) this(Loc loc, real_t value, Type type) @safe
{
super(loc, EXP.float64);
//printf("RealExp::RealExp(%Lg)\n", value);
@@ -1029,7 +1029,7 @@ extern (C++) final class RealExp : Expression
this.type = type;
}
- static RealExp create(const ref Loc loc, real_t value, Type type) @safe
+ static RealExp create(Loc loc, real_t value, Type type) @safe
{
return new RealExp(loc, value, type);
}
@@ -1113,7 +1113,7 @@ extern (C++) final class ComplexExp : Expression
{
complex_t value;
- extern (D) this(const ref Loc loc, complex_t value, Type type) @safe
+ extern (D) this(Loc loc, complex_t value, Type type) @safe
{
super(loc, EXP.complex80);
this.value = value;
@@ -1121,7 +1121,7 @@ extern (C++) final class ComplexExp : Expression
//printf("ComplexExp::ComplexExp(%s)\n", toChars());
}
- static ComplexExp create(const ref Loc loc, complex_t value, Type type) @safe
+ static ComplexExp create(Loc loc, complex_t value, Type type) @safe
{
return new ComplexExp(loc, value, type);
}
@@ -1200,13 +1200,13 @@ extern (C++) class IdentifierExp : Expression
{
Identifier ident;
- extern (D) this(const ref Loc loc, Identifier ident) scope @safe
+ extern (D) this(Loc loc, Identifier ident) scope @safe
{
super(loc, EXP.identifier);
this.ident = ident;
}
- static IdentifierExp create(const ref Loc loc, Identifier ident) @safe
+ static IdentifierExp create(Loc loc, Identifier ident) @safe
{
return new IdentifierExp(loc, ident);
}
@@ -1229,7 +1229,7 @@ extern (C++) class IdentifierExp : Expression
*/
extern (C++) final class DollarExp : IdentifierExp
{
- extern (D) this(const ref Loc loc)
+ extern (D) this(Loc loc)
{
super(loc, Id.dollar);
}
@@ -1248,7 +1248,7 @@ extern (C++) final class DsymbolExp : Expression
Dsymbol s;
bool hasOverloads;
- extern (D) this(const ref Loc loc, Dsymbol s, bool hasOverloads = true) @safe
+ extern (D) this(Loc loc, Dsymbol s, bool hasOverloads = true) @safe
{
super(loc, EXP.dSymbol);
this.s = s;
@@ -1273,13 +1273,13 @@ extern (C++) class ThisExp : Expression
{
VarDeclaration var;
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.this_);
//printf("ThisExp::ThisExp() loc = %d\n", loc.linnum);
}
- this(const ref Loc loc, const EXP tok) @safe
+ this(Loc loc, const EXP tok) @safe
{
super(loc, tok);
//printf("ThisExp::ThisExp() loc = %d\n", loc.linnum);
@@ -1317,7 +1317,7 @@ extern (C++) class ThisExp : Expression
*/
extern (C++) final class SuperExp : ThisExp
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.super_);
}
@@ -1335,7 +1335,7 @@ extern (C++) final class SuperExp : ThisExp
*/
extern (C++) final class NullExp : Expression
{
- extern (D) this(const ref Loc loc, Type type = null) scope @safe
+ extern (D) this(Loc loc, Type type = null) scope @safe
{
super(loc, EXP.null_);
this.type = type;
@@ -1409,7 +1409,7 @@ extern (C++) final class StringExp : Expression
enum char NoPostfix = 0;
- extern (D) this(const ref Loc loc, const(void)[] string) scope
+ extern (D) this(Loc loc, const(void)[] string) scope
{
super(loc, EXP.string_);
this.string = cast(char*)string.ptr; // note that this.string should be const
@@ -1417,7 +1417,7 @@ extern (C++) final class StringExp : Expression
this.sz = 1; // work around LDC bug #1286
}
- extern (D) this(const ref Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix = NoPostfix) scope
+ extern (D) this(Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix = NoPostfix) scope
{
super(loc, EXP.string_);
this.string = cast(char*)string.ptr; // note that this.string should be const
@@ -1426,12 +1426,12 @@ extern (C++) final class StringExp : Expression
this.postfix = postfix;
}
- static StringExp create(const ref Loc loc, const(char)* s)
+ static StringExp create(Loc loc, const(char)* s)
{
return new StringExp(loc, s.toDString());
}
- static StringExp create(const ref Loc loc, const(void)* string, size_t len)
+ static StringExp create(Loc loc, const(void)* string, size_t len)
{
return new StringExp(loc, string[0 .. len]);
}
@@ -1763,7 +1763,7 @@ extern (C++) final class InterpExp : Expression
enum char NoPostfix = 0;
- extern (D) this(const ref Loc loc, InterpolatedSet* set, char postfix = NoPostfix) scope @safe
+ extern (D) this(Loc loc, InterpolatedSet* set, char postfix = NoPostfix) scope @safe
{
super(loc, EXP.interpolated);
this.interpolatedSet = set;
@@ -1798,7 +1798,7 @@ extern (C++) final class TupleExp : Expression
Expressions* exps;
- extern (D) this(const ref Loc loc, Expression e0, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expression e0, Expressions* exps) @safe
{
super(loc, EXP.tuple);
//printf("TupleExp(this = %p)\n", this);
@@ -1806,14 +1806,14 @@ extern (C++) final class TupleExp : Expression
this.exps = exps;
}
- extern (D) this(const ref Loc loc, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expressions* exps) @safe
{
super(loc, EXP.tuple);
//printf("TupleExp(this = %p)\n", this);
this.exps = exps;
}
- extern (D) this(const ref Loc loc, TupleDeclaration tup)
+ extern (D) this(Loc loc, TupleDeclaration tup)
{
super(loc, EXP.tuple);
this.exps = new Expressions();
@@ -1847,7 +1847,7 @@ extern (C++) final class TupleExp : Expression
}
}
- static TupleExp create(const ref Loc loc, Expressions* exps) @safe
+ static TupleExp create(Loc loc, Expressions* exps) @safe
{
return new TupleExp(loc, exps);
}
@@ -1903,14 +1903,14 @@ extern (C++) final class ArrayLiteralExp : Expression
Expressions* elements;
- extern (D) this(const ref Loc loc, Type type, Expressions* elements) @safe
+ extern (D) this(Loc loc, Type type, Expressions* elements) @safe
{
super(loc, EXP.arrayLiteral);
this.type = type;
this.elements = elements;
}
- extern (D) this(const ref Loc loc, Type type, Expression e)
+ extern (D) this(Loc loc, Type type, Expression e)
{
super(loc, EXP.arrayLiteral);
this.type = type;
@@ -1918,7 +1918,7 @@ extern (C++) final class ArrayLiteralExp : Expression
elements.push(e);
}
- extern (D) this(const ref Loc loc, Type type, Expression basis, Expressions* elements) @safe
+ extern (D) this(Loc loc, Type type, Expression basis, Expressions* elements) @safe
{
super(loc, EXP.arrayLiteral);
this.type = type;
@@ -1926,7 +1926,7 @@ extern (C++) final class ArrayLiteralExp : Expression
this.elements = elements;
}
- static ArrayLiteralExp create(const ref Loc loc, Expressions* elements) @safe
+ static ArrayLiteralExp create(Loc loc, Expressions* elements) @safe
{
return new ArrayLiteralExp(loc, null, elements);
}
@@ -2059,7 +2059,7 @@ extern (C++) final class AssocArrayLiteralExp : Expression
/// Lower to core.internal.newaa for static initializaton
Expression lowering;
- extern (D) this(const ref Loc loc, Expressions* keys, Expressions* values) @safe
+ extern (D) this(Loc loc, Expressions* keys, Expressions* values) @safe
{
super(loc, EXP.assocArrayLiteral);
assert(keys.length == values.length);
@@ -2166,7 +2166,7 @@ extern (C++) final class StructLiteralExp : Expression
toCBuffer = 0x20 /// toCBuffer is running
}
- extern (D) this(const ref Loc loc, StructDeclaration sd, Expressions* elements, Type stype = null) @safe
+ extern (D) this(Loc loc, StructDeclaration sd, Expressions* elements, Type stype = null) @safe
{
super(loc, EXP.structLiteral);
this.sd = sd;
@@ -2178,7 +2178,7 @@ extern (C++) final class StructLiteralExp : Expression
//printf("StructLiteralExp::StructLiteralExp(%s)\n", toChars());
}
- static StructLiteralExp create(const ref Loc loc, StructDeclaration sd, void* elements, Type stype = null)
+ static StructLiteralExp create(Loc loc, StructDeclaration sd, void* elements, Type stype = null)
{
return new StructLiteralExp(loc, sd, cast(Expressions*)elements, stype);
}
@@ -2309,7 +2309,7 @@ extern (C++) final class CompoundLiteralExp : Expression
{
Initializer initializer; /// initializer-list
- extern (D) this(const ref Loc loc, Type type_name, Initializer initializer) @safe
+ extern (D) this(Loc loc, Type type_name, Initializer initializer) @safe
{
super(loc, EXP.compoundLiteral);
super.type = type_name;
@@ -2328,7 +2328,7 @@ extern (C++) final class CompoundLiteralExp : Expression
*/
extern (C++) final class TypeExp : Expression
{
- extern (D) this(const ref Loc loc, Type type) @safe
+ extern (D) this(Loc loc, Type type) @safe
{
super(loc, EXP.type);
//printf("TypeExp::TypeExp(%s)\n", type.toChars());
@@ -2364,7 +2364,7 @@ extern (C++) final class ScopeExp : Expression
{
ScopeDsymbol sds;
- extern (D) this(const ref Loc loc, ScopeDsymbol sds) @safe
+ extern (D) this(Loc loc, ScopeDsymbol sds) @safe
{
super(loc, EXP.scope_);
//printf("ScopeExp::ScopeExp(sds = '%s')\n", sds.toChars());
@@ -2413,7 +2413,7 @@ extern (C++) final class TemplateExp : Expression
TemplateDeclaration td;
FuncDeclaration fd;
- extern (D) this(const ref Loc loc, TemplateDeclaration td, FuncDeclaration fd = null) @safe
+ extern (D) this(Loc loc, TemplateDeclaration td, FuncDeclaration fd = null) @safe
{
super(loc, EXP.template_);
//printf("TemplateExp(): %s\n", td.toChars());
@@ -2459,7 +2459,7 @@ extern (C++) final class NewExp : Expression
/// The fields are still separate for backwards compatibility
extern (D) ArgumentList argumentList() { return ArgumentList(arguments, names); }
- extern (D) this(const ref Loc loc, Expression thisexp, Type newtype, Expressions* arguments, Identifiers* names = null) @safe
+ extern (D) this(Loc loc, Expression thisexp, Type newtype, Expressions* arguments, Identifiers* names = null) @safe
{
super(loc, EXP.new_);
this.thisexp = thisexp;
@@ -2468,7 +2468,7 @@ extern (C++) final class NewExp : Expression
this.names = names;
}
- static NewExp create(const ref Loc loc, Expression thisexp, Type newtype, Expressions* arguments) @safe
+ static NewExp create(Loc loc, Expression thisexp, Type newtype, Expressions* arguments) @safe
{
return new NewExp(loc, thisexp, newtype, arguments);
}
@@ -2497,7 +2497,7 @@ extern (C++) final class NewAnonClassExp : Expression
ClassDeclaration cd; // class being instantiated
Expressions* arguments; // Array of Expression's to call class constructor
- extern (D) this(const ref Loc loc, Expression thisexp, ClassDeclaration cd, Expressions* arguments) @safe
+ extern (D) this(Loc loc, Expression thisexp, ClassDeclaration cd, Expressions* arguments) @safe
{
super(loc, EXP.newAnonymousClass);
this.thisexp = thisexp;
@@ -2524,7 +2524,7 @@ extern (C++) class SymbolExp : Expression
Dsymbol originalScope; // original scope before inlining
bool hasOverloads;
- extern (D) this(const ref Loc loc, EXP op, Declaration var, bool hasOverloads) @safe
+ extern (D) this(Loc loc, EXP op, Declaration var, bool hasOverloads) @safe
{
super(loc, op);
assert(var);
@@ -2545,7 +2545,7 @@ extern (C++) final class SymOffExp : SymbolExp
{
dinteger_t offset;
- extern (D) this(const ref Loc loc, Declaration var, dinteger_t offset, bool hasOverloads = true)
+ extern (D) this(Loc loc, Declaration var, dinteger_t offset, bool hasOverloads = true)
{
if (auto v = var.isVarDeclaration())
{
@@ -2580,7 +2580,7 @@ extern (C++) final class SymOffExp : SymbolExp
extern (C++) final class VarExp : SymbolExp
{
bool delegateWasExtracted;
- extern (D) this(const ref Loc loc, Declaration var, bool hasOverloads = true) @safe
+ extern (D) this(Loc loc, Declaration var, bool hasOverloads = true) @safe
{
if (var.isVarDeclaration())
hasOverloads = false;
@@ -2591,7 +2591,7 @@ extern (C++) final class VarExp : SymbolExp
this.type = var.type;
}
- static VarExp create(const ref Loc loc, Declaration var, bool hasOverloads = true) @safe
+ static VarExp create(Loc loc, Declaration var, bool hasOverloads = true) @safe
{
return new VarExp(loc, var, hasOverloads);
}
@@ -2630,7 +2630,7 @@ extern (C++) final class OverExp : Expression
{
OverloadSet vars;
- extern (D) this(const ref Loc loc, OverloadSet s)
+ extern (D) this(Loc loc, OverloadSet s)
{
super(loc, EXP.overloadSet);
//printf("OverExp(this = %p, '%s')\n", this, var.toChars());
@@ -2659,7 +2659,7 @@ extern (C++) final class FuncExp : Expression
TemplateDeclaration td;
TOK tok; // TOK.reserved, TOK.delegate_, TOK.function_
- extern (D) this(const ref Loc loc, Dsymbol s)
+ extern (D) this(Loc loc, Dsymbol s)
{
super(loc, EXP.function_);
this.td = s.isTemplateDeclaration();
@@ -2726,7 +2726,7 @@ extern (C++) final class DeclarationExp : Expression
{
Dsymbol declaration;
- extern (D) this(const ref Loc loc, Dsymbol declaration) @safe
+ extern (D) this(Loc loc, Dsymbol declaration) @safe
{
super(loc, EXP.declaration);
this.declaration = declaration;
@@ -2759,7 +2759,7 @@ extern (C++) final class TypeidExp : Expression
{
RootObject obj;
- extern (D) this(const ref Loc loc, RootObject o) @safe
+ extern (D) this(Loc loc, RootObject o) @safe
{
super(loc, EXP.typeid_);
this.obj = o;
@@ -2784,7 +2784,7 @@ extern (C++) final class TraitsExp : Expression
Identifier ident;
Objects* args;
- extern (D) this(const ref Loc loc, Identifier ident, Objects* args) @safe
+ extern (D) this(Loc loc, Identifier ident, Objects* args) @safe
{
super(loc, EXP.traits);
this.ident = ident;
@@ -2809,7 +2809,7 @@ extern (C++) final class TraitsExp : Expression
*/
extern (C++) final class HaltExp : Expression
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.halt);
}
@@ -2833,7 +2833,7 @@ extern (C++) final class IsExp : Expression
TOK tok; // ':' or '=='
TOK tok2; // 'struct', 'union', etc.
- extern (D) this(const ref Loc loc, Type targ, Identifier id, TOK tok, Type tspec, TOK tok2, TemplateParameters* parameters) scope @safe
+ extern (D) this(Loc loc, Type targ, Identifier id, TOK tok, Type tspec, TOK tok2, TemplateParameters* parameters) scope @safe
{
super(loc, EXP.is_);
this.targ = targ;
@@ -2872,7 +2872,7 @@ extern (C++) abstract class UnaExp : Expression
{
Expression e1;
- extern (D) this(const ref Loc loc, EXP op, Expression e1) scope @safe
+ extern (D) this(Loc loc, EXP op, Expression e1) scope @safe
{
super(loc, op);
this.e1 = e1;
@@ -2912,7 +2912,7 @@ extern (C++) abstract class BinExp : Expression
Expression e1;
Expression e2;
- extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) scope @safe
+ extern (D) this(Loc loc, EXP op, Expression e1, Expression e2) scope @safe
{
super(loc, op);
this.e1 = e1;
@@ -2953,7 +2953,7 @@ extern (C++) abstract class BinExp : Expression
*/
extern (C++) class BinAssignExp : BinExp
{
- extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) scope @safe
+ extern (D) this(Loc loc, EXP op, Expression e1, Expression e2) scope @safe
{
super(loc, op, e1, e2);
}
@@ -2978,7 +2978,7 @@ extern (C++) final class MixinExp : Expression
{
Expressions* exps;
- extern (D) this(const ref Loc loc, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expressions* exps) @safe
{
super(loc, EXP.mixin_);
this.exps = exps;
@@ -3026,7 +3026,7 @@ extern (C++) final class MixinExp : Expression
*/
extern (C++) final class ImportExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.import_, e);
}
@@ -3046,7 +3046,7 @@ extern (C++) final class AssertExp : UnaExp
{
Expression msg;
- extern (D) this(const ref Loc loc, Expression e, Expression msg = null) @safe
+ extern (D) this(Loc loc, Expression e, Expression msg = null) @safe
{
super(loc, EXP.assert_, e);
this.msg = msg;
@@ -3071,7 +3071,7 @@ extern (C++) final class AssertExp : UnaExp
*/
extern (C++) final class ThrowExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e)
+ extern (D) this(Loc loc, Expression e)
{
super(loc, EXP.throw_, e);
}
@@ -3096,13 +3096,13 @@ extern (C++) final class DotIdExp : UnaExp
bool wantsym; // do not replace Symbol with its initializer during semantic()
bool arrow; // ImportC: if -> instead of .
- extern (D) this(const ref Loc loc, Expression e, Identifier ident) @safe
+ extern (D) this(Loc loc, Expression e, Identifier ident) @safe
{
super(loc, EXP.dotIdentifier, e);
this.ident = ident;
}
- static DotIdExp create(const ref Loc loc, Expression e, Identifier ident) @safe
+ static DotIdExp create(Loc loc, Expression e, Identifier ident) @safe
{
return new DotIdExp(loc, e, ident);
}
@@ -3120,7 +3120,7 @@ extern (C++) final class DotTemplateExp : UnaExp
{
TemplateDeclaration td;
- extern (D) this(const ref Loc loc, Expression e, TemplateDeclaration td) @safe
+ extern (D) this(Loc loc, Expression e, TemplateDeclaration td) @safe
{
super(loc, EXP.dotTemplateDeclaration, e);
this.td = td;
@@ -3145,7 +3145,7 @@ extern (C++) final class DotVarExp : UnaExp
Declaration var;
bool hasOverloads;
- extern (D) this(const ref Loc loc, Expression e, Declaration var, bool hasOverloads = true) @safe
+ extern (D) this(Loc loc, Expression e, Declaration var, bool hasOverloads = true) @safe
{
if (var.isVarDeclaration())
hasOverloads = false;
@@ -3179,14 +3179,14 @@ extern (C++) final class DotTemplateInstanceExp : UnaExp
{
TemplateInstance ti;
- extern (D) this(const ref Loc loc, Expression e, Identifier name, Objects* tiargs)
+ extern (D) this(Loc loc, Expression e, Identifier name, Objects* tiargs)
{
super(loc, EXP.dotTemplateInstance, e);
//printf("DotTemplateInstanceExp()\n");
this.ti = new TemplateInstance(loc, name, tiargs);
}
- extern (D) this(const ref Loc loc, Expression e, TemplateInstance ti) @safe
+ extern (D) this(Loc loc, Expression e, TemplateInstance ti) @safe
{
super(loc, EXP.dotTemplateInstance, e);
this.ti = ti;
@@ -3224,7 +3224,7 @@ extern (C++) final class DelegateExp : UnaExp
bool hasOverloads;
VarDeclaration vthis2; // container for multi-context
- extern (D) this(const ref Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true, VarDeclaration vthis2 = null) @safe
+ extern (D) this(Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true, VarDeclaration vthis2 = null) @safe
{
super(loc, EXP.delegate_, e);
this.func = f;
@@ -3244,7 +3244,7 @@ extern (C++) final class DotTypeExp : UnaExp
{
Dsymbol sym; // symbol that represents a type
- extern (D) this(const ref Loc loc, Expression e, Dsymbol s) @safe
+ extern (D) this(Loc loc, Expression e, Dsymbol s) @safe
{
super(loc, EXP.dotType, e);
this.sym = s;
@@ -3299,19 +3299,19 @@ extern (C++) final class CallExp : UnaExp
/// The fields are still separate for backwards compatibility
extern (D) ArgumentList argumentList() { return ArgumentList(arguments, names); }
- extern (D) this(const ref Loc loc, Expression e, Expressions* exps, Identifiers* names = null) @safe
+ extern (D) this(Loc loc, Expression e, Expressions* exps, Identifiers* names = null) @safe
{
super(loc, EXP.call, e);
this.arguments = exps;
this.names = names;
}
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.call, e);
}
- extern (D) this(const ref Loc loc, Expression e, Expression earg1)
+ extern (D) this(Loc loc, Expression e, Expression earg1)
{
super(loc, EXP.call, e);
this.arguments = new Expressions();
@@ -3319,7 +3319,7 @@ extern (C++) final class CallExp : UnaExp
this.arguments.push(earg1);
}
- extern (D) this(const ref Loc loc, Expression e, Expression earg1, Expression earg2)
+ extern (D) this(Loc loc, Expression e, Expression earg1, Expression earg2)
{
super(loc, EXP.call, e);
auto arguments = new Expressions(2);
@@ -3335,23 +3335,23 @@ extern (C++) final class CallExp : UnaExp
* fd = the declaration of the function to call
* earg1 = the function argument
*/
- extern(D) this(const ref Loc loc, FuncDeclaration fd, Expression earg1)
+ extern(D) this(Loc loc, FuncDeclaration fd, Expression earg1)
{
this(loc, new VarExp(loc, fd, false), earg1);
this.f = fd;
}
- static CallExp create(const ref Loc loc, Expression e, Expressions* exps) @safe
+ static CallExp create(Loc loc, Expression e, Expressions* exps) @safe
{
return new CallExp(loc, e, exps);
}
- static CallExp create(const ref Loc loc, Expression e) @safe
+ static CallExp create(Loc loc, Expression e) @safe
{
return new CallExp(loc, e);
}
- static CallExp create(const ref Loc loc, Expression e, Expression earg1)
+ static CallExp create(Loc loc, Expression e, Expression earg1)
{
return new CallExp(loc, e, earg1);
}
@@ -3363,7 +3363,7 @@ extern (C++) final class CallExp : UnaExp
* fd = the declaration of the function to call
* earg1 = the function argument
*/
- static CallExp create(const ref Loc loc, FuncDeclaration fd, Expression earg1)
+ static CallExp create(Loc loc, FuncDeclaration fd, Expression earg1)
{
return new CallExp(loc, fd, earg1);
}
@@ -3457,12 +3457,12 @@ FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) @safe
*/
extern (C++) final class AddrExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.address, e);
}
- extern (D) this(const ref Loc loc, Expression e, Type t) @safe
+ extern (D) this(Loc loc, Expression e, Type t) @safe
{
this(loc, e);
type = t;
@@ -3479,14 +3479,14 @@ extern (C++) final class AddrExp : UnaExp
*/
extern (C++) final class PtrExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.star, e);
//if (e.type)
// type = ((TypePointer *)e.type).next;
}
- extern (D) this(const ref Loc loc, Expression e, Type t) @safe
+ extern (D) this(Loc loc, Expression e, Type t) @safe
{
super(loc, EXP.star, e);
type = t;
@@ -3508,7 +3508,7 @@ extern (C++) final class PtrExp : UnaExp
*/
extern (C++) final class NegExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.negate, e);
}
@@ -3524,7 +3524,7 @@ extern (C++) final class NegExp : UnaExp
*/
extern (C++) final class UAddExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) scope @safe
+ extern (D) this(Loc loc, Expression e) scope @safe
{
super(loc, EXP.uadd, e);
}
@@ -3540,7 +3540,7 @@ extern (C++) final class UAddExp : UnaExp
*/
extern (C++) final class ComExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.tilde, e);
}
@@ -3556,7 +3556,7 @@ extern (C++) final class ComExp : UnaExp
*/
extern (C++) final class NotExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e) @safe
+ extern (D) this(Loc loc, Expression e) @safe
{
super(loc, EXP.not, e);
}
@@ -3576,7 +3576,7 @@ extern (C++) final class DeleteExp : UnaExp
{
bool isRAII; // true if called automatically as a result of scoped destruction
- extern (D) this(const ref Loc loc, Expression e, bool isRAII) @safe
+ extern (D) this(Loc loc, Expression e, bool isRAII) @safe
{
super(loc, EXP.delete_, e);
this.isRAII = isRAII;
@@ -3601,7 +3601,7 @@ extern (C++) final class CastExp : UnaExp
ubyte mod = cast(ubyte)~0; // MODxxxxx
bool trusted; // assume cast is safe
- extern (D) this(const ref Loc loc, Expression e, Type t) @safe
+ extern (D) this(Loc loc, Expression e, Type t) @safe
{
super(loc, EXP.cast_, e);
this.to = t;
@@ -3609,7 +3609,7 @@ extern (C++) final class CastExp : UnaExp
/* For cast(const) and cast(immutable)
*/
- extern (D) this(const ref Loc loc, Expression e, ubyte mod) @safe
+ extern (D) this(Loc loc, Expression e, ubyte mod) @safe
{
super(loc, EXP.cast_, e);
this.mod = mod;
@@ -3643,14 +3643,14 @@ extern (C++) final class VectorExp : UnaExp
uint dim = ~0; // number of elements in the vector
OwnedBy ownedByCtfe = OwnedBy.code;
- extern (D) this(const ref Loc loc, Expression e, Type t) @trusted
+ extern (D) this(Loc loc, Expression e, Type t) @trusted
{
super(loc, EXP.vector, e);
assert(t.ty == Tvector);
to = cast(TypeVector)t;
}
- static VectorExp create(const ref Loc loc, Expression e, Type t) @safe
+ static VectorExp create(Loc loc, Expression e, Type t) @safe
{
return new VectorExp(loc, e, t);
}
@@ -3673,7 +3673,7 @@ extern (C++) final class VectorExp : UnaExp
*/
extern (C++) final class VectorArrayExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e1) @safe
+ extern (D) this(Loc loc, Expression e1) @safe
{
super(loc, EXP.vectorArray, e1);
}
@@ -3711,14 +3711,14 @@ extern (C++) final class SliceExp : UnaExp
mixin(generateBitFields!(BitFields, ubyte));
/************************************************************/
- extern (D) this(const ref Loc loc, Expression e1, IntervalExp ie) @safe
+ extern (D) this(Loc loc, Expression e1, IntervalExp ie) @safe
{
super(loc, EXP.slice, e1);
this.upr = ie ? ie.upr : null;
this.lwr = ie ? ie.lwr : null;
}
- extern (D) this(const ref Loc loc, Expression e1, Expression lwr, Expression upr) @safe
+ extern (D) this(Loc loc, Expression e1, Expression lwr, Expression upr) @safe
{
super(loc, EXP.slice, e1);
this.upr = upr;
@@ -3756,7 +3756,7 @@ extern (C++) final class SliceExp : UnaExp
*/
extern (C++) final class ArrayLengthExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e1) @safe
+ extern (D) this(Loc loc, Expression e1) @safe
{
super(loc, EXP.arrayLength, e1);
}
@@ -3779,7 +3779,7 @@ extern (C++) final class ArrayExp : UnaExp
size_t currentDimension; // for opDollar
VarDeclaration lengthVar;
- extern (D) this(const ref Loc loc, Expression e1, Expression index = null)
+ extern (D) this(Loc loc, Expression e1, Expression index = null)
{
super(loc, EXP.array, e1);
arguments = new Expressions();
@@ -3787,7 +3787,7 @@ extern (C++) final class ArrayExp : UnaExp
arguments.push(index);
}
- extern (D) this(const ref Loc loc, Expression e1, Expressions* args) @safe
+ extern (D) this(Loc loc, Expression e1, Expressions* args) @safe
{
super(loc, EXP.array, e1);
arguments = args;
@@ -3819,7 +3819,7 @@ extern (C++) final class ArrayExp : UnaExp
*/
extern (C++) final class DotExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.dot, e1, e2);
}
@@ -3845,7 +3845,7 @@ extern (C++) final class CommaExp : BinExp
bool allowCommaExp;
- extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool generated = true) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2, bool generated = true) @safe
{
super(loc, EXP.comma, e1, e2);
allowCommaExp = isGenerated = generated;
@@ -3896,7 +3896,7 @@ extern (C++) final class IntervalExp : Expression
Expression lwr;
Expression upr;
- extern (D) this(const ref Loc loc, Expression lwr, Expression upr) @safe
+ extern (D) this(Loc loc, Expression lwr, Expression upr) @safe
{
super(loc, EXP.interval);
this.lwr = lwr;
@@ -3921,7 +3921,7 @@ extern (C++) final class IntervalExp : Expression
*/
extern (C++) final class DelegatePtrExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e1) @safe
+ extern (D) this(Loc loc, Expression e1) @safe
{
super(loc, EXP.delegatePointer, e1);
}
@@ -3944,7 +3944,7 @@ extern (C++) final class DelegatePtrExp : UnaExp
*/
extern (C++) final class DelegateFuncptrExp : UnaExp
{
- extern (D) this(const ref Loc loc, Expression e1) @safe
+ extern (D) this(Loc loc, Expression e1) @safe
{
super(loc, EXP.delegateFunctionPointer, e1);
}
@@ -3969,13 +3969,13 @@ extern (C++) final class IndexExp : BinExp
bool modifiable = false; // assume it is an rvalue
bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.index, e1, e2);
//printf("IndexExp::IndexExp('%s')\n", toChars());
}
- extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool indexIsInBounds) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2, bool indexIsInBounds) @safe
{
super(loc, EXP.index, e1, e2);
this.indexIsInBounds = indexIsInBounds;
@@ -4036,7 +4036,7 @@ extern (C++) final class IndexExp : BinExp
*/
extern (C++) final class PostExp : BinExp
{
- extern (D) this(EXP op, const ref Loc loc, Expression e)
+ extern (D) this(EXP op, Loc loc, Expression e)
{
super(loc, op, e, IntegerExp.literal!1);
assert(op == EXP.minusMinus || op == EXP.plusPlus);
@@ -4053,7 +4053,7 @@ extern (C++) final class PostExp : BinExp
*/
extern (C++) final class PreExp : UnaExp
{
- extern (D) this(EXP op, const ref Loc loc, Expression e) @safe
+ extern (D) this(EXP op, Loc loc, Expression e) @safe
{
super(loc, op, e);
assert(op == EXP.preMinusMinus || op == EXP.prePlusPlus);
@@ -4083,12 +4083,12 @@ extern (C++) class AssignExp : BinExp
/************************************************************/
/* op can be EXP.assign, EXP.construct, or EXP.blit */
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.assign, e1, e2);
}
- this(const ref Loc loc, EXP tok, Expression e1, Expression e2) @safe
+ this(Loc loc, EXP tok, Expression e1, Expression e2) @safe
{
super(loc, tok, e1, e2);
}
@@ -4136,14 +4136,14 @@ extern (C++) final class LoweredAssignExp : AssignExp
*/
extern (C++) final class ConstructExp : AssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.construct, e1, e2);
}
// Internal use only. If `v` is a reference variable, the assignment
// will become a reference initialization automatically.
- extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) @safe
+ extern (D) this(Loc loc, VarDeclaration v, Expression e2) @safe
{
auto ve = new VarExp(loc, v);
assert(v.type && ve.type);
@@ -4165,14 +4165,14 @@ extern (C++) final class ConstructExp : AssignExp
*/
extern (C++) final class BlitExp : AssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.blit, e1, e2);
}
// Internal use only. If `v` is a reference variable, the assinment
// will become a reference rebinding automatically.
- extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2) @safe
+ extern (D) this(Loc loc, VarDeclaration v, Expression e2) @safe
{
auto ve = new VarExp(loc, v);
assert(v.type && ve.type);
@@ -4194,7 +4194,7 @@ extern (C++) final class BlitExp : AssignExp
*/
extern (C++) final class AddAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.addAssign, e1, e2);
}
@@ -4210,7 +4210,7 @@ extern (C++) final class AddAssignExp : BinAssignExp
*/
extern (C++) final class MinAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.minAssign, e1, e2);
}
@@ -4226,7 +4226,7 @@ extern (C++) final class MinAssignExp : BinAssignExp
*/
extern (C++) final class MulAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.mulAssign, e1, e2);
}
@@ -4242,7 +4242,7 @@ extern (C++) final class MulAssignExp : BinAssignExp
*/
extern (C++) final class DivAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.divAssign, e1, e2);
}
@@ -4258,7 +4258,7 @@ extern (C++) final class DivAssignExp : BinAssignExp
*/
extern (C++) final class ModAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.modAssign, e1, e2);
}
@@ -4274,7 +4274,7 @@ extern (C++) final class ModAssignExp : BinAssignExp
*/
extern (C++) final class AndAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.andAssign, e1, e2);
}
@@ -4290,7 +4290,7 @@ extern (C++) final class AndAssignExp : BinAssignExp
*/
extern (C++) final class OrAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.orAssign, e1, e2);
}
@@ -4306,7 +4306,7 @@ extern (C++) final class OrAssignExp : BinAssignExp
*/
extern (C++) final class XorAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.xorAssign, e1, e2);
}
@@ -4322,7 +4322,7 @@ extern (C++) final class XorAssignExp : BinAssignExp
*/
extern (C++) final class PowAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.powAssign, e1, e2);
}
@@ -4338,7 +4338,7 @@ extern (C++) final class PowAssignExp : BinAssignExp
*/
extern (C++) final class ShlAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.leftShiftAssign, e1, e2);
}
@@ -4354,7 +4354,7 @@ extern (C++) final class ShlAssignExp : BinAssignExp
*/
extern (C++) final class ShrAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.rightShiftAssign, e1, e2);
}
@@ -4370,7 +4370,7 @@ extern (C++) final class ShrAssignExp : BinAssignExp
*/
extern (C++) final class UshrAssignExp : BinAssignExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.unsignedRightShiftAssign, e1, e2);
}
@@ -4397,12 +4397,12 @@ extern (C++) class CatAssignExp : BinAssignExp
{
Expression lowering; // lowered druntime hook `_d_arrayappend{cTX,T}`
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.concatenateAssign, e1, e2);
}
- extern (D) this(const ref Loc loc, EXP tok, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, EXP tok, Expression e1, Expression e2) @safe
{
super(loc, tok, e1, e2);
}
@@ -4418,7 +4418,7 @@ extern (C++) class CatAssignExp : BinAssignExp
*/
extern (C++) final class CatElemAssignExp : CatAssignExp
{
- extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Type type, Expression e1, Expression e2) @safe
{
super(loc, EXP.concatenateElemAssign, e1, e2);
this.type = type;
@@ -4435,7 +4435,7 @@ extern (C++) final class CatElemAssignExp : CatAssignExp
*/
extern (C++) final class CatDcharAssignExp : CatAssignExp
{
- extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Type type, Expression e1, Expression e2) @safe
{
super(loc, EXP.concatenateDcharAssign, e1, e2);
this.type = type;
@@ -4454,7 +4454,7 @@ extern (C++) final class CatDcharAssignExp : CatAssignExp
*/
extern (C++) final class AddExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.add, e1, e2);
}
@@ -4472,7 +4472,7 @@ extern (C++) final class AddExp : BinExp
*/
extern (C++) final class MinExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.min, e1, e2);
}
@@ -4492,7 +4492,7 @@ extern (C++) final class CatExp : BinExp
{
Expression lowering; // call to druntime hook `_d_arraycatnTX`
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) scope @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) scope @safe
{
super(loc, EXP.concatenate, e1, e2);
}
@@ -4510,7 +4510,7 @@ extern (C++) final class CatExp : BinExp
*/
extern (C++) final class MulExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.mul, e1, e2);
}
@@ -4528,7 +4528,7 @@ extern (C++) final class MulExp : BinExp
*/
extern (C++) final class DivExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.div, e1, e2);
}
@@ -4546,7 +4546,7 @@ extern (C++) final class DivExp : BinExp
*/
extern (C++) final class ModExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.mod, e1, e2);
}
@@ -4564,7 +4564,7 @@ extern (C++) final class ModExp : BinExp
*/
extern (C++) final class PowExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.pow, e1, e2);
}
@@ -4582,7 +4582,7 @@ extern (C++) final class PowExp : BinExp
*/
extern (C++) final class ShlExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.leftShift, e1, e2);
}
@@ -4600,7 +4600,7 @@ extern (C++) final class ShlExp : BinExp
*/
extern (C++) final class ShrExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.rightShift, e1, e2);
}
@@ -4618,7 +4618,7 @@ extern (C++) final class ShrExp : BinExp
*/
extern (C++) final class UshrExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.unsignedRightShift, e1, e2);
}
@@ -4636,7 +4636,7 @@ extern (C++) final class UshrExp : BinExp
*/
extern (C++) final class AndExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.and, e1, e2);
}
@@ -4654,7 +4654,7 @@ extern (C++) final class AndExp : BinExp
*/
extern (C++) final class OrExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.or, e1, e2);
}
@@ -4672,7 +4672,7 @@ extern (C++) final class OrExp : BinExp
*/
extern (C++) final class XorExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.xor, e1, e2);
}
@@ -4691,7 +4691,7 @@ extern (C++) final class XorExp : BinExp
*/
extern (C++) final class LogicalExp : BinExp
{
- extern (D) this(const ref Loc loc, EXP op, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, EXP op, Expression e1, Expression e2) @safe
{
super(loc, op, e1, e2);
assert(op == EXP.andAnd || op == EXP.orOr);
@@ -4713,7 +4713,7 @@ extern (C++) final class LogicalExp : BinExp
*/
extern (C++) final class CmpExp : BinExp
{
- extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(EXP op, Loc loc, Expression e1, Expression e2) @safe
{
super(loc, op, e1, e2);
assert(op == EXP.lessThan || op == EXP.lessOrEqual || op == EXP.greaterThan || op == EXP.greaterOrEqual);
@@ -4734,7 +4734,7 @@ extern (C++) final class CmpExp : BinExp
*/
extern (C++) final class InExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(Loc loc, Expression e1, Expression e2) @safe
{
super(loc, EXP.in_, e1, e2);
}
@@ -4752,7 +4752,7 @@ extern (C++) final class InExp : BinExp
*/
extern (C++) final class RemoveExp : BinExp
{
- extern (D) this(const ref Loc loc, Expression e1, Expression e2)
+ extern (D) this(Loc loc, Expression e1, Expression e2)
{
super(loc, EXP.remove, e1, e2);
type = Type.tbool;
@@ -4773,7 +4773,7 @@ extern (C++) final class RemoveExp : BinExp
*/
extern (C++) final class EqualExp : BinExp
{
- extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(EXP op, Loc loc, Expression e1, Expression e2) @safe
{
super(loc, op, e1, e2);
assert(op == EXP.equal || op == EXP.notEqual);
@@ -4794,7 +4794,7 @@ extern (C++) final class EqualExp : BinExp
*/
extern (C++) final class IdentityExp : BinExp
{
- extern (D) this(EXP op, const ref Loc loc, Expression e1, Expression e2) @safe
+ extern (D) this(EXP op, Loc loc, Expression e1, Expression e2) @safe
{
super(loc, op, e1, e2);
assert(op == EXP.identity || op == EXP.notIdentity);
@@ -4815,7 +4815,7 @@ extern (C++) final class CondExp : BinExp
{
Expression econd;
- extern (D) this(const ref Loc loc, Expression econd, Expression e1, Expression e2) scope @safe
+ extern (D) this(Loc loc, Expression econd, Expression e1, Expression e2) scope @safe
{
super(loc, EXP.question, e1, e2);
this.econd = econd;
@@ -4859,7 +4859,7 @@ extern (C++) class DefaultInitExp : Expression
* op = EXP.prettyFunction, EXP.functionString, EXP.moduleString,
* EXP.line, EXP.file, EXP.fileFullPath
*/
- extern (D) this(const ref Loc loc, EXP op) @safe
+ extern (D) this(Loc loc, EXP op) @safe
{
super(loc, op);
}
@@ -4875,7 +4875,7 @@ extern (C++) class DefaultInitExp : Expression
*/
extern (C++) final class FileInitExp : DefaultInitExp
{
- extern (D) this(const ref Loc loc, EXP tok) @safe
+ extern (D) this(Loc loc, EXP tok) @safe
{
super(loc, tok);
}
@@ -4891,7 +4891,7 @@ extern (C++) final class FileInitExp : DefaultInitExp
*/
extern (C++) final class LineInitExp : DefaultInitExp
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.line);
}
@@ -4907,7 +4907,7 @@ extern (C++) final class LineInitExp : DefaultInitExp
*/
extern (C++) final class ModuleInitExp : DefaultInitExp
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.moduleString);
}
@@ -4923,7 +4923,7 @@ extern (C++) final class ModuleInitExp : DefaultInitExp
*/
extern (C++) final class FuncInitExp : DefaultInitExp
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.functionString);
}
@@ -4939,7 +4939,7 @@ extern (C++) final class FuncInitExp : DefaultInitExp
*/
extern (C++) final class PrettyFuncInitExp : DefaultInitExp
{
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, EXP.prettyFunction);
}
@@ -4958,7 +4958,7 @@ extern (C++) final class ClassReferenceExp : Expression
{
StructLiteralExp value;
- extern (D) this(const ref Loc loc, StructLiteralExp lit, Type type) @safe
+ extern (D) this(Loc loc, StructLiteralExp lit, Type type) @safe
{
super(loc, EXP.classReference);
assert(lit && lit.sd && lit.sd.isClassDeclaration());
@@ -5060,7 +5060,7 @@ extern (C++) final class ThrownExceptionExp : Expression
{
ClassReferenceExp thrown; // the thing being tossed
- extern (D) this(const ref Loc loc, ClassReferenceExp victim) @safe
+ extern (D) this(Loc loc, ClassReferenceExp victim) @safe
{
super(loc, EXP.thrownException);
this.thrown = victim;
@@ -5082,7 +5082,7 @@ extern (C++) final class ObjcClassReferenceExp : Expression
{
ClassDeclaration classDeclaration;
- extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration) @safe
+ extern (D) this(Loc loc, ClassDeclaration classDeclaration) @safe
{
super(loc, EXP.objcClassReference);
this.classDeclaration = classDeclaration;
@@ -5104,7 +5104,7 @@ extern (C++) final class GenericExp : Expression
Types* types; /// type-names for generic associations (null entry for `default`)
Expressions* exps; /// 1:1 mapping of typeNames to exps
- extern (D) this(const ref Loc loc, Expression cntlExp, Types* types, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expression cntlExp, Types* types, Expressions* exps) @safe
{
super(loc, EXP._Generic);
this.cntlExp = cntlExp;
diff --git a/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h
index 09ed60f..a4bb019 100644
--- a/gcc/d/dmd/expression.h
+++ b/gcc/d/dmd/expression.h
@@ -51,7 +51,7 @@ namespace dmd
// in expressionsem.d
Expression *expressionSemantic(Expression *e, Scope *sc);
// in typesem.d
- Expression *defaultInit(Type *mt, const Loc &loc, const bool isCfile = false);
+ Expression *defaultInit(Type *mt, Loc loc, const bool isCfile = false);
// Entry point for CTFE.
// A compile-time result is required. Give an error if not possible
@@ -233,7 +233,7 @@ class IntegerExp final : public Expression
public:
dinteger_t value;
- static IntegerExp *create(const Loc &loc, dinteger_t value, Type *type);
+ static IntegerExp *create(Loc loc, dinteger_t value, Type *type);
bool equals(const RootObject * const o) const override;
dinteger_t toInteger() override;
real_t toReal() override;
@@ -259,7 +259,7 @@ class RealExp final : public Expression
public:
real_t value;
- static RealExp *create(const Loc &loc, real_t value, Type *type);
+ static RealExp *create(Loc loc, real_t value, Type *type);
bool equals(const RootObject * const o) const override;
bool isIdentical(const Expression *e) const override;
dinteger_t toInteger() override;
@@ -276,7 +276,7 @@ class ComplexExp final : public Expression
public:
complex_t value;
- static ComplexExp *create(const Loc &loc, complex_t value, Type *type);
+ static ComplexExp *create(Loc loc, complex_t value, Type *type);
bool equals(const RootObject * const o) const override;
bool isIdentical(const Expression *e) const override;
dinteger_t toInteger() override;
@@ -293,7 +293,7 @@ class IdentifierExp : public Expression
public:
Identifier *ident;
- static IdentifierExp *create(const Loc &loc, Identifier *ident);
+ static IdentifierExp *create(Loc loc, Identifier *ident);
bool isLvalue() override final;
void accept(Visitor *v) override { v->visit(this); }
};
@@ -353,8 +353,8 @@ public:
d_bool committed; // if type is committed
d_bool hexString; // if string is parsed from a hex string literal
- static StringExp *create(const Loc &loc, const char *s);
- static StringExp *create(const Loc &loc, const void *s, d_size_t len);
+ static StringExp *create(Loc loc, const char *s);
+ static StringExp *create(Loc loc, const void *s, d_size_t len);
bool equals(const RootObject * const o) const override;
char32_t getCodeUnit(d_size_t i) const;
dinteger_t getIndex(d_size_t i) const;
@@ -391,7 +391,7 @@ public:
*/
Expressions *exps;
- static TupleExp *create(const Loc &loc, Expressions *exps);
+ static TupleExp *create(Loc loc, Expressions *exps);
TupleExp *syntaxCopy() override;
bool equals(const RootObject * const o) const override;
@@ -406,7 +406,7 @@ public:
Expression *basis;
Expressions *elements;
- static ArrayLiteralExp *create(const Loc &loc, Expressions *elements);
+ static ArrayLiteralExp *create(Loc loc, Expressions *elements);
ArrayLiteralExp *syntaxCopy() override;
bool equals(const RootObject * const o) const override;
Expression *getElement(d_size_t i);
@@ -472,7 +472,7 @@ public:
StructLiteralExp *origin;
- static StructLiteralExp *create(const Loc &loc, StructDeclaration *sd, void *elements, Type *stype = nullptr);
+ static StructLiteralExp *create(Loc loc, StructDeclaration *sd, void *elements, Type *stype = nullptr);
bool equals(const RootObject * const o) const override;
StructLiteralExp *syntaxCopy() override;
@@ -526,7 +526,7 @@ public:
Expression *lowering; // lowered druntime hook: `_d_newclass`
- static NewExp *create(const Loc &loc, Expression *thisexp, Type *newtype, Expressions *arguments);
+ static NewExp *create(Loc loc, Expression *thisexp, Type *newtype, Expressions *arguments);
NewExp *syntaxCopy() override;
void accept(Visitor *v) override { v->visit(this); }
@@ -573,7 +573,7 @@ class VarExp final : public SymbolExp
{
public:
d_bool delegateWasExtracted;
- static VarExp *create(const Loc &loc, Declaration *var, bool hasOverloads = true);
+ static VarExp *create(Loc loc, Declaration *var, bool hasOverloads = true);
bool equals(const RootObject * const o) const override;
bool isLvalue() override;
@@ -736,7 +736,7 @@ public:
d_bool wantsym; // do not replace Symbol with its initializer during semantic()
d_bool arrow; // ImportC: if -> instead of .
- static DotIdExp *create(const Loc &loc, Expression *e, Identifier *ident);
+ static DotIdExp *create(Loc loc, Expression *e, Identifier *ident);
void accept(Visitor *v) override { v->visit(this); }
};
@@ -815,10 +815,10 @@ public:
d_bool isUfcsRewrite; // the first argument was pushed in here by a UFCS rewrite
VarDeclaration *vthis2; // container for multi-context
- static CallExp *create(const Loc &loc, Expression *e, Expressions *exps);
- static CallExp *create(const Loc &loc, Expression *e);
- static CallExp *create(const Loc &loc, Expression *e, Expression *earg1);
- static CallExp *create(const Loc &loc, FuncDeclaration *fd, Expression *earg1);
+ static CallExp *create(Loc loc, Expression *e, Expressions *exps);
+ static CallExp *create(Loc loc, Expression *e);
+ static CallExp *create(Loc loc, Expression *e, Expression *earg1);
+ static CallExp *create(Loc loc, FuncDeclaration *fd, Expression *earg1);
CallExp *syntaxCopy() override;
bool isLvalue() override;
@@ -892,7 +892,7 @@ public:
unsigned dim; // number of elements in the vector
OwnedBy ownedByCtfe;
- static VectorExp *create(const Loc &loc, Expression *e, Type *t);
+ static VectorExp *create(Loc loc, Expression *e, Type *t);
VectorExp *syntaxCopy() override;
void accept(Visitor *v) override { v->visit(this); }
};
diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d
index b498998..7a35328 100644
--- a/gcc/d/dmd/expressionsem.d
+++ b/gcc/d/dmd/expressionsem.d
@@ -1564,7 +1564,7 @@ Expression resolvePropertiesOnly(Scope* sc, Expression e1)
* Returns:
* `s` turned into an expression, `ErrorExp` if an error occurred
*/
-Expression symbolToExp(Dsymbol s, const ref Loc loc, Scope* sc, bool hasOverloads)
+Expression symbolToExp(Dsymbol s, Loc loc, Scope* sc, bool hasOverloads)
{
static if (LOGSEMANTIC)
{
@@ -1793,7 +1793,7 @@ Lagain:
* Returns:
* Expression representing the `this` for the var
*/
-private Expression getRightThis(const ref Loc loc, Scope* sc, AggregateDeclaration ad, Expression e1, Dsymbol var, int flag = 0)
+private Expression getRightThis(Loc loc, Scope* sc, AggregateDeclaration ad, Expression e1, Dsymbol var, int flag = 0)
{
//printf("\ngetRightThis(e1 = %s, ad = %s, var = %s)\n", e1.toChars(), ad.toChars(), var.toChars());
L1:
@@ -1960,7 +1960,7 @@ private bool haveSameThis(FuncDeclaration outerFunc, FuncDeclaration calledFunc)
* we can only call other pure functions.
* Returns true if error occurs.
*/
-private bool checkPurity(FuncDeclaration f, const ref Loc loc, Scope* sc)
+private bool checkPurity(FuncDeclaration f, Loc loc, Scope* sc)
{
if (!sc.func)
return false;
@@ -2001,7 +2001,7 @@ private bool checkPurity(FuncDeclaration f, const ref Loc loc, Scope* sc)
* check = current check (e.g. whether it's pure)
* checkName = the kind of check (e.g. `"pure"`)
*/
-void checkOverriddenDtor(FuncDeclaration f, Scope* sc, const ref Loc loc,
+void checkOverriddenDtor(FuncDeclaration f, Scope* sc, Loc loc,
scope bool function(DtorDeclaration) check, const string checkName)
{
auto dd = f.isDtorDeclaration();
@@ -2122,7 +2122,7 @@ public void errorSupplementalInferredAttr(FuncDeclaration fd, int maxDepth, bool
* Check for purity and safety violations.
* Returns true if error occurs.
*/
-private bool checkPurity(VarDeclaration v, const ref Loc loc, Scope* sc)
+private bool checkPurity(VarDeclaration v, Loc loc, Scope* sc)
{
//printf("v = %s %s\n", v.type.toChars(), v.toChars());
/* Look for purity and safety violations when accessing variable v
@@ -2794,7 +2794,7 @@ private Type arrayExpressionToCommonType(Scope* sc, ref Expressions exps)
return t0;
}
-private Expression opAssignToOp(const ref Loc loc, EXP op, Expression e1, Expression e2) @safe
+private Expression opAssignToOp(Loc loc, EXP op, Expression e1, Expression e2) @safe
{
Expression e;
switch (op)
@@ -2979,7 +2979,7 @@ private bool checkDefCtor(Loc loc, Type t)
* Returns:
* true errors happened
*/
-private bool functionParameters(const ref Loc loc, Scope* sc,
+private bool functionParameters(Loc loc, Scope* sc,
TypeFunction tf, Expression ethis, Type tthis, ArgumentList argumentList, FuncDeclaration fd,
Type* prettype, Expression* peprefix)
{
@@ -7659,8 +7659,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
const len = buf.length;
const str = buf.extractChars()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
- auto loc = adjustLocForMixin(str, exp.loc, global.params.mixinOut);
- scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ adjustLocForMixin(str, exp.loc, *p.baseLoc, global.params.mixinOut);
+ p.linnum = p.baseLoc.startLine;
p.nextToken();
//printf("p.loc.linnum = %d\n", p.loc.linnum);
@@ -13901,7 +13902,7 @@ private Expression dotIdSemanticPropX(DotIdExp exp, Scope* sc)
// symbol.mangleof
// return mangleof as an Expression
- static Expression dotMangleof(const ref Loc loc, Scope* sc, Dsymbol ds, bool hasOverloads)
+ static Expression dotMangleof(Loc loc, Scope* sc, Dsymbol ds, bool hasOverloads)
{
Expression e;
@@ -15110,7 +15111,7 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
/****************************************
* Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, __FILE_FULL_PATH__ to loc.
*/
-Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
+Expression resolveLoc(Expression exp, Loc loc, Scope* sc)
{
// Don't replace the special keywords, while we are inside a default
// argument. They are replaced later when copied to the call site.
@@ -16185,7 +16186,7 @@ private bool checkFunctionAttributes(Expression exp, Scope* sc, FuncDeclaration
* Returns:
* Expression representing the `this` for the var
*/
-Expression getThisSkipNestedFuncs(const ref Loc loc, Scope* sc, Dsymbol s, AggregateDeclaration ad, Expression e1, Type t, Dsymbol var, bool flag = false)
+Expression getThisSkipNestedFuncs(Loc loc, Scope* sc, Dsymbol s, AggregateDeclaration ad, Expression e1, Type t, Dsymbol var, bool flag = false)
{
int n = 0;
while (s && s.isFuncDeclaration())
@@ -16246,7 +16247,7 @@ Expression getThisSkipNestedFuncs(const ref Loc loc, Scope* sc, Dsymbol s, Aggre
* newly created variable such that a closure is made for the variable when
* the address of `fd` is taken.
*/
-private VarDeclaration makeThis2Argument(const ref Loc loc, Scope* sc, FuncDeclaration fd)
+private VarDeclaration makeThis2Argument(Loc loc, Scope* sc, FuncDeclaration fd)
{
Type tthis2 = Type.tvoidptr.sarrayOf(2);
VarDeclaration vthis2 = new VarDeclaration(loc, tthis2, Identifier.generateId("__this"), null);
@@ -16272,7 +16273,7 @@ private VarDeclaration makeThis2Argument(const ref Loc loc, Scope* sc, FuncDecla
* Returns:
* a `bool` indicating if the hook is present.
*/
-bool verifyHookExist(const ref Loc loc, ref Scope sc, Identifier id, string description, Identifier module_ = Id.object)
+bool verifyHookExist(Loc loc, ref Scope sc, Identifier id, string description, Identifier module_ = Id.object)
{
Dsymbol pscopesym;
auto rootSymbol = sc.search(loc, Id.empty, pscopesym);
@@ -16296,7 +16297,7 @@ bool verifyHookExist(const ref Loc loc, ref Scope sc, Identifier id, string desc
* false if any errors occur,
* otherwise true and elements[] are rewritten for the output.
*/
-private bool fit(StructDeclaration sd, const ref Loc loc, Scope* sc, Expressions* elements, Type stype)
+private bool fit(StructDeclaration sd, Loc loc, Scope* sc, Expressions* elements, Type stype)
{
if (!elements)
return true;
@@ -16407,7 +16408,7 @@ private bool fit(StructDeclaration sd, const ref Loc loc, Scope* sc, Expressions
* Returns:
* VarExp referenceing `em` or ErrorExp if `em` if disabled/deprecated
*/
-Expression getVarExp(EnumMember em, const ref Loc loc, Scope* sc)
+Expression getVarExp(EnumMember em, Loc loc, Scope* sc)
{
dsymbolSemantic(em, sc);
if (em.errors)
@@ -17256,7 +17257,7 @@ private bool needsTypeInference(TemplateInstance ti, Scope* sc, int flag = 0)
* false if any errors occur.
* Otherwise, returns true and the missing arguments will be pushed in elements[].
*/
-bool fill(StructDeclaration sd, const ref Loc loc, ref Expressions elements, bool ctorinit)
+bool fill(StructDeclaration sd, Loc loc, ref Expressions elements, bool ctorinit)
{
//printf("AggregateDeclaration::fill() %s\n", toChars());
assert(sd.sizeok == Sizeok.done);
diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d
index 613dc1c..80312f2 100644
--- a/gcc/d/dmd/func.d
+++ b/gcc/d/dmd/func.d
@@ -296,7 +296,7 @@ extern (C++) class FuncDeclaration : Declaration
*/
ObjcFuncDeclaration objc;
- extern (D) this(const ref Loc loc, const ref Loc endloc, Identifier ident, StorageClass storage_class, Type type, bool noreturn = false)
+ extern (D) this(Loc loc, Loc endloc, Identifier ident, StorageClass storage_class, Type type, bool noreturn = false)
{
super(loc, ident);
//.printf("FuncDeclaration(id = '%s', type = %s)\n", ident.toChars(), type.toChars());
@@ -320,7 +320,7 @@ extern (C++) class FuncDeclaration : Declaration
this.inferRetType = true;
}
- static FuncDeclaration create(const ref Loc loc, const ref Loc endloc, Identifier id, StorageClass storage_class, Type type, bool noreturn = false)
+ static FuncDeclaration create(Loc loc, Loc endloc, Identifier id, StorageClass storage_class, Type type, bool noreturn = false)
{
return new FuncDeclaration(loc, endloc, id, storage_class, type, noreturn);
}
@@ -504,7 +504,7 @@ extern (C++) class FuncDeclaration : Declaration
*
* Returns: the `LabelDsymbol` for `ident`
*/
- final LabelDsymbol searchLabel(Identifier ident, const ref Loc loc)
+ final LabelDsymbol searchLabel(Identifier ident, Loc loc)
{
Dsymbol s;
if (!labtab)
@@ -1290,7 +1290,7 @@ extern (C++) final class FuncLiteralDeclaration : FuncDeclaration
// backend
bool deferToObj;
- extern (D) this(const ref Loc loc, const ref Loc endloc, Type type, TOK tok, ForeachStatement fes, Identifier id = null, StorageClass storage_class = STC.undefined_)
+ extern (D) this(Loc loc, Loc endloc, Type type, TOK tok, ForeachStatement fes, Identifier id = null, StorageClass storage_class = STC.undefined_)
{
super(loc, endloc, null, storage_class, type);
this.ident = id ? id : Id.empty;
@@ -1371,7 +1371,7 @@ extern (C++) final class CtorDeclaration : FuncDeclaration
{
bool isCpCtor; // copy constructor
bool isMoveCtor; // move constructor (aka rvalue constructor)
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, Type type)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc, Type type)
{
super(loc, endloc, Id.ctor, stc, type);
//printf("CtorDeclaration(loc = %s) %s %p\n", loc.toChars(), toChars(), this);
@@ -1420,7 +1420,7 @@ extern (C++) final class CtorDeclaration : FuncDeclaration
*/
extern (C++) final class PostBlitDeclaration : FuncDeclaration
{
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, Identifier id)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc, Identifier id)
{
super(loc, endloc, id, stc, null);
}
@@ -1468,12 +1468,12 @@ extern (C++) final class PostBlitDeclaration : FuncDeclaration
*/
extern (C++) final class DtorDeclaration : FuncDeclaration
{
- extern (D) this(const ref Loc loc, const ref Loc endloc)
+ extern (D) this(Loc loc, Loc endloc)
{
super(loc, endloc, Id.dtor, STC.undefined_, null);
}
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, Identifier id)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc, Identifier id)
{
super(loc, endloc, id, stc, null);
}
@@ -1528,12 +1528,12 @@ extern (C++) final class DtorDeclaration : FuncDeclaration
*/
extern (C++) class StaticCtorDeclaration : FuncDeclaration
{
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc)
{
super(loc, endloc, Identifier.generateIdWithLoc("_staticCtor", loc), STC.static_ | stc, null);
}
- extern (D) this(const ref Loc loc, const ref Loc endloc, string name, StorageClass stc)
+ extern (D) this(Loc loc, Loc endloc, string name, StorageClass stc)
{
super(loc, endloc, Identifier.generateIdWithLoc(name, loc), STC.static_ | stc, null);
}
@@ -1589,7 +1589,7 @@ 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)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc)
{
super(loc, endloc, "_sharedStaticCtor", stc);
}
@@ -1619,12 +1619,12 @@ extern (C++) class StaticDtorDeclaration : FuncDeclaration
{
VarDeclaration vgate; // 'gate' variable
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc)
{
super(loc, endloc, Identifier.generateIdWithLoc("_staticDtor", loc), STC.static_ | stc, null);
}
- extern (D) this(const ref Loc loc, const ref Loc endloc, string name, StorageClass stc)
+ extern (D) this(Loc loc, Loc endloc, string name, StorageClass stc)
{
super(loc, endloc, Identifier.generateIdWithLoc(name, loc), STC.static_ | stc, null);
}
@@ -1677,7 +1677,7 @@ extern (C++) class StaticDtorDeclaration : FuncDeclaration
*/
extern (C++) final class SharedStaticDtorDeclaration : StaticDtorDeclaration
{
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc)
{
super(loc, endloc, "_sharedStaticDtor", stc);
}
@@ -1705,7 +1705,7 @@ extern (C++) final class SharedStaticDtorDeclaration : StaticDtorDeclaration
*/
extern (C++) final class InvariantDeclaration : FuncDeclaration
{
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, Identifier id, Statement fbody)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc, Identifier id, Statement fbody)
{
// Make a unique invariant for now; we'll fix it up as we add it to the aggregate invariant list.
super(loc, endloc, id ? id : Identifier.generateId("__invariant"), stc, null);
@@ -1765,7 +1765,7 @@ extern (C++) final class UnitTestDeclaration : FuncDeclaration
// toObjFile() these nested functions after this one
FuncDeclarations deferredNested;
- extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc, char* codedoc)
+ extern (D) this(Loc loc, Loc endloc, StorageClass stc, char* codedoc)
{
super(loc, endloc, Identifier.generateIdWithLoc("__unittest", loc), stc, null);
this.codedoc = codedoc;
@@ -1814,7 +1814,7 @@ extern (C++) final class UnitTestDeclaration : FuncDeclaration
*/
extern (C++) final class NewDeclaration : FuncDeclaration
{
- extern (D) this(const ref Loc loc, StorageClass stc)
+ extern (D) this(Loc loc, StorageClass stc)
{
super(loc, Loc.initial, Id.classNew, STC.static_ | stc, null);
}
@@ -1875,9 +1875,9 @@ struct AttributeViolation
string action; /// Action that made the attribute fail to get inferred
- this(ref Loc loc, FuncDeclaration fd) { this.loc = loc; this.fd = fd; }
+ this(Loc loc, FuncDeclaration fd) { this.loc = loc; this.fd = fd; }
- this(ref Loc loc, const(char)* fmt, RootObject[] args)
+ this(Loc loc, const(char)* fmt, RootObject[] args)
{
this.loc = loc;
assert(args.length <= 4); // expand if necessary
diff --git a/gcc/d/dmd/funcsem.d b/gcc/d/dmd/funcsem.d
index 9f2ff1e..4658a5a 100644
--- a/gcc/d/dmd/funcsem.d
+++ b/gcc/d/dmd/funcsem.d
@@ -1333,7 +1333,7 @@ extern (D) void declareThis(FuncDeclaration fd, Scope* sc)
* Check that this function type is properly resolved.
* If not, report "forward reference error" and return true.
*/
-extern (D) bool checkForwardRef(FuncDeclaration fd, const ref Loc loc)
+extern (D) bool checkForwardRef(FuncDeclaration fd, Loc loc)
{
if (!functionSemantic(fd))
return true;
@@ -1526,7 +1526,7 @@ enum FuncResolveFlag : ubyte
* Returns:
* if match is found, then function symbol, else null
*/
-FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s,
+FuncDeclaration resolveFuncCall(Loc loc, Scope* sc, Dsymbol s,
Objects* tiargs, Type tthis, ArgumentList argumentList, FuncResolveFlag flags)
{
//printf("resolveFuncCall() %s\n", s.toChars());
@@ -1809,7 +1809,7 @@ FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s,
* declaration = the declaration to print overload candidates for
* showDeprecated = If `false`, `deprecated` function won't be shown
*/
-private void printCandidates(Decl)(const ref Loc loc, Decl declaration, bool showDeprecated)
+private void printCandidates(Decl)(Loc loc, Decl declaration, bool showDeprecated)
{
// max num of overloads to print (-v or -verror-supplements overrides this).
const uint DisplayLimit = global.params.v.errorSupplementCount();
@@ -2146,7 +2146,7 @@ L1:
* 4. If there's no candidates, it's "no match" and returns null with error report.
* e.g. If 'tthis' is const but there's no const methods.
*/
-FuncDeclaration overloadModMatch(FuncDeclaration thisfd, const ref Loc loc, Type tthis, ref bool hasOverloads)
+FuncDeclaration overloadModMatch(FuncDeclaration thisfd, Loc loc, Type tthis, ref bool hasOverloads)
{
//printf("FuncDeclaration::overloadModMatch('%s')\n", toChars());
MatchAccumulator m;
@@ -2246,7 +2246,7 @@ FuncDeclaration overloadModMatch(FuncDeclaration thisfd, const ref Loc loc, Type
* -1 increase nesting by 1 (`target` is nested within 'fd')
* LevelError error
*/
-int getLevelAndCheck(FuncDeclaration fd, const ref Loc loc, Scope* sc, FuncDeclaration target,
+int getLevelAndCheck(FuncDeclaration fd, Loc loc, Scope* sc, FuncDeclaration target,
Declaration decl)
{
int level = fd.getLevel(target, sc.intypeof);
@@ -2315,7 +2315,7 @@ bool canInferAttributes(FuncDeclaration fd, Scope* sc)
* then mark it as a delegate.
* Returns true if error occurs.
*/
-bool checkNestedFuncReference(FuncDeclaration fd, Scope* sc, const ref Loc loc)
+bool checkNestedFuncReference(FuncDeclaration fd, Scope* sc, Loc loc)
{
//printf("FuncDeclaration::checkNestedFuncReference() %s\n", toPrettyChars());
if (auto fld = fd.isFuncLiteralDeclaration())
diff --git a/gcc/d/dmd/globals.d b/gcc/d/dmd/globals.d
index be65557..bb9ad17 100644
--- a/gcc/d/dmd/globals.d
+++ b/gcc/d/dmd/globals.d
@@ -326,7 +326,7 @@ extern (C++) struct Global
ErrorSink errorSink; /// where the error messages go
ErrorSink errorSinkNull; /// where the error messages are ignored
- extern (C++) DArray!ubyte function(FileName, ref const Loc, ref OutBuffer) preprocess;
+ extern (C++) DArray!ubyte function(FileName, Loc, ref OutBuffer) preprocess;
nothrow:
diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h
index e94b804..981c301 100644
--- a/gcc/d/dmd/globals.h
+++ b/gcc/d/dmd/globals.h
@@ -349,7 +349,7 @@ struct Global
ErrorSink* errorSink; // where the error messages go
ErrorSink* errorSinkNull; // where the error messages disappear
- DArray<unsigned char> (*preprocess)(FileName, const Loc&, OutBuffer&);
+ DArray<unsigned char> (*preprocess)(FileName, Loc, OutBuffer&);
/* Start gagging. Return the current number of gagged errors
*/
@@ -413,43 +413,45 @@ typedef unsigned long long uinteger_t;
#endif
// file location
+struct SourceLoc
+{
+ DString filename;
+ uint32_t line;
+ uint32_t column;
+ uint32_t fileOffset;
+};
+
struct Loc
{
private:
- unsigned _linnum;
- unsigned _charnum;
- unsigned fileIndex;
+
+ unsigned int index;
+
+#if MARS && defined(__linux__) && defined(__i386__)
+ unsigned int dummy;
+#endif
+
public:
static void set(bool showColumns, MessageStyle messageStyle);
+ static Loc singleFilename(const char* const filename);
static bool showColumns;
static MessageStyle messageStyle;
Loc()
{
- _linnum = 0;
- _charnum = 0;
- fileIndex = 0;
- }
-
- Loc(const char *filename, unsigned linnum, unsigned charnum)
- {
- this->linnum(linnum);
- this->charnum(charnum);
- this->filename(filename);
+ index = 0;
}
uint32_t charnum() const;
- uint32_t charnum(uint32_t num);
uint32_t linnum() const;
- uint32_t linnum(uint32_t num);
const char *filename() const;
- void filename(const char *name);
+ SourceLoc toSourceLoc() const;
const char *toChars(
bool showColumns = Loc::showColumns,
MessageStyle messageStyle = Loc::messageStyle) const;
- bool equals(const Loc& loc) const;
+ bool equals(Loc loc) const;
};
enum class LINK : uint8_t
diff --git a/gcc/d/dmd/iasmgcc.d b/gcc/d/dmd/iasmgcc.d
index 0961354..2741608 100644
--- a/gcc/d/dmd/iasmgcc.d
+++ b/gcc/d/dmd/iasmgcc.d
@@ -55,7 +55,8 @@ public Statement gccAsmSemantic(GccAsmStatement s, Scope* sc)
*ptoklist = null;
}
p.token = *toklist;
- p.scanloc = s.loc;
+ p.baseLoc.startLine = s.loc.linnum;
+ p.linnum = s.loc.linnum;
// Parse the gcc asm statement.
const errors = global.errors;
diff --git a/gcc/d/dmd/identifier.d b/gcc/d/dmd/identifier.d
index c3ea0f7..231aa58 100644
--- a/gcc/d/dmd/identifier.d
+++ b/gcc/d/dmd/identifier.d
@@ -221,15 +221,16 @@ nothrow:
* Identifier (inside Identifier.idPool) with deterministic name based
* on the source location.
*/
- extern (D) static Identifier generateIdWithLoc(string prefix, const ref Loc loc, string parent = "")
+ extern (D) static Identifier generateIdWithLoc(string prefix, Loc loc, string parent = "")
{
// generate `<prefix>_L<line>_C<col>`
+ auto sl = SourceLoc(loc);
OutBuffer idBuf;
idBuf.writestring(prefix);
idBuf.writestring("_L");
- idBuf.print(loc.linnum);
+ idBuf.print(sl.line);
idBuf.writestring("_C");
- idBuf.print(loc.charnum);
+ idBuf.print(sl.column);
/**
* Make sure the identifiers are unique per filename, i.e., per module/mixin
@@ -247,13 +248,13 @@ nothrow:
* directly, but that would unnecessary lengthen symbols names. See issue:
* https://issues.dlang.org/show_bug.cgi?id=23722
*/
- static struct Key { Loc loc; string prefix; string parent; }
+ static struct Key { uint fileOffset; string prefix; string parent; }
__gshared uint[Key] counters;
static if (__traits(compiles, counters.update(Key.init, () => 0u, (ref uint a) => 0u)))
{
// 2.082+
- counters.update(Key(loc, prefix, parent),
+ counters.update(Key(loc.fileOffset, prefix, parent),
() => 1u, // insertion
(ref uint counter) // update
{
@@ -265,7 +266,7 @@ nothrow:
}
else
{
- const key = Key(loc, prefix, parent);
+ const key = Key(loc.fileOffset, prefix, parent);
if (auto pCounter = key in counters)
{
idBuf.writestring("_");
diff --git a/gcc/d/dmd/init.d b/gcc/d/dmd/init.d
index 934ccc6..7e7ac83 100644
--- a/gcc/d/dmd/init.d
+++ b/gcc/d/dmd/init.d
@@ -46,7 +46,7 @@ extern (C++) class Initializer : ASTNode
}
- extern (D) this(const ref Loc loc, InitKind kind) @safe
+ extern (D) this(Loc loc, InitKind kind) @safe
{
this.loc = loc;
this.kind = kind;
@@ -100,7 +100,7 @@ extern (C++) final class VoidInitializer : Initializer
{
Type type; // type that this will initialize to
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, InitKind.void_);
}
@@ -118,7 +118,7 @@ extern (C++) final class DefaultInitializer : Initializer
{
Type type; // type that this will initialize to
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, InitKind.default_);
}
@@ -151,7 +151,7 @@ extern (C++) final class StructInitializer : Initializer
Identifiers field; // of Identifier *'s
Initializers value; // parallel array of Initializer *'s
- extern (D) this(const ref Loc loc)
+ extern (D) this(Loc loc)
{
super(loc, InitKind.struct_);
}
@@ -179,7 +179,7 @@ extern (C++) final class ArrayInitializer : Initializer
Type type; // type that array will be used to initialize
bool isCarray; // C array semantics
- extern (D) this(const ref Loc loc)
+ extern (D) this(Loc loc)
{
super(loc, InitKind.array);
}
@@ -215,7 +215,7 @@ extern (C++) final class ExpInitializer : Initializer
bool expandTuples;
Expression exp;
- extern (D) this(const ref Loc loc, Expression exp) @safe
+ extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, InitKind.exp);
this.exp = exp;
@@ -257,7 +257,7 @@ extern (C++) final class CInitializer : Initializer
DesigInits initializerList; /// initializer-list
Type type; /// type that array will be used to initialize
- extern (D) this(const ref Loc loc)
+ extern (D) this(Loc loc)
{
super(loc, InitKind.C_);
}
diff --git a/gcc/d/dmd/json.d b/gcc/d/dmd/json.d
index 25b0812..05924f7 100644
--- a/gcc/d/dmd/json.d
+++ b/gcc/d/dmd/json.d
@@ -347,7 +347,7 @@ public:
}
}
- extern(D) void property(const char[] linename, const char[] charname, const ref Loc loc)
+ extern(D) void property(const char[] linename, const char[] charname, Loc loc)
{
if (loc.isValid())
{
diff --git a/gcc/d/dmd/lexer.d b/gcc/d/dmd/lexer.d
index 406829d..61b4f41 100644
--- a/gcc/d/dmd/lexer.d
+++ b/gcc/d/dmd/lexer.d
@@ -34,11 +34,6 @@ import dmd.tokens;
nothrow:
-version (DMDLIB)
-{
- version = LocOffset;
-}
-
/***********************************************************
* Values to use for various magic identifiers
*/
@@ -68,8 +63,10 @@ class Lexer
{
private __gshared OutBuffer stringbuffer;
+ BaseLoc* baseLoc; // Used to generate `scanloc`, which is just an index into this data structure
Loc scanloc; // for error messages
Loc prevloc; // location of token before current
+ int linnum; // current line number
const(char)* p; // current character
@@ -132,10 +129,11 @@ class Lexer
ErrorSink errorSink,
const CompileEnv* compileEnv) scope
{
- scanloc = Loc(filename, 1, 1);
// debug printf("Lexer::Lexer(%p)\n", base);
// debug printf("lexer.filename = %s\n", filename);
token = Token.init;
+ this.baseLoc = newBaseLoc(filename, endoffset);
+ this.linnum = 1;
this.base = base;
this.end = base + endoffset;
p = base + begoffset;
@@ -225,7 +223,9 @@ class Lexer
tokenizeNewlines = true;
inTokenStringConstant = 0;
lastDocLine = 0;
- scanloc = Loc("#defines", 1, 1);
+
+ baseLoc = newBaseLoc("#defines", slice.length);
+ scanloc = baseLoc.getLoc(0);
}
/**********************************
@@ -319,7 +319,7 @@ class Lexer
*/
final void scan(Token* t)
{
- const lastLine = scanloc.linnum;
+ const lastLine = linnum;
Loc startLoc;
t.blockComment = null;
t.lineComment = null;
@@ -897,7 +897,7 @@ class Lexer
{
// if /** but not /**/
getDocComment(t, lastLine == startLoc.linnum, startLoc.linnum - lastDocLine > 1);
- lastDocLine = scanloc.linnum;
+ lastDocLine = linnum;
}
continue;
case '/': // do // style comments
@@ -925,7 +925,7 @@ class Lexer
if (doDocComment && t.ptr[2] == '/')
{
getDocComment(t, lastLine == startLoc.linnum, startLoc.linnum - lastDocLine > 1);
- lastDocLine = scanloc.linnum;
+ lastDocLine = linnum;
}
p = end;
t.loc = loc();
@@ -957,7 +957,7 @@ class Lexer
if (doDocComment && t.ptr[2] == '/')
{
getDocComment(t, lastLine == startLoc.linnum, startLoc.linnum - lastDocLine > 1);
- lastDocLine = scanloc.linnum;
+ lastDocLine = linnum;
}
p++;
endOfLine();
@@ -1029,7 +1029,7 @@ class Lexer
{
// if /++ but not /++/
getDocComment(t, lastLine == startLoc.linnum, startLoc.linnum - lastDocLine > 1);
- lastDocLine = scanloc.linnum;
+ lastDocLine = linnum;
}
continue;
}
@@ -1464,7 +1464,7 @@ class Lexer
* Returns:
* the escape sequence as a single character
*/
- private dchar escapeSequence(const ref Loc loc, ref const(char)* sequence, bool Ccompile, out dchar c2)
+ private dchar escapeSequence(Loc loc, ref const(char)* sequence, bool Ccompile, out dchar c2)
{
const(char)* p = sequence; // cache sequence reference on stack
scope(exit) sequence = p;
@@ -3154,9 +3154,7 @@ class Lexer
final Loc loc() @nogc
{
- scanloc.charnum = cast(ushort)(1 + p - line);
- version (LocOffset)
- scanloc.fileOffset = cast(uint)(p - base);
+ scanloc = baseLoc.getLoc(cast(uint) (p - base));
return scanloc;
}
@@ -3165,7 +3163,7 @@ class Lexer
eSink.error(token.loc, format, args);
}
- void error(T...)(const ref Loc loc, const(char)* format, T args)
+ void error(T...)(Loc loc, const(char)* format, T args)
{
eSink.error(loc, format, args);
}
@@ -3175,12 +3173,12 @@ class Lexer
eSink.errorSupplemental(token.loc, format, args);
}
- void deprecation(T...)(const ref Loc loc, const(char)* format, T args)
+ void deprecation(T...)(Loc loc, const(char)* format, T args)
{
eSink.deprecation(loc, format, args);
}
- void warning(T...)(const ref Loc loc, const(char)* format, T args)
+ void warning(T...)(Loc loc, const(char)* format, T args)
{
eSink.warning(loc, format, args);
}
@@ -3251,7 +3249,6 @@ class Lexer
*/
final void poundLine(ref Token tok, bool linemarker)
{
- auto linnum = this.scanloc.linnum;
const(char)* filespec = null;
bool flags;
@@ -3288,9 +3285,7 @@ class Lexer
case TOK.endOfLine:
if (!inTokenStringConstant)
{
- this.scanloc.linnum = linnum;
- if (filespec)
- this.scanloc.filename = filespec;
+ baseLoc.addSubstitution(cast(uint) (p - base), filespec, linnum);
}
return;
case TOK.file:
@@ -3589,10 +3584,11 @@ class Lexer
/**************************
* `p` should be at start of next line
*/
- private void endOfLine() @nogc @safe
+ private void endOfLine() @safe
{
- scanloc.linnum = scanloc.linnum + 1;
+ linnum += 1;
line = p;
+ baseLoc.newLine(cast(uint)(p - base));
}
/****************************
@@ -3682,7 +3678,7 @@ unittest
string expectedSupplemental;
bool gotError;
- void verror(const ref Loc loc, const(char)* format, va_list ap)
+ void verror(Loc loc, const(char)* format, va_list ap)
{
gotError = true;
char[100] buffer = void;
@@ -3690,7 +3686,7 @@ unittest
assert(expected == actual);
}
- void errorSupplemental(const ref Loc loc, const(char)* format, ...)
+ void errorSupplemental(Loc loc, const(char)* format, ...)
{
gotError = true;
char[128] buffer = void;
diff --git a/gcc/d/dmd/location.d b/gcc/d/dmd/location.d
index 75cd068..8a27541 100644
--- a/gcc/d/dmd/location.d
+++ b/gcc/d/dmd/location.d
@@ -18,11 +18,6 @@ import dmd.root.array;
import dmd.root.filename;
import dmd.root.string: toDString;
-version (DMDLIB)
-{
- version = LocOffset;
-}
-
/// How code locations are formatted for diagnostic reporting
enum MessageStyle : ubyte
{
@@ -38,19 +33,19 @@ debug info etc.
*/
struct Loc
{
- private uint _linnum;
- private uint _charnum;
- private uint fileIndex; // index into filenames[], starting from 1 (0 means no filename)
- version (LocOffset)
- uint fileOffset; /// utf8 code unit index relative to start of file, starting from 0
+ private uint index = 0; // offset into lineTable[]
+
+ // FIXME: This arbitrary size increase is needed to prevent segfault in
+ // runnable/test42.d on Ubuntu x86 when DMD was built with DMD 2.105 .. 2.110
+ // https://github.com/dlang/dmd/pull/20777#issuecomment-2614128849
+ version (DigitalMars) version (linux) version (X86)
+ private uint dummy;
- static immutable Loc initial; /// use for default initialization of const ref Loc's
+ static immutable Loc initial; /// use for default initialization of Loc's
extern (C++) __gshared bool showColumns;
extern (C++) __gshared MessageStyle messageStyle;
- __gshared Array!(const(char)*) filenames;
-
nothrow:
/*******************************
@@ -65,45 +60,34 @@ nothrow:
this.messageStyle = messageStyle;
}
- extern (C++) this(const(char)* filename, uint linnum, uint charnum) @safe
+ /// Returns: a Loc that simply holds a filename, with no line / column info
+ extern (C++) static Loc singleFilename(const char* filename)
{
- this._linnum = linnum;
- this._charnum = charnum;
- this.filename = filename;
+ Loc result;
+ locFileTable ~= BaseLoc(filename.toDString, locIndex, 0, [0]);
+ result.index = locIndex++;
+ return result;
}
/// utf8 code unit index relative to start of line, starting from 1
extern (C++) uint charnum() const @nogc @safe
{
- return _charnum;
- }
-
- /// ditto
- extern (C++) uint charnum(uint num) @nogc @safe
- {
- return _charnum = num;
+ return SourceLoc(this).column;
}
/// line number, starting from 1
- extern (C++) uint linnum() const @nogc @safe
- {
- return _linnum;
- }
-
- /// ditto
- extern (C++) uint linnum(uint num) @nogc @safe
+ extern (C++) uint linnum() const @nogc @trusted
{
- return _linnum = num;
+ return SourceLoc(this).line;
}
/// Advance this location to the first column of the next line
void nextLine()
{
- if (this._linnum)
- {
- this._linnum++;
- this.charnum = 0;
- }
+ const i = fileTableIndex(this.index);
+ const j = locFileTable[i].getLineIndex(this.index - locFileTable[i].startIndex);
+ if (j + 1 < locFileTable[i].lines.length)
+ index = locFileTable[i].startIndex + locFileTable[i].lines[j + 1];
}
/***
@@ -111,25 +95,7 @@ nothrow:
*/
extern (C++) const(char)* filename() const @nogc
{
- return fileIndex ? filenames[fileIndex - 1] : null;
- }
-
- /***
- * Set file name for this location
- * Params:
- * name = file name for location, null for no file name
- */
- extern (C++) void filename(const(char)* name) @trusted
- {
- if (name)
- {
- //printf("setting %s\n", name);
- filenames.push(name);
- fileIndex = cast(uint)filenames.length;
- assert(fileIndex, "internal compiler error: file name index overflow");
- }
- else
- fileIndex = 0;
+ return SourceLoc(this).filename.ptr; // _filename;
}
extern (C++) const(char)* toChars(
@@ -139,6 +105,19 @@ nothrow:
return SourceLoc(this).toChars(showColumns, messageStyle);
}
+ /// Returns: byte offset into source file
+ uint fileOffset() const
+ {
+ const i = fileTableIndex(this.index);
+ return this.index - locFileTable[i].startIndex;
+ }
+
+ /// Returns: this location as a SourceLoc
+ extern (C++) SourceLoc toSourceLoc() const @nogc @safe
+ {
+ return SourceLoc(this);
+ }
+
/**
* Checks for equivalence by comparing the filename contents (not the pointer) and character location.
*
@@ -146,7 +125,7 @@ nothrow:
* - Uses case-insensitive comparison on Windows
* - Ignores `charnum` if `Columns` is false.
*/
- extern (C++) bool equals(ref const(Loc) loc) const
+ extern (C++) bool equals(Loc loc) const
{
SourceLoc lhs = SourceLoc(this);
SourceLoc rhs = SourceLoc(loc);
@@ -165,23 +144,13 @@ nothrow:
*/
extern (D) bool opEquals(ref const(Loc) loc) const @trusted nothrow @nogc
{
- import core.stdc.string : strcmp;
-
- return charnum == loc.charnum &&
- linnum == loc.linnum &&
- (filename == loc.filename ||
- (filename && loc.filename && strcmp(filename, loc.filename) == 0));
+ return this.index == loc.index;
}
/// ditto
extern (D) size_t toHash() const @trusted nothrow
{
- import dmd.root.string : toDString;
-
- auto hash = hashOf(linnum);
- hash = hashOf(charnum, hash);
- hash = hashOf(filename.toDString, hash);
- return hash;
+ return hashOf(this.index);
}
/******************
@@ -190,7 +159,7 @@ nothrow:
*/
bool isValid() const pure @safe
{
- return fileIndex != 0;
+ return this.index != 0;
}
}
@@ -252,23 +221,27 @@ struct SourceLoc
const(char)[] filename; /// name of source file
uint line; /// line number (starts at 1)
uint column; /// column number (starts at 1)
+ uint fileOffset; /// byte index into file
// aliases for backwards compatibility
alias linnum = line;
alias charnum = column;
- this(const(char)[] filename, uint line, uint column) nothrow
+ this(const(char)[] filename, uint line, uint column, uint fileOffset = 0) nothrow @nogc pure @safe
{
this.filename = filename;
this.line = line;
this.column = column;
+ this.fileOffset = fileOffset;
}
- this(Loc loc) nothrow
+ this(Loc loc) nothrow @nogc @trusted
{
- this.filename = loc.filename.toDString();
- this.line = loc.linnum;
- this.column = loc.charnum;
+ if (loc.index == 0 || locFileTable.length == 0)
+ return;
+
+ const i = fileTableIndex(loc.index);
+ this = locFileTable[i].getSourceLoc(loc.index - locFileTable[i].startIndex);
}
extern (C++) const(char)* toChars(
@@ -284,4 +257,196 @@ struct SourceLoc
{
return this.filename == other.filename && this.line == other.line && this.column == other.column;
}
+
+}
+
+/// Given the `index` of a `Loc`, find the index in `locFileTable` of the corresponding `BaseLoc`
+private size_t fileTableIndex(uint index) nothrow @nogc
+{
+ // To speed up linear find, we cache the last hit and compare that first,
+ // since usually we stay in the same file for some time when resolving source locations.
+ // If it's a different file now, either scan forwards / backwards
+ __gshared size_t lastI = 0; // index of last found hit
+
+ size_t i = lastI;
+ if (index >= locFileTable[i].startIndex)
+ {
+ while (i + 1 < locFileTable.length && index >= locFileTable[i+1].startIndex)
+ i++;
+ }
+ else
+ {
+ while (index < locFileTable[i].startIndex)
+ i--;
+ }
+
+ lastI = i;
+ return i;
+}
+
+/**
+ * Create a new source location map for a file
+ * Params:
+ * filename = source file name
+ * size = space to reserve for locations, equal to the file size in bytes
+ * Returns: new BaseLoc
+ */
+BaseLoc* newBaseLoc(const(char)* filename, size_t size) nothrow
+{
+ locFileTable ~= BaseLoc(filename.toDString, locIndex, 1, [0]);
+ // Careful: the endloc of a FuncDeclaration can
+ // point to 1 past the very last byte in the file, so account for that
+ locIndex += size + 1;
+ return &locFileTable[$ - 1];
+}
+
+/**
+Mapping from byte offset into source file to line/column numbers
+
+Consider this 4-line 24 byte source file:
+
+---
+app.d
+1 struct S
+2 {
+3 int y;
+4 }
+---
+
+Loc(0) is reserved for null locations, so the first `BaseLoc` gets `startIndex = 1`
+and reserves 25 possible positions. Loc(1) represents the very start of this source
+file, and every next byte gets the next `Loc`, up to Loc(25) which represents the
+location right past the very last `}` character (hence it's 1 more than the file
+size of 24, classic fence post problem!).
+
+The next source file will get `Loc(26) .. Loc(26 + fileSize + 1)` etc.
+
+Now say we know that `int y` has a `Loc(20)` and we want to know the line and column number.
+
+First we find the corresponding `BaseLoc` in `locFileTable`. Since 20 < 26, the first `BaseLoc`
+contains this location. Since `startIndex = 1`, we subtract that to get a file offset 19.
+
+To get the line number from the file offset, we binary search into the `lines` array,
+which contains file offsets where each line starts:
+
+`locFileTable[0].lines == [0, 9, 11, 22, 24]`
+
+We see 14 would be inserted right after `11` at `lines[2]`, so it's line 3 (+1 for 1-indexing).
+Since line 3 starts at file offset 11, and `14 - 11 = 3`, it's column 4 (again, accounting for 1-indexing)
+
+#line and #file directives are handled with a separate array `substitutions` because they're rare,
+and we don't want to penalize memory usage in their absence.
+*/
+struct BaseLoc
+{
+@safe nothrow:
+
+ const(char)[] filename; /// Source file name
+ uint startIndex; /// Subtract this from Loc.index to get file offset
+ int startLine = 1; /// Line number at index 0
+ uint[] lines; /// For each line, the file offset at which it starts. At index 0 there's always a 0 entry.
+ BaseLoc[] substitutions; /// Substitutions from #line / #file directives
+
+ /// Register that a new line starts at `offset` bytes from the start of the source file
+ void newLine(uint offset)
+ {
+ lines ~= offset;
+ }
+
+ /// Construct a `Loc` entry for the start of the source file + `offset` bytes
+ Loc getLoc(uint offset) @nogc
+ {
+ Loc result;
+ result.index = startIndex + offset;
+ return result;
+ }
+
+ /**
+ * Register a new file/line mapping from #file and #line directives
+ * Params:
+ * offset = byte offset in the source file at which the substitution starts
+ * filename = new filename from this point on (null = unchanged)
+ * line = line number from this point on
+ */
+ void addSubstitution(uint offset, const(char)* filename, uint line) @system
+ {
+ auto fname = filename.toDString;
+ if (substitutions.length == 0)
+ substitutions ~= BaseLoc(this.filename, 0, 0);
+
+ if (fname.length == 0)
+ fname = substitutions[$ - 1].filename;
+ substitutions ~= BaseLoc(fname, offset, cast(int) (line - lines.length + startLine - 2));
+ }
+
+ /// Returns: `loc` modified by substitutions from #file / #line directives
+ SourceLoc substitute(SourceLoc loc) @nogc
+ {
+ if (substitutions.length == 0)
+ return loc;
+
+ const offset = loc.fileOffset;
+ size_t lo = 0;
+ size_t hi = substitutions.length + -1;
+ size_t mid = 0;
+ while (lo <= hi)
+ {
+ mid = lo + (hi - lo) / 2;
+ if (substitutions[mid].startIndex <= offset)
+ {
+ if (mid == substitutions.length - 1 || substitutions[mid + 1].startIndex > offset)
+ {
+ if (substitutions[mid].filename.length > 0)
+ loc.filename = substitutions[mid].filename;
+ loc.linnum += substitutions[mid].startLine;
+ return loc;
+ }
+
+ lo = mid + 1;
+ }
+ else
+ {
+ hi = mid - 1;
+ }
+ }
+ assert(0);
+ }
+
+ /// Resolve an offset into this file to a filename + line + column
+ private SourceLoc getSourceLoc(uint offset) @nogc
+ {
+ const i = getLineIndex(offset);
+ const sl = SourceLoc(filename, cast(int) (i + startLine), cast(int) (1 + offset - lines[i]), offset);
+ return substitute(sl);
+ }
+
+ /// Binary search the index in `this.lines` corresponding to `offset`
+ private size_t getLineIndex(uint offset) @nogc
+ {
+ size_t lo = 0;
+ size_t hi = lines.length + -1;
+ size_t mid = 0;
+ while (lo <= hi)
+ {
+ mid = lo + (hi - lo) / 2;
+ if (lines[mid] <= offset)
+ {
+ if (mid == lines.length - 1 || lines[mid + 1] > offset)
+ return mid;
+
+ lo = mid + 1;
+ }
+ else
+ {
+ hi = mid - 1;
+ }
+ }
+ assert(0);
+ }
}
+
+// Whenever a new source file is parsed, start the `Loc` from this index (0 is reserved for Loc.init)
+private __gshared uint locIndex = 1;
+
+// Global mapping of Loc indices to source file offset/line/column, see `BaseLoc`
+private __gshared BaseLoc[] locFileTable;
diff --git a/gcc/d/dmd/module.h b/gcc/d/dmd/module.h
index fd01e73..82e1b4a 100644
--- a/gcc/d/dmd/module.h
+++ b/gcc/d/dmd/module.h
@@ -123,10 +123,10 @@ public:
static Module* create(const char *arg, Identifier *ident, int doDocComment, int doHdrGen);
static const char *find(const char *filename);
- static Module *load(const Loc &loc, Identifiers *packages, Identifier *ident);
+ static Module *load(Loc loc, Identifiers *packages, Identifier *ident);
const char *kind() const override;
- bool read(const Loc &loc); // read file, returns 'true' if succeed, 'false' otherwise.
+ bool read(Loc loc); // read file, returns 'true' if succeed, 'false' otherwise.
Module *parse(); // syntactic parse
int needModuleInfo();
bool isPackageAccessible(Package *p, Visibility visibility, SearchOptFlags flags = (SearchOptFlags)SearchOpt::all) override;
diff --git a/gcc/d/dmd/mtype.d b/gcc/d/dmd/mtype.d
index 81f8a98..1cebcc8 100644
--- a/gcc/d/dmd/mtype.d
+++ b/gcc/d/dmd/mtype.d
@@ -1327,7 +1327,7 @@ extern (C++) abstract class Type : ASTNode
* Use when we prefer the default initializer to be a literal,
* rather than a global immutable variable.
*/
- Expression defaultInitLiteral(const ref Loc loc)
+ Expression defaultInitLiteral(Loc loc)
{
static if (LOGDEFAULTINIT)
{
@@ -1572,7 +1572,7 @@ extern (C++) final class TypeError : Type
return this;
}
- override Expression defaultInitLiteral(const ref Loc loc)
+ override Expression defaultInitLiteral(Loc loc)
{
return ErrorExp.get();
}
@@ -2118,7 +2118,7 @@ extern (C++) final class TypeVector : Type
return false;
}
- override Expression defaultInitLiteral(const ref Loc loc)
+ override Expression defaultInitLiteral(Loc loc)
{
//printf("TypeVector::defaultInitLiteral()\n");
assert(basetype.ty == Tsarray);
@@ -2219,7 +2219,7 @@ extern (C++) final class TypeSArray : TypeArray
return next.alignment();
}
- override Expression defaultInitLiteral(const ref Loc loc)
+ override Expression defaultInitLiteral(Loc loc)
{
static if (LOGDEFAULTINIT)
{
@@ -2814,7 +2814,7 @@ extern (C++) final class TypeTraits : Type
/// Cached type/symbol after semantic analysis.
RootObject obj;
- final extern (D) this(const ref Loc loc, TraitsExp exp) @safe
+ final extern (D) this(Loc loc, TraitsExp exp) @safe
{
super(Ttraits);
this.loc = loc;
@@ -2851,7 +2851,7 @@ extern (C++) final class TypeMixin : Type
Expressions* exps;
RootObject obj; // cached result of semantic analysis.
- extern (D) this(const ref Loc loc, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expressions* exps) @safe
{
super(Tmixin);
this.loc = loc;
@@ -2962,13 +2962,13 @@ extern (C++) final class TypeIdentifier : TypeQualified
// The symbol representing this identifier, before alias resolution
Dsymbol originalSymbol;
- extern (D) this(const ref Loc loc, Identifier ident)
+ extern (D) this(Loc loc, Identifier ident)
{
super(Tident, loc);
this.ident = ident;
}
- static TypeIdentifier create(const ref Loc loc, Identifier ident)
+ static TypeIdentifier create(Loc loc, Identifier ident)
{
return new TypeIdentifier(loc, ident);
}
@@ -2999,7 +2999,7 @@ extern (C++) final class TypeInstance : TypeQualified
{
TemplateInstance tempinst;
- extern (D) this(const ref Loc loc, TemplateInstance tempinst)
+ extern (D) this(Loc loc, TemplateInstance tempinst)
{
super(Tinstance, loc);
this.tempinst = tempinst;
@@ -3032,7 +3032,7 @@ extern (C++) final class TypeTypeof : TypeQualified
Expression exp;
int inuse;
- extern (D) this(const ref Loc loc, Expression exp)
+ extern (D) this(Loc loc, Expression exp)
{
super(Ttypeof, loc);
this.exp = exp;
@@ -3062,7 +3062,7 @@ extern (C++) final class TypeTypeof : TypeQualified
*/
extern (C++) final class TypeReturn : TypeQualified
{
- extern (D) this(const ref Loc loc)
+ extern (D) this(Loc loc)
{
super(Treturn, loc);
}
@@ -3132,7 +3132,7 @@ extern (C++) final class TypeStruct : Type
* Use when we prefer the default initializer to be a literal,
* rather than a global immutable variable.
*/
- override Expression defaultInitLiteral(const ref Loc loc)
+ override Expression defaultInitLiteral(Loc loc)
{
static if (LOGDEFAULTINIT)
{
@@ -3769,7 +3769,7 @@ extern (C++) final class TypeTag : Type
/// struct S { int a; } s1, *s2;
MOD mod; /// modifiers to apply after type is resolved (only MODFlags.const_ at the moment)
- extern (D) this(const ref Loc loc, TOK tok, Identifier id, structalign_t packalign, Type base, Dsymbols* members) @safe
+ extern (D) this(Loc loc, TOK tok, Identifier id, structalign_t packalign, Type base, Dsymbols* members) @safe
{
//printf("TypeTag ctor %s %p\n", id ? id.toChars() : "null".ptr, this);
super(Ttag);
@@ -3917,7 +3917,7 @@ extern (C++) final class Parameter : ASTNode
Expression defaultArg;
UserAttributeDeclaration userAttribDecl; // user defined attributes
- extern (D) this(const ref Loc loc, StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl) @safe
+ extern (D) this(Loc loc, StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl) @safe
{
this.loc = loc;
this.type = type;
@@ -3927,7 +3927,7 @@ extern (C++) final class Parameter : ASTNode
this.userAttribDecl = userAttribDecl;
}
- static Parameter create(const ref Loc loc, StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl) @safe
+ static Parameter create(Loc loc, StorageClass storageClass, Type type, Identifier ident, Expression defaultArg, UserAttributeDeclaration userAttribDecl) @safe
{
return new Parameter(loc, storageClass, type, ident, defaultArg, userAttribDecl);
}
diff --git a/gcc/d/dmd/mtype.h b/gcc/d/dmd/mtype.h
index e69d2ba..0cf08e7 100644
--- a/gcc/d/dmd/mtype.h
+++ b/gcc/d/dmd/mtype.h
@@ -42,7 +42,7 @@ typedef struct TYPE type;
namespace dmd
{
- Type *typeSemantic(Type *t, const Loc &loc, Scope *sc);
+ Type *typeSemantic(Type *t, Loc loc, Scope *sc);
Type *merge(Type *type);
}
@@ -268,7 +268,7 @@ public:
virtual ClassDeclaration *isClassHandle();
virtual structalign_t alignment();
- virtual Expression *defaultInitLiteral(const Loc &loc);
+ virtual Expression *defaultInitLiteral(Loc loc);
virtual int hasWild() const;
virtual bool hasVoidInitPointers();
virtual bool hasUnsafeBitpatterns();
@@ -318,7 +318,7 @@ public:
const char *kind() override;
TypeError *syntaxCopy() override;
- Expression *defaultInitLiteral(const Loc &loc) override;
+ Expression *defaultInitLiteral(Loc loc) override;
void accept(Visitor *v) override { v->visit(this); }
};
@@ -379,7 +379,7 @@ public:
bool isScalar() override;
bool isUnsigned() override;
bool isBoolean() override;
- Expression *defaultInitLiteral(const Loc &loc) override;
+ Expression *defaultInitLiteral(Loc loc) override;
TypeBasic *elementType();
void accept(Visitor *v) override { v->visit(this); }
@@ -403,7 +403,7 @@ public:
unsigned alignsize() override;
bool isString() override;
structalign_t alignment() override;
- Expression *defaultInitLiteral(const Loc &loc) override;
+ Expression *defaultInitLiteral(Loc loc) override;
bool hasUnsafeBitpatterns() override;
bool hasVoidInitPointers() override;
bool hasInvariant() override;
@@ -498,7 +498,7 @@ public:
Expression *defaultArg;
UserAttributeDeclaration *userAttribDecl; // user defined attributes
- static Parameter *create(const Loc &loc, StorageClass storageClass, Type *type, Identifier *ident,
+ static Parameter *create(Loc loc, StorageClass storageClass, Type *type, Identifier *ident,
Expression *defaultArg, UserAttributeDeclaration *userAttribDecl);
Parameter *syntaxCopy();
Type *isLazyArray();
@@ -632,7 +632,7 @@ public:
Identifier *ident;
Dsymbol *originalSymbol; // The symbol representing this identifier, before alias resolution
- static TypeIdentifier *create(const Loc &loc, Identifier *ident);
+ static TypeIdentifier *create(Loc loc, Identifier *ident);
const char *kind() override;
TypeIdentifier *syntaxCopy() override;
void accept(Visitor *v) override { v->visit(this); }
@@ -693,7 +693,7 @@ public:
unsigned alignsize() override;
TypeStruct *syntaxCopy() override;
structalign_t alignment() override;
- Expression *defaultInitLiteral(const Loc &loc) override;
+ Expression *defaultInitLiteral(Loc loc) override;
bool isAssignable() override;
bool isBoolean() override;
bool needsDestruction() override;
@@ -715,7 +715,7 @@ public:
const char *kind() override;
TypeEnum *syntaxCopy() override;
unsigned alignsize() override;
- Type *memType(const Loc &loc);
+ Type *memType(Loc loc);
bool isIntegral() override;
bool isFloating() override;
bool isReal() override;
@@ -825,8 +825,8 @@ namespace dmd
bool equivalent(Type *src, Type *t);
Covariant covariant(Type *, Type *, StorageClass * = nullptr, bool = false);
bool isBaseOf(Type *tthis, Type *t, int *poffset);
- bool isZeroInit(Type *t, const Loc &loc = Loc());
- Type *trySemantic(Type *type, const Loc &loc, Scope *sc);
+ bool isZeroInit(Type *t, Loc loc = Loc());
+ Type *trySemantic(Type *type, Loc loc, Scope *sc);
Type *pointerTo(Type *type);
Type *referenceTo(Type *type);
Type *merge2(Type *type);
@@ -850,7 +850,7 @@ namespace dmd
Type *addStorageClass(Type *type, StorageClass stc);
Type *substWildTo(Type *type, unsigned mod);
uinteger_t size(Type *type);
- uinteger_t size(Type *type, const Loc &loc);
+ uinteger_t size(Type *type, Loc loc);
MATCH implicitConvTo(Type* from, Type* to);
MATCH constConv(Type* from, Type* to);
}
diff --git a/gcc/d/dmd/nogc.d b/gcc/d/dmd/nogc.d
index d9a742f..1dd6a27 100644
--- a/gcc/d/dmd/nogc.d
+++ b/gcc/d/dmd/nogc.d
@@ -242,7 +242,7 @@ Expression checkGC(Scope* sc, Expression e)
return e;
}
-extern (D) void printGCUsage(FuncDeclaration fd, const ref Loc loc, const(char)* warn)
+extern (D) void printGCUsage(FuncDeclaration fd, Loc loc, const(char)* warn)
{
if (!global.params.v.gc)
return;
diff --git a/gcc/d/dmd/nspace.d b/gcc/d/dmd/nspace.d
index 52c2b79..0014ec6 100644
--- a/gcc/d/dmd/nspace.d
+++ b/gcc/d/dmd/nspace.d
@@ -62,7 +62,7 @@ extern (C++) final class Nspace : ScopeDsymbol
*/
Expression identExp;
- extern (D) this(const ref Loc loc, Identifier ident, Expression identExp, Dsymbols* members)
+ extern (D) this(Loc loc, Identifier ident, Expression identExp, Dsymbols* members)
{
super(loc, ident);
//printf("Nspace::Nspace(ident = %s)\n", ident.toChars());
diff --git a/gcc/d/dmd/ob.d b/gcc/d/dmd/ob.d
index 5e773f0..5acc69f 100644
--- a/gcc/d/dmd/ob.d
+++ b/gcc/d/dmd/ob.d
@@ -1336,7 +1336,7 @@ void genKill(ref ObState obstate, ObNode* ob)
}
}
- void dgReadVar(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable)
+ void dgReadVar(Loc loc, ObNode* ob, VarDeclaration v, bool mutable)
{
if (log)
printf("dgReadVar() %s %d\n", v.toChars(), mutable);
@@ -1351,12 +1351,12 @@ void genKill(ref ObState obstate, ObNode* ob)
{
alias visit = typeof(super).visit;
extern (D) void delegate(ObNode*, VarDeclaration, Expression, bool) dgWriteVar;
- extern (D) void delegate(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable) dgReadVar;
+ extern (D) void delegate(Loc loc, ObNode* ob, VarDeclaration v, bool mutable) dgReadVar;
ObNode* ob;
ObState* obstate;
extern (D) this(void delegate(ObNode*, VarDeclaration, Expression, bool) dgWriteVar,
- void delegate(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable) dgReadVar,
+ void delegate(Loc loc, ObNode* ob, VarDeclaration v, bool mutable) dgReadVar,
ObNode* ob, ref ObState obstate) scope
{
this.dgWriteVar = dgWriteVar;
@@ -2085,7 +2085,7 @@ void checkObErrors(ref ObState obstate)
}
}
- void dgReadVar(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[] gen)
+ void dgReadVar(Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[] gen)
{
if (log) printf("dgReadVar() %s\n", v.toChars());
const vi = obstate.vars.find(v);
@@ -2103,12 +2103,12 @@ void checkObErrors(ref ObState obstate)
{
alias visit = typeof(super).visit;
extern (D) void delegate(ObNode*, PtrVarState[], VarDeclaration, Expression) dgWriteVar;
- extern (D) void delegate(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[]) dgReadVar;
+ extern (D) void delegate(Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[]) dgReadVar;
PtrVarState[] cpvs;
ObNode* ob;
ObState* obstate;
- extern (D) this(void delegate(const ref Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[]) dgReadVar,
+ extern (D) this(void delegate(Loc loc, ObNode* ob, VarDeclaration v, bool mutable, PtrVarState[]) dgReadVar,
void delegate(ObNode*, PtrVarState[], VarDeclaration, Expression) dgWriteVar,
PtrVarState[] cpvs, ObNode* ob, ref ObState obstate) scope
{
diff --git a/gcc/d/dmd/opover.d b/gcc/d/dmd/opover.d
index ac9e072..7353532 100644
--- a/gcc/d/dmd/opover.d
+++ b/gcc/d/dmd/opover.d
@@ -1157,7 +1157,7 @@ private Expression compare_overload(BinExp e, Scope* sc, Identifier id, ref EXP
/***********************************
* Utility to build a function call out of this reference and argument.
*/
-Expression build_overload(const ref Loc loc, Scope* sc, Expression ethis, Expression earg, Dsymbol d)
+Expression build_overload(Loc loc, Scope* sc, Expression ethis, Expression earg, Dsymbol d)
{
assert(d);
Expression e;
diff --git a/gcc/d/dmd/optimize.d b/gcc/d/dmd/optimize.d
index 282575d..b66ddcb 100644
--- a/gcc/d/dmd/optimize.d
+++ b/gcc/d/dmd/optimize.d
@@ -1002,7 +1002,7 @@ Expression optimize(Expression e, int result, bool keepLvalue = false)
}
}
- extern (D) void shift_optimize(BinExp e, UnionExp function(const ref Loc, Type, Expression, Expression) shift)
+ extern (D) void shift_optimize(BinExp e, UnionExp function(Loc, Type, Expression, Expression) shift)
{
if (binOptimize(e, result))
return;
diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d
index 33472c8..121f990 100644
--- a/gcc/d/dmd/parse.d
+++ b/gcc/d/dmd/parse.d
@@ -54,7 +54,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
* Input:
* loc = location in source file of mixin
*/
- extern (D) this(const ref Loc loc, AST.Module _module, const(char)[] input, bool doDocComment,
+ extern (D) this(Loc loc, AST.Module _module, const(char)[] input, bool doDocComment,
ErrorSink errorSink, const CompileEnv* compileEnv, const bool doUnittests) scope
{
//printf("Parser::Parser()1 %d\n", doUnittests);
@@ -1311,7 +1311,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
return 0;
}
- AST.Expression templateArgToExp(RootObject o, const ref Loc loc)
+ AST.Expression templateArgToExp(RootObject o, Loc loc)
{
switch (o.dyncast)
{
diff --git a/gcc/d/dmd/root/longdouble.d b/gcc/d/dmd/root/longdouble.d
index 0fe4c662..d9f5c0e 100644
--- a/gcc/d/dmd/root/longdouble.d
+++ b/gcc/d/dmd/root/longdouble.d
@@ -43,7 +43,7 @@ pure:
extern (D) longdouble opAssign(T)(T r)
if (is (T : longdouble))
{
- this.realvalue = r.realvalue;
+ this.realvalue = r.realvalue;
return this;
}
diff --git a/gcc/d/dmd/scope.h b/gcc/d/dmd/scope.h
index 0bde3d7..428f543 100644
--- a/gcc/d/dmd/scope.h
+++ b/gcc/d/dmd/scope.h
@@ -58,10 +58,10 @@ struct Scope final
VarDeclaration *varDecl; // variable we are in during semantic2
Dsymbol *parent; // parent to use
LabelStatement *slabel; // enclosing labelled statement
- SwitchStatement *sw; // enclosing switch statement
+ SwitchStatement *switchStatement; // enclosing switch statement
Statement *tryBody; // enclosing _body of TryCatchStatement or TryFinallyStatement
- TryFinallyStatement *tf; // enclosing try finally statement
- ScopeGuardStatement *os; // enclosing scope(xxx) statement
+ TryFinallyStatement *tryFinally; // enclosing try finally statement
+ ScopeGuardStatement *scopeGuard; // enclosing scope(xxx) statement
Statement *sbreak; // enclosing statement that supports "break"
Statement *scontinue; // enclosing statement that supports "continue"
ForeachStatement *fes; // if nested function for ForeachStatement, this is it
@@ -142,5 +142,5 @@ struct Scope final
// do not set wasRead for it
StructDeclaration *argStruct; // elimiate recursion when looking for rvalue construction
- Dsymbol *search(const Loc &loc, Identifier *ident, Dsymbol *&pscopesym, SearchOptFlags flags = (SearchOptFlags)SearchOpt::all);
+ Dsymbol *search(Loc loc, Identifier *ident, Dsymbol *&pscopesym, SearchOptFlags flags = (SearchOptFlags)SearchOpt::all);
};
diff --git a/gcc/d/dmd/semantic3.d b/gcc/d/dmd/semantic3.d
index 89f612c..5d7f8bc 100644
--- a/gcc/d/dmd/semantic3.d
+++ b/gcc/d/dmd/semantic3.d
@@ -338,7 +338,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
sc2.ctorflow.callSuper = CSX.none;
sc2.sbreak = null;
sc2.scontinue = null;
- sc2.sw = null;
+ sc2.switchStatement = null;
sc2.fes = funcdecl.fes;
sc2.linkage = funcdecl.isCsymbol() ? LINK.c : LINK.d;
sc2.stc &= STC.flowThruFunction;
@@ -350,8 +350,8 @@ private extern(C++) final class Semantic3Visitor : Visitor
sc2.copyFlagsFrom(sc);
sc2.contract = Contract.none;
}
- sc2.tf = null;
- sc2.os = null;
+ sc2.tryFinally = null;
+ sc2.scopeGuard = null;
sc2.inLoop = false;
sc2.inDefaultArg = false;
sc2.userAttribDecl = null;
diff --git a/gcc/d/dmd/statement.d b/gcc/d/dmd/statement.d
index 25c9eef..3b5f5f8 100644
--- a/gcc/d/dmd/statement.d
+++ b/gcc/d/dmd/statement.d
@@ -47,7 +47,7 @@ extern (C++) abstract class Statement : ASTNode
return DYNCAST.statement;
}
- final extern (D) this(const ref Loc loc, STMT stmt) @safe
+ final extern (D) this(Loc loc, STMT stmt) @safe
{
this.loc = loc;
this.stmt = stmt;
@@ -371,25 +371,25 @@ extern (C++) class ExpStatement : Statement
{
Expression exp;
- final extern (D) this(const ref Loc loc, Expression exp) @safe
+ final extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, STMT.Exp);
this.exp = exp;
}
- final extern (D) this(const ref Loc loc, Expression exp, STMT stmt) @safe
+ final extern (D) this(Loc loc, Expression exp, STMT stmt) @safe
{
super(loc, stmt);
this.exp = exp;
}
- final extern (D) this(const ref Loc loc, Dsymbol declaration) @safe
+ final extern (D) this(Loc loc, Dsymbol declaration) @safe
{
super(loc, STMT.Exp);
this.exp = new DeclarationExp(loc, declaration);
}
- static ExpStatement create(const ref Loc loc, Expression exp) @safe
+ static ExpStatement create(Loc loc, Expression exp) @safe
{
return new ExpStatement(loc, exp);
}
@@ -412,7 +412,7 @@ extern (C++) final class DtorExpStatement : ExpStatement
// Wraps an expression that is the destruction of 'var'
VarDeclaration var;
- extern (D) this(const ref Loc loc, Expression exp, VarDeclaration var) @safe
+ extern (D) this(Loc loc, Expression exp, VarDeclaration var) @safe
{
super(loc, exp, STMT.DtorExp);
this.var = var;
@@ -437,14 +437,14 @@ extern (C++) final class MixinStatement : Statement
{
Expressions* exps;
- extern (D) this(const ref Loc loc, Expression exp)
+ extern (D) this(Loc loc, Expression exp)
{
Expressions* exps = new Expressions();
exps.push(exp);
this(loc, exps);
}
- extern (D) this(const ref Loc loc, Expressions* exps) @safe
+ extern (D) this(Loc loc, Expressions* exps) @safe
{
super(loc, STMT.Mixin);
this.exps = exps;
@@ -475,13 +475,13 @@ extern (C++) class CompoundStatement : Statement
* loc = Instantiation information
* statements = An array of `Statement`s, that will referenced by this class
*/
- final extern (D) this(const ref Loc loc, Statements* statements) @safe
+ final extern (D) this(Loc loc, Statements* statements) @safe
{
super(loc, STMT.Compound);
this.statements = statements;
}
- final extern (D) this(const ref Loc loc, Statements* statements, STMT stmt) @safe
+ final extern (D) this(Loc loc, Statements* statements, STMT stmt) @safe
{
super(loc, stmt);
this.statements = statements;
@@ -495,7 +495,7 @@ extern (C++) class CompoundStatement : Statement
* sts = A variadic array of `Statement`s, that will copied in this class
* The entries themselves will not be copied.
*/
- final extern (D) this(const ref Loc loc, Statement[] sts...)
+ final extern (D) this(Loc loc, Statement[] sts...)
{
super(loc, STMT.Compound);
statements = new Statements();
@@ -504,7 +504,7 @@ extern (C++) class CompoundStatement : Statement
statements.push(s);
}
- static CompoundStatement create(const ref Loc loc, Statement s1, Statement s2)
+ static CompoundStatement create(Loc loc, Statement s1, Statement s2)
{
return new CompoundStatement(loc, s1, s2);
}
@@ -553,7 +553,7 @@ extern (C++) class CompoundStatement : Statement
*/
extern (C++) final class CompoundDeclarationStatement : CompoundStatement
{
- extern (D) this(const ref Loc loc, Statements* statements) @safe
+ extern (D) this(Loc loc, Statements* statements) @safe
{
super(loc, statements, STMT.CompoundDeclaration);
}
@@ -577,7 +577,7 @@ extern (C++) final class UnrolledLoopStatement : Statement
{
Statements* statements;
- extern (D) this(const ref Loc loc, Statements* statements) @safe
+ extern (D) this(Loc loc, Statements* statements) @safe
{
super(loc, STMT.UnrolledLoop);
this.statements = statements;
@@ -611,7 +611,7 @@ extern (C++) final class ScopeStatement : Statement
Statement statement;
Loc endloc; // location of closing curly bracket
- extern (D) this(const ref Loc loc, Statement statement, Loc endloc) @safe
+ extern (D) this(Loc loc, Statement statement, Loc endloc) @safe
{
super(loc, STMT.Scope);
this.statement = statement;
@@ -661,7 +661,7 @@ extern (C++) final class ForwardingStatement : Statement
/// The wrapped statement.
Statement statement;
- extern (D) this(const ref Loc loc, ForwardingScopeDsymbol sym, Statement statement) @safe
+ extern (D) this(Loc loc, ForwardingScopeDsymbol sym, Statement statement) @safe
{
super(loc, STMT.Forwarding);
this.sym = sym;
@@ -669,7 +669,7 @@ extern (C++) final class ForwardingStatement : Statement
this.statement = statement;
}
- extern (D) this(const ref Loc loc, Statement statement) @safe
+ extern (D) this(Loc loc, Statement statement) @safe
{
auto sym = new ForwardingScopeDsymbol();
sym.symtab = new DsymbolTable();
@@ -698,7 +698,7 @@ extern (C++) final class WhileStatement : Statement
Statement _body;
Loc endloc; // location of closing curly bracket
- extern (D) this(const ref Loc loc, Expression condition, Statement _body, Loc endloc, Parameter param = null) @safe
+ extern (D) this(Loc loc, Expression condition, Statement _body, Loc endloc, Parameter param = null) @safe
{
super(loc, STMT.While);
this.condition = condition;
@@ -740,7 +740,7 @@ extern (C++) final class DoStatement : Statement
Expression condition;
Loc endloc; // location of ';' after while
- extern (D) this(const ref Loc loc, Statement _body, Expression condition, Loc endloc) @safe
+ extern (D) this(Loc loc, Statement _body, Expression condition, Loc endloc) @safe
{
super(loc, STMT.Do);
this._body = _body;
@@ -788,7 +788,7 @@ extern (C++) final class ForStatement : Statement
// treat that label as referring to this loop.
Statement relatedLabeled;
- extern (D) this(const ref Loc loc, Statement _init, Expression condition, Expression increment, Statement _body, Loc endloc) @safe
+ extern (D) this(Loc loc, Statement _init, Expression condition, Expression increment, Statement _body, Loc endloc) @safe
{
super(loc, STMT.For);
this._init = _init;
@@ -849,7 +849,7 @@ extern (C++) final class ForeachStatement : Statement
Statements* cases; // put breaks, continues, gotos and returns here
ScopeStatements* gotos; // forward referenced goto's go here
- extern (D) this(const ref Loc loc, TOK op, Parameters* parameters, Expression aggr, Statement _body, Loc endloc) @safe
+ extern (D) this(Loc loc, TOK op, Parameters* parameters, Expression aggr, Statement _body, Loc endloc) @safe
{
super(loc, STMT.Foreach);
this.op = op;
@@ -898,7 +898,7 @@ extern (C++) final class ForeachRangeStatement : Statement
VarDeclaration key;
- extern (D) this(const ref Loc loc, TOK op, Parameter param, Expression lwr, Expression upr, Statement _body, Loc endloc) @safe
+ extern (D) this(Loc loc, TOK op, Parameter param, Expression lwr, Expression upr, Statement _body, Loc endloc) @safe
{
super(loc, STMT.ForeachRange);
this.op = op;
@@ -942,7 +942,7 @@ extern (C++) final class IfStatement : Statement
VarDeclaration match; // for MatchExpression results
Loc endloc; // location of closing curly bracket
- extern (D) this(const ref Loc loc, Parameter param, Expression condition, Statement ifbody, Statement elsebody, Loc endloc) @safe
+ extern (D) this(Loc loc, Parameter param, Expression condition, Statement ifbody, Statement elsebody, Loc endloc) @safe
{
super(loc, STMT.If);
this.param = param;
@@ -987,7 +987,7 @@ extern (C++) final class ConditionalStatement : Statement
Statement ifbody;
Statement elsebody;
- extern (D) this(const ref Loc loc, Condition condition, Statement ifbody, Statement elsebody) @safe
+ extern (D) this(Loc loc, Condition condition, Statement ifbody, Statement elsebody) @safe
{
super(loc, STMT.Conditional);
this.condition = condition;
@@ -1022,7 +1022,7 @@ extern (C++) final class StaticForeachStatement : Statement
{
StaticForeach sfe;
- extern (D) this(const ref Loc loc, StaticForeach sfe) @safe
+ extern (D) this(Loc loc, StaticForeach sfe) @safe
{
super(loc, STMT.StaticForeach);
this.sfe = sfe;
@@ -1048,7 +1048,7 @@ extern (C++) final class PragmaStatement : Statement
Expressions* args; // array of Expression's
Statement _body;
- extern (D) this(const ref Loc loc, const Identifier ident, Expressions* args, Statement _body) @safe
+ extern (D) this(Loc loc, const Identifier ident, Expressions* args, Statement _body) @safe
{
super(loc, STMT.Pragma);
this.ident = ident;
@@ -1106,12 +1106,12 @@ extern (C++) final class SwitchStatement : Statement
bool hasVars; /// true if has variable case values
DefaultStatement sdefault; /// default:
Statement tryBody; /// set to TryCatchStatement or TryFinallyStatement if in _body portion
- TryFinallyStatement tf; /// set if in the 'finally' block of a TryFinallyStatement
+ TryFinallyStatement tryFinally; /// set if in the 'finally' block of a TryFinallyStatement
GotoCaseStatements gotoCases; /// array of unresolved GotoCaseStatement's
CaseStatements* cases; /// array of CaseStatement's
VarDeclaration lastVar; /// last observed variable declaration in this statement
- extern (D) this(const ref Loc loc, Parameter param, Expression condition, Statement _body, bool isFinal, Loc endloc)
+ extern (D) this(Loc loc, Parameter param, Expression condition, Statement _body, bool isFinal, Loc endloc)
{
super(loc, STMT.Switch);
this.param = param;
@@ -1154,7 +1154,7 @@ extern (C++) final class CaseStatement : Statement
VarDeclaration lastVar;
void* extra; // for use by Statement_toIR()
- extern (D) this(const ref Loc loc, Expression exp, Statement statement) @safe
+ extern (D) this(Loc loc, Expression exp, Statement statement) @safe
{
super(loc, STMT.Case);
this.exp = exp;
@@ -1181,7 +1181,7 @@ extern (C++) final class CaseRangeStatement : Statement
Expression last;
Statement statement;
- extern (D) this(const ref Loc loc, Expression first, Expression last, Statement statement) @safe
+ extern (D) this(Loc loc, Expression first, Expression last, Statement statement) @safe
{
super(loc, STMT.CaseRange);
this.first = first;
@@ -1209,7 +1209,7 @@ extern (C++) final class DefaultStatement : Statement
VarDeclaration lastVar;
- extern (D) this(const ref Loc loc, Statement statement) @safe
+ extern (D) this(Loc loc, Statement statement) @safe
{
super(loc, STMT.Default);
this.statement = statement;
@@ -1233,7 +1233,7 @@ extern (C++) final class GotoDefaultStatement : Statement
{
SwitchStatement sw;
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, STMT.GotoDefault);
}
@@ -1258,7 +1258,7 @@ extern (C++) final class GotoCaseStatement : Statement
CaseStatement cs; // case statement it resolves to
- extern (D) this(const ref Loc loc, Expression exp) @safe
+ extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, STMT.GotoCase);
this.exp = exp;
@@ -1281,12 +1281,12 @@ extern (C++) final class SwitchErrorStatement : Statement
{
Expression exp;
- extern (D) this(const ref Loc loc) @safe
+ extern (D) this(Loc loc) @safe
{
super(loc, STMT.SwitchError);
}
- final extern (D) this(const ref Loc loc, Expression exp) @safe
+ final extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, STMT.SwitchError);
this.exp = exp;
@@ -1306,7 +1306,7 @@ extern (C++) final class ReturnStatement : Statement
Expression exp;
size_t caseDim;
- extern (D) this(const ref Loc loc, Expression exp) @safe
+ extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, STMT.Return);
this.exp = exp;
@@ -1335,7 +1335,7 @@ extern (C++) final class BreakStatement : Statement
{
Identifier ident;
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, STMT.Break);
this.ident = ident;
@@ -1359,7 +1359,7 @@ extern (C++) final class ContinueStatement : Statement
{
Identifier ident;
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, STMT.Continue);
this.ident = ident;
@@ -1384,7 +1384,7 @@ extern (C++) final class SynchronizedStatement : Statement
Expression exp;
Statement _body;
- extern (D) this(const ref Loc loc, Expression exp, Statement _body) @safe
+ extern (D) this(Loc loc, Expression exp, Statement _body) @safe
{
super(loc, STMT.Synchronized);
this.exp = exp;
@@ -1422,7 +1422,7 @@ extern (C++) final class WithStatement : Statement
VarDeclaration wthis;
Loc endloc;
- extern (D) this(const ref Loc loc, Expression exp, Statement _body, Loc endloc) @safe
+ extern (D) this(Loc loc, Expression exp, Statement _body, Loc endloc) @safe
{
super(loc, STMT.With);
this.exp = exp;
@@ -1451,7 +1451,7 @@ extern (C++) final class TryCatchStatement : Statement
Statement tryBody; /// set to enclosing TryCatchStatement or TryFinallyStatement if in _body portion
- extern (D) this(const ref Loc loc, Statement _body, Catches* catches) @safe
+ extern (D) this(Loc loc, Statement _body, Catches* catches) @safe
{
super(loc, STMT.TryCatch);
this._body = _body;
@@ -1495,7 +1495,7 @@ extern (C++) final class Catch : RootObject
// was generated by the compiler, wasn't present in source code
bool internalCatch;
- extern (D) this(const ref Loc loc, Type type, Identifier ident, Statement handler) @safe
+ extern (D) this(Loc loc, Type type, Identifier ident, Statement handler) @safe
{
//printf("Catch(%s, loc = %s)\n", id.toChars(), loc.toChars());
this.loc = loc;
@@ -1523,7 +1523,7 @@ extern (C++) final class TryFinallyStatement : Statement
Statement tryBody; /// set to enclosing TryCatchStatement or TryFinallyStatement if in _body portion
bool bodyFallsThru; /// true if _body falls through to finally
- extern (D) this(const ref Loc loc, Statement _body, Statement finalbody) @safe
+ extern (D) this(Loc loc, Statement _body, Statement finalbody) @safe
{
super(loc, STMT.TryFinally);
this._body = _body;
@@ -1531,7 +1531,7 @@ extern (C++) final class TryFinallyStatement : Statement
this.bodyFallsThru = true; // assume true until statementSemantic()
}
- static TryFinallyStatement create(const ref Loc loc, Statement _body, Statement finalbody) @safe
+ static TryFinallyStatement create(Loc loc, Statement _body, Statement finalbody) @safe
{
return new TryFinallyStatement(loc, _body, finalbody);
}
@@ -1565,7 +1565,7 @@ extern (C++) final class ScopeGuardStatement : Statement
TOK tok;
Statement statement;
- extern (D) this(const ref Loc loc, TOK tok, Statement statement) @safe
+ extern (D) this(Loc loc, TOK tok, Statement statement) @safe
{
super(loc, STMT.ScopeGuard);
this.tok = tok;
@@ -1593,7 +1593,7 @@ extern (C++) final class ThrowStatement : Statement
// was generated by the compiler, wasn't present in source code
bool internalThrow;
- extern (D) this(const ref Loc loc, Expression exp) @safe
+ extern (D) this(Loc loc, Expression exp) @safe
{
super(loc, STMT.Throw);
this.exp = exp;
@@ -1618,7 +1618,7 @@ extern (C++) final class DebugStatement : Statement
{
Statement statement;
- extern (D) this(const ref Loc loc, Statement statement) @safe
+ extern (D) this(Loc loc, Statement statement) @safe
{
super(loc, STMT.Debug);
this.statement = statement;
@@ -1648,7 +1648,7 @@ extern (C++) final class GotoStatement : Statement
VarDeclaration lastVar;
bool inCtfeBlock; /// set if goto is inside an `if (__ctfe)` block
- extern (D) this(const ref Loc loc, Identifier ident) @safe
+ extern (D) this(Loc loc, Identifier ident) @safe
{
super(loc, STMT.Goto);
this.ident = ident;
@@ -1682,7 +1682,7 @@ extern (C++) final class LabelStatement : Statement
bool breaks; // someone did a 'break ident'
bool inCtfeBlock; // inside a block dominated by `if (__ctfe)`
- extern (D) this(const ref Loc loc, Identifier ident, Statement statement) @safe
+ extern (D) this(Loc loc, Identifier ident, Statement statement) @safe
{
super(loc, STMT.Label);
this.ident = ident;
@@ -1713,7 +1713,7 @@ extern (C++) final class LabelDsymbol : Dsymbol
// can be removed if generic error message deduplication is implemented
bool duplicated;
- extern (D) this(Identifier ident, const ref Loc loc = Loc.initial) @safe
+ extern (D) this(Identifier ident, Loc loc = Loc.initial) @safe
{
super(loc, ident);
}
@@ -1743,13 +1743,13 @@ extern (C++) class AsmStatement : Statement
Token* tokens;
bool caseSensitive; // for register names
- extern (D) this(const ref Loc loc, Token* tokens) @safe
+ extern (D) this(Loc loc, Token* tokens) @safe
{
super(loc, STMT.Asm);
this.tokens = tokens;
}
- extern (D) this(const ref Loc loc, Token* tokens, STMT stmt) @safe
+ extern (D) this(Loc loc, Token* tokens, STMT stmt) @safe
{
super(loc, stmt);
this.tokens = tokens;
@@ -1777,7 +1777,7 @@ extern (C++) final class InlineAsmStatement : AsmStatement
bool refparam; // true if function parameter is referenced
bool naked; // true if function is to be naked
- extern (D) this(const ref Loc loc, Token* tokens) @safe
+ extern (D) this(Loc loc, Token* tokens) @safe
{
super(loc, tokens, STMT.InlineAsm);
}
@@ -1809,7 +1809,7 @@ extern (C++) final class GccAsmStatement : AsmStatement
Identifiers* labels; // list of goto labels
GotoStatements* gotos; // of the goto labels, the equivalent statements they represent
- extern (D) this(const ref Loc loc, Token* tokens) @safe
+ extern (D) this(Loc loc, Token* tokens) @safe
{
super(loc, tokens, STMT.GccAsm);
}
@@ -1832,7 +1832,7 @@ extern (C++) final class CompoundAsmStatement : CompoundStatement
{
StorageClass stc; // postfix attributes like nothrow/pure/@trusted
- extern (D) this(const ref Loc loc, Statements* statements, StorageClass stc) @safe
+ extern (D) this(Loc loc, Statements* statements, StorageClass stc) @safe
{
super(loc, statements, STMT.CompoundAsm);
this.stc = stc;
@@ -1856,7 +1856,7 @@ extern (C++) final class ImportStatement : Statement
{
Dsymbols* imports; // Array of Import's
- extern (D) this(const ref Loc loc, Dsymbols* imports) @safe
+ extern (D) this(Loc loc, Dsymbols* imports) @safe
{
super(loc, STMT.Import);
this.imports = imports;
diff --git a/gcc/d/dmd/statement.h b/gcc/d/dmd/statement.h
index e420cf4..eac300d 100644
--- a/gcc/d/dmd/statement.h
+++ b/gcc/d/dmd/statement.h
@@ -181,7 +181,7 @@ class ExpStatement : public Statement
public:
Expression *exp;
- static ExpStatement *create(const Loc &loc, Expression *exp);
+ static ExpStatement *create(Loc loc, Expression *exp);
ExpStatement *syntaxCopy() override;
void accept(Visitor *v) override { v->visit(this); }
@@ -213,7 +213,7 @@ class CompoundStatement : public Statement
public:
Statements *statements;
- static CompoundStatement *create(const Loc &loc, Statement *s1, Statement *s2);
+ static CompoundStatement *create(Loc loc, Statement *s1, Statement *s2);
CompoundStatement *syntaxCopy() override;
ReturnStatement *endsWithReturnStatement() override final;
Statement *last() override final;
@@ -613,7 +613,7 @@ public:
Statement *tryBody; // set to enclosing TryCatchStatement or TryFinallyStatement if in _body portion
d_bool bodyFallsThru; // true if _body falls through to finally
- static TryFinallyStatement *create(const Loc &loc, Statement *body, Statement *finalbody);
+ static TryFinallyStatement *create(Loc loc, Statement *body, Statement *finalbody);
TryFinallyStatement *syntaxCopy() override;
bool hasBreak() const override;
bool hasContinue() const override;
diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d
index 00dc606..6a3bc38 100644
--- a/gcc/d/dmd/statementsem.d
+++ b/gcc/d/dmd/statementsem.d
@@ -1804,7 +1804,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
//printf("SwitchStatement::semantic(%p)\n", ss);
ss.tryBody = sc.tryBody;
- ss.tf = sc.tf;
+ ss.tryFinally = sc.tryFinally;
if (ss.cases)
{
result = ss; // already run
@@ -1898,7 +1898,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
sc = sc.push();
sc.sbreak = ss;
- sc.sw = ss;
+ sc.switchStatement = ss;
ss.cases = new CaseStatements();
const inLoopSave = sc.inLoop;
@@ -1925,9 +1925,9 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
for (Scope* scx = sc; scx; scx = scx.enclosing)
{
- if (!scx.sw)
+ if (!scx.switchStatement)
continue;
- foreach (cs; *scx.sw.cases)
+ foreach (cs; *scx.switchStatement.cases)
{
if (cs.exp.equals(gcs.exp))
{
@@ -1986,7 +1986,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
needswitcherror = true;
}
- ss.hasDefault = sc.sw.sdefault ||
+ ss.hasDefault = sc.switchStatement.sdefault ||
!(!ss.isFinal || needswitcherror || global.params.useAssert == CHECKENABLE.on || sc.func.isSafe || sc.func.isSaferD);
if (!ss.hasDefault)
{
@@ -2040,11 +2040,11 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
s = new ExpStatement(ss.loc, new HaltExp(ss.loc));
a.reserve(2);
- sc.sw.sdefault = new DefaultStatement(ss.loc, s);
+ sc.switchStatement.sdefault = new DefaultStatement(ss.loc, s);
a.push(ss._body);
if (ss._body.blockExit(sc.func, null) & BE.fallthru)
a.push(new BreakStatement(Loc.initial, null));
- a.push(sc.sw.sdefault);
+ a.push(sc.switchStatement.sdefault);
cs = new CompoundStatement(ss.loc, a);
ss._body = cs;
}
@@ -2141,7 +2141,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
void visitCase(CaseStatement cs)
{
- SwitchStatement sw = sc.sw;
+ SwitchStatement sw = sc.switchStatement;
bool errors = false;
//printf("CaseStatement::semantic() %s\n", toChars());
@@ -2197,9 +2197,9 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
*/
for (Scope* scx = sc; scx; scx = scx.enclosing)
{
- if (scx.enclosing && scx.enclosing.sw == sw)
+ if (scx.enclosing && scx.enclosing.switchStatement == sw)
continue;
- assert(scx.sw == sw);
+ assert(scx.switchStatement == sw);
Dsymbol pscopesym;
if (!scx.search(cs.exp.loc, v.ident, pscopesym))
@@ -2254,12 +2254,12 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
i++;
}
- if (sc.sw.tf != sc.tf)
+ if (sc.switchStatement.tryFinally != sc.tryFinally)
{
error(cs.loc, "`switch` and `case` are in different `finally` blocks");
errors = true;
}
- if (sc.sw.tryBody != sc.tryBody)
+ if (sc.switchStatement.tryBody != sc.tryBody)
{
error(cs.loc, "case cannot be in different `try` block level from `switch`");
errors = true;
@@ -2287,7 +2287,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
void visitCaseRange(CaseRangeStatement crs)
{
- SwitchStatement sw = sc.sw;
+ SwitchStatement sw = sc.switchStatement;
if (sw is null)
{
error(crs.loc, "case range not in `switch` statement");
@@ -2372,26 +2372,26 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
{
//printf("DefaultStatement::semantic()\n");
bool errors = false;
- if (sc.sw)
+ if (sc.switchStatement)
{
- if (sc.sw.sdefault)
+ if (sc.switchStatement.sdefault)
{
error(ds.loc, "`switch` statement already has a default");
errors = true;
}
- sc.sw.sdefault = ds;
+ sc.switchStatement.sdefault = ds;
- if (sc.sw.tf != sc.tf)
+ if (sc.switchStatement.tryFinally != sc.tryFinally)
{
error(ds.loc, "`switch` and `default` are in different `finally` blocks");
errors = true;
}
- if (sc.sw.tryBody != sc.tryBody)
+ if (sc.switchStatement.tryBody != sc.tryBody)
{
error(ds.loc, "default cannot be in different `try` block level from `switch`");
errors = true;
}
- if (sc.sw.isFinal)
+ if (sc.switchStatement.isFinal)
{
error(ds.loc, "`default` statement not allowed in `final switch` statement");
errors = true;
@@ -2417,7 +2417,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
/* https://dlang.org/spec/statement.html#goto-statement
*/
- gds.sw = sc.sw;
+ gds.sw = sc.switchStatement;
if (!gds.sw)
{
error(gds.loc, "`goto default` not in `switch` statement");
@@ -2436,7 +2436,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
/* https://dlang.org/spec/statement.html#goto-statement
*/
- if (!sc.sw)
+ if (!sc.switchStatement)
{
error(gcs.loc, "`goto case` not in `switch` statement");
return setError();
@@ -2445,13 +2445,13 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
if (gcs.exp)
{
gcs.exp = gcs.exp.expressionSemantic(sc);
- gcs.exp = gcs.exp.implicitCastTo(sc, sc.sw.condition.type);
+ gcs.exp = gcs.exp.implicitCastTo(sc, sc.switchStatement.condition.type);
gcs.exp = gcs.exp.optimize(WANTvalue);
if (gcs.exp.op == EXP.error)
return setError();
}
- sc.sw.gotoCases.push(gcs);
+ sc.switchStatement.gotoCases.push(gcs);
result = gcs;
}
@@ -2505,22 +2505,22 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
error(rs.loc, "`return` statements cannot be in contracts");
errors = true;
}
- if (sc.os)
+ if (sc.scopeGuard)
{
// @@@DEPRECATED_2.112@@@
// Deprecated in 2.100, transform into an error in 2.112
- if (sc.os.tok == TOK.onScopeFailure)
+ if (sc.scopeGuard.tok == TOK.onScopeFailure)
{
deprecation(rs.loc, "`return` statements cannot be in `scope(failure)` bodies.");
deprecationSupplemental(rs.loc, "Use try-catch blocks for this purpose");
}
else
{
- error(rs.loc, "`return` statements cannot be in `%s` bodies", Token.toChars(sc.os.tok));
+ error(rs.loc, "`return` statements cannot be in `%s` bodies", Token.toChars(sc.scopeGuard.tok));
errors = true;
}
}
- if (sc.tf)
+ if (sc.tryFinally)
{
error(rs.loc, "`return` statements cannot be in `finally` bodies");
errors = true;
@@ -2901,7 +2901,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
Statement s = ls.statement;
if (!s || !s.hasBreak())
error(bs.loc, "label `%s` has no `break`", bs.ident.toChars());
- else if (ls.tf != sc.tf)
+ else if (ls.tf != sc.tryFinally)
error(bs.loc, "cannot break out of `finally` block");
else
{
@@ -2917,9 +2917,9 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
}
else if (!sc.sbreak)
{
- if (sc.os && sc.os.tok != TOK.onScopeFailure)
+ if (sc.scopeGuard && sc.scopeGuard.tok != TOK.onScopeFailure)
{
- error(bs.loc, "`break` is not allowed inside `%s` bodies", Token.toChars(sc.os.tok));
+ error(bs.loc, "`break` is not allowed inside `%s` bodies", Token.toChars(sc.scopeGuard.tok));
}
else if (sc.fes)
{
@@ -2989,7 +2989,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
Statement s = ls.statement;
if (!s || !s.hasContinue())
error(cs.loc, "label `%s` has no `continue`", cs.ident.toChars());
- else if (ls.tf != sc.tf)
+ else if (ls.tf != sc.tryFinally)
error(cs.loc, "cannot continue out of `finally` block");
else
{
@@ -3004,9 +3004,9 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
}
else if (!sc.scontinue)
{
- if (sc.os && sc.os.tok != TOK.onScopeFailure)
+ if (sc.scopeGuard && sc.scopeGuard.tok != TOK.onScopeFailure)
{
- error(cs.loc, "`continue` is not allowed inside `%s` bodies", Token.toChars(sc.os.tok));
+ error(cs.loc, "`continue` is not allowed inside `%s` bodies", Token.toChars(sc.scopeGuard.tok));
}
else if (sc.fes)
{
@@ -3382,7 +3382,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
tfs._body = tfs._body.semanticScope(sc, null, null, tfs);
sc = sc.push();
- sc.tf = tfs;
+ sc.tryFinally = tfs;
sc.sbreak = null;
sc.scontinue = null; // no break or continue out of finally block
tfs.finalbody = tfs.finalbody.semanticNoScope(sc);
@@ -3435,13 +3435,13 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
// scope(success) and scope(failure) are rewritten to try-catch(-finally) statement,
// so the generated catch block cannot be placed in finally block.
// See also Catch::semantic.
- if (sc.os && sc.os.tok != TOK.onScopeFailure)
+ if (sc.scopeGuard && sc.scopeGuard.tok != TOK.onScopeFailure)
{
// If enclosing is scope(success) or scope(exit), this will be placed in finally block.
- error(oss.loc, "cannot put `%s` statement inside `%s`", Token.toChars(oss.tok), Token.toChars(sc.os.tok));
+ error(oss.loc, "cannot put `%s` statement inside `%s`", Token.toChars(oss.tok), Token.toChars(sc.scopeGuard.tok));
return setError();
}
- if (sc.tf)
+ if (sc.tryFinally)
{
error(oss.loc, "cannot put `%s` statement inside `finally` block", Token.toChars(oss.tok));
return setError();
@@ -3449,8 +3449,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
}
sc = sc.push();
- sc.tf = null;
- sc.os = oss;
+ sc.tryFinally = null;
+ sc.scopeGuard = oss;
if (oss.tok != TOK.onScopeFailure)
{
// Jump out from scope(failure) block is allowed.
@@ -3504,8 +3504,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
gs.ident = fixupLabelName(sc, gs.ident);
gs.label = fd.searchLabel(gs.ident, gs.loc);
gs.tryBody = sc.tryBody;
- gs.tf = sc.tf;
- gs.os = sc.os;
+ gs.tf = sc.tryFinally;
+ gs.os = sc.scopeGuard;
gs.lastVar = sc.lastVar;
gs.inCtfeBlock = sc.ctfeBlock;
@@ -3544,8 +3544,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
ls.ident = fixupLabelName(sc, ls.ident);
ls.tryBody = sc.tryBody;
- ls.tf = sc.tf;
- ls.os = sc.os;
+ ls.tf = sc.tryFinally;
+ ls.os = sc.scopeGuard;
ls.lastVar = sc.lastVar;
ls.inCtfeBlock = sc.ctfeBlock;
@@ -3696,7 +3696,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
*
* Returns: true if the `throw` is valid, or false if an error was found
*/
-public bool throwSemantic(const ref Loc loc, ref Expression exp, Scope* sc)
+public bool throwSemantic(Loc loc, ref Expression exp, Scope* sc)
{
if (!global.params.useExceptions)
{
@@ -3945,7 +3945,7 @@ private extern(D) Expression applyAssocArray(ForeachStatement fs, Expression fld
return ec;
}
-private extern(D) Statement loopReturn(Expression e, Statements* cases, const ref Loc loc)
+private extern(D) Statement loopReturn(Expression e, Statements* cases, Loc loc)
{
if (!cases.length)
{
@@ -4053,13 +4053,13 @@ void catchSemantic(Catch c, Scope* sc)
{
//printf("Catch::semantic(%s)\n", ident.toChars());
- if (sc.os && sc.os.tok != TOK.onScopeFailure)
+ if (sc.scopeGuard && sc.scopeGuard.tok != TOK.onScopeFailure)
{
// If enclosing is scope(success) or scope(exit), this will be placed in finally block.
- error(c.loc, "cannot put `catch` statement inside `%s`", Token.toChars(sc.os.tok));
+ error(c.loc, "cannot put `catch` statement inside `%s`", Token.toChars(sc.scopeGuard.tok));
c.errors = true;
}
- if (sc.tf)
+ if (sc.tryFinally)
{
/* This is because the _d_local_unwind() gets the stack munged
* up on this. The workaround is to place any try-catches into
@@ -4835,8 +4835,9 @@ private Statements* flatten(Statement statement, Scope* sc)
buf.writeByte(0);
const str = buf.extractSlice()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
- auto loc = adjustLocForMixin(str, cs.loc, global.params.mixinOut);
- scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ adjustLocForMixin(str, cs.loc, *p.baseLoc, global.params.mixinOut);
+ p.linnum = p.baseLoc.startLine;
p.nextToken();
auto a = new Statements();
diff --git a/gcc/d/dmd/staticassert.d b/gcc/d/dmd/staticassert.d
index 08780ca..3d73ae8 100644
--- a/gcc/d/dmd/staticassert.d
+++ b/gcc/d/dmd/staticassert.d
@@ -28,7 +28,7 @@ extern (C++) final class StaticAssert : Dsymbol
Expression exp;
Expressions* msgs;
- extern (D) this(const ref Loc loc, Expression exp, Expression msg)
+ extern (D) this(Loc loc, Expression exp, Expression msg)
{
super(loc, Id.empty);
this.exp = exp;
@@ -36,7 +36,7 @@ extern (C++) final class StaticAssert : Dsymbol
(*this.msgs)[0] = msg;
}
- extern (D) this(const ref Loc loc, Expression exp, Expressions* msgs)
+ extern (D) this(Loc loc, Expression exp, Expressions* msgs)
{
super(loc, Id.empty);
this.exp = exp;
diff --git a/gcc/d/dmd/target.d b/gcc/d/dmd/target.d
index 7718710..33249bd 100644
--- a/gcc/d/dmd/target.d
+++ b/gcc/d/dmd/target.d
@@ -194,7 +194,7 @@ extern (C++) struct Target
* Returns:
* `Type` that represents `va_list`.
*/
- extern (C++) Type va_listType(const ref Loc loc, Scope* sc);
+ extern (C++) Type va_listType(Loc loc, Scope* sc);
/**
* Checks whether the target supports a vector type.
@@ -267,7 +267,7 @@ extern (C++) struct Target
* Returns:
* Expression for the requested targetInfo
*/
- extern (C++) Expression getTargetInfo(const(char)* name, const ref Loc loc);
+ extern (C++) Expression getTargetInfo(const(char)* name, Loc loc);
/**
* Params:
diff --git a/gcc/d/dmd/target.h b/gcc/d/dmd/target.h
index 1a9837f..b8081bf 100644
--- a/gcc/d/dmd/target.h
+++ b/gcc/d/dmd/target.h
@@ -197,7 +197,7 @@ public:
// Type sizes and support.
unsigned alignsize(Type *type);
unsigned fieldalign(Type *type);
- Type *va_listType(const Loc &loc, Scope *sc); // get type of va_list
+ Type *va_listType(Loc loc, Scope *sc); // get type of va_list
int isVectorTypeSupported(int sz, Type *type);
bool isVectorOpSupported(Type *type, EXP op, Type *t2 = nullptr);
// ABI and backend.
@@ -205,7 +205,7 @@ public:
TypeTuple *toArgTypes(Type *t);
bool isReturnOnStack(TypeFunction *tf, bool needsThis);
bool preferPassByRef(Type *t);
- Expression *getTargetInfo(const char* name, const Loc& loc);
+ Expression *getTargetInfo(const char* name, Loc loc);
bool isCalleeDestroyingArgs(TypeFunction* tf);
bool libraryObjectMonitors(FuncDeclaration *fd, Statement *fbody);
bool supportsLinkerDirective() const;
diff --git a/gcc/d/dmd/template.h b/gcc/d/dmd/template.h
index cdb1c85..5bb0de5 100644
--- a/gcc/d/dmd/template.h
+++ b/gcc/d/dmd/template.h
@@ -127,7 +127,7 @@ public:
virtual bool declareParameter(Scope *sc) = 0;
virtual void print(RootObject *oarg, RootObject *oded) = 0;
virtual RootObject *specialization() = 0;
- virtual RootObject *defaultArg(const Loc &instLoc, Scope *sc) = 0;
+ virtual RootObject *defaultArg(Loc instLoc, Scope *sc) = 0;
virtual bool hasDefaultArg() = 0;
DYNCAST dyncast() const override { return DYNCAST_TEMPLATEPARAMETER; }
@@ -149,7 +149,7 @@ public:
bool declareParameter(Scope *sc) override final;
void print(RootObject *oarg, RootObject *oded) override final;
RootObject *specialization() override final;
- RootObject *defaultArg(const Loc &instLoc, Scope *sc) override final;
+ RootObject *defaultArg(Loc instLoc, Scope *sc) override final;
bool hasDefaultArg() override final;
void accept(Visitor *v) override { v->visit(this); }
};
@@ -180,7 +180,7 @@ public:
bool declareParameter(Scope *sc) override;
void print(RootObject *oarg, RootObject *oded) override;
RootObject *specialization() override;
- RootObject *defaultArg(const Loc &instLoc, Scope *sc) override;
+ RootObject *defaultArg(Loc instLoc, Scope *sc) override;
bool hasDefaultArg() override;
void accept(Visitor *v) override { v->visit(this); }
};
@@ -200,7 +200,7 @@ public:
bool declareParameter(Scope *sc) override;
void print(RootObject *oarg, RootObject *oded) override;
RootObject *specialization() override;
- RootObject *defaultArg(const Loc &instLoc, Scope *sc) override;
+ RootObject *defaultArg(Loc instLoc, Scope *sc) override;
bool hasDefaultArg() override;
void accept(Visitor *v) override { v->visit(this); }
};
@@ -216,7 +216,7 @@ public:
bool declareParameter(Scope *sc) override;
void print(RootObject *oarg, RootObject *oded) override;
RootObject *specialization() override;
- RootObject *defaultArg(const Loc &instLoc, Scope *sc) override;
+ RootObject *defaultArg(Loc instLoc, Scope *sc) override;
bool hasDefaultArg() override;
void accept(Visitor *v) override { v->visit(this); }
};
diff --git a/gcc/d/dmd/typesem.d b/gcc/d/dmd/typesem.d
index 6d21d67..ae52de5 100644
--- a/gcc/d/dmd/typesem.d
+++ b/gcc/d/dmd/typesem.d
@@ -83,7 +83,7 @@ import dmd.tokens;
* ps = set if s[oindex] is a Dsymbol, otherwise null
* oindex = index into s
*/
-private void resolveTupleIndex(const ref Loc loc, Scope* sc, Dsymbol s, out Expression pe, out Type pt, out Dsymbol ps, RootObject oindex)
+private void resolveTupleIndex(Loc loc, Scope* sc, Dsymbol s, out Expression pe, out Type pt, out Dsymbol ps, RootObject oindex)
{
auto tup = s.isTupleDeclaration();
@@ -153,7 +153,7 @@ private void resolveTupleIndex(const ref Loc loc, Scope* sc, Dsymbol s, out Expr
* ps = set if symbol otherwise null
* typeid = set if in TypeidExpression https://dlang.org/spec/expression.html#TypeidExpression
*/
-private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymbol s, Dsymbol scopesym,
+private void resolveHelper(TypeQualified mt, Loc loc, Scope* sc, Dsymbol s, Dsymbol scopesym,
out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false)
{
version (none)
@@ -388,7 +388,7 @@ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymb
* Returns:
* symbol found, NULL if not
*/
-private Dsymbol searchX(Dsymbol dsym, const ref Loc loc, Scope* sc, RootObject id, SearchOptFlags flags)
+private Dsymbol searchX(Dsymbol dsym, Loc loc, Scope* sc, RootObject id, SearchOptFlags flags)
{
//printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident.toChars());
Dsymbol s = dsym.toAlias();
@@ -615,7 +615,7 @@ Expression typeToExpression(Type t)
* loc = The source location.
* sc = scope of the type
*/
-extern (D) bool checkComplexTransition(Type type, const ref Loc loc, Scope* sc)
+extern (D) bool checkComplexTransition(Type type, Loc loc, Scope* sc)
{
if (sc.isDeprecated())
return false;
@@ -1365,7 +1365,7 @@ uinteger_t size(Type t)
return size(t, Loc.initial);
}
-uinteger_t size(Type t, const ref Loc loc)
+uinteger_t size(Type t, Loc loc)
{
uinteger_t visitType(Type t)
@@ -1673,7 +1673,7 @@ MATCH constConv(Type from, Type to)
* `Type` with completed semantic analysis, `Terror` if errors
* were encountered
*/
-Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
+Type typeSemantic(Type type, Loc loc, Scope* sc)
{
static Type error()
{
@@ -3205,7 +3205,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
}
}
-Type trySemantic(Type type, const ref Loc loc, Scope* sc)
+Type trySemantic(Type type, Loc loc, Scope* sc)
{
//printf("+trySemantic(%s) %d\n", toChars(), global.errors);
@@ -3340,7 +3340,7 @@ Type merge2(Type type)
* Returns:
* expression representing the property, or null if not a property and (flag & 1)
*/
-Expression getProperty(Type t, Scope* scope_, const ref Loc loc, Identifier ident, int flag,
+Expression getProperty(Type t, Scope* scope_, Loc loc, Identifier ident, int flag,
Expression src = null)
{
Expression visitType(Type mt)
@@ -3825,7 +3825,7 @@ private void resolveExp(Expression exp, out Type t, out Expression e, out Dsymbo
* ps = is set if t is a symbol
* intypeid = true if in type id
*/
-void resolve(Type mt, const ref Loc loc, Scope* sc, out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false)
+void resolve(Type mt, Loc loc, Scope* sc, out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false)
{
void returnExp(Expression e)
{
@@ -5800,7 +5800,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag
}
// if initializer is 0
-bool isZeroInit(Type t, const ref Loc loc)
+bool isZeroInit(Type t, Loc loc)
{
bool visitType(Type _)
{
@@ -5878,7 +5878,7 @@ bool isZeroInit(Type t, const ref Loc loc)
* Returns:
* The initialization expression for the type.
*/
-Expression defaultInit(Type mt, const ref Loc loc, const bool isCfile = false)
+Expression defaultInit(Type mt, Loc loc, const bool isCfile = false)
{
Expression visitBasic(TypeBasic mt)
{
@@ -6254,7 +6254,7 @@ Type addStorageClass(Type type, StorageClass stc)
* Complex!float, Complex!double, Complex!real or null for error
*/
-Type getComplexLibraryType(const ref Loc loc, Scope* sc, TY ty)
+Type getComplexLibraryType(Loc loc, Scope* sc, TY ty)
{
// singleton
__gshared Type complex_float;
@@ -7561,7 +7561,7 @@ MATCH implicitConvToThroughAliasThis(TypeStruct from, Type to)
* Returns:
* number of elements, uint.max on overflow
*/
-uint numberOfElems(Type t, const ref Loc loc)
+uint numberOfElems(Type t, Loc loc)
{
//printf("Type::numberOfElems()\n");
uinteger_t n = 1;
@@ -7580,7 +7580,7 @@ uint numberOfElems(Type t, const ref Loc loc)
return cast(uint)n;
}
-bool checkRetType(TypeFunction tf, const ref Loc loc)
+bool checkRetType(TypeFunction tf, Loc loc)
{
Type tb = tf.next.toBasetype();
if (tb.ty == Tfunction)
@@ -7820,11 +7820,11 @@ Type stripDefaultArgs(Type t)
* Returns:
* corresponding value of .max/.min
*/
-Expression getMaxMinValue(EnumDeclaration ed, const ref Loc loc, Identifier id)
+Expression getMaxMinValue(EnumDeclaration ed, Loc loc, Identifier id)
{
//printf("EnumDeclaration::getMaxValue()\n");
- static Expression pvalToResult(Expression e, const ref Loc loc)
+ static Expression pvalToResult(Expression e, Loc loc)
{
if (e.op != EXP.error)
{
@@ -7931,7 +7931,7 @@ Expression getMaxMinValue(EnumDeclaration ed, const ref Loc loc, Identifier id)
* Return:
* null if error, else RootObject AST as parsed
*/
-RootObject compileTypeMixin(TypeMixin tm, ref const Loc loc, Scope* sc)
+RootObject compileTypeMixin(TypeMixin tm, Loc loc, Scope* sc)
{
OutBuffer buf;
if (expressionsToString(buf, sc, tm.exps, tm.loc, null, true))
@@ -7942,8 +7942,9 @@ RootObject compileTypeMixin(TypeMixin tm, ref const Loc loc, Scope* sc)
buf.writeByte(0);
const str = buf.extractSlice()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
- auto locm = adjustLocForMixin(str, loc, global.params.mixinOut);
- scope p = new Parser!ASTCodegen(locm, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
+ adjustLocForMixin(str, loc, *p.baseLoc, global.params.mixinOut);
+ p.linnum = p.baseLoc.startLine;
p.nextToken();
//printf("p.loc.linnum = %d\n", p.loc.linnum);
diff --git a/gcc/d/dmd/typinf.d b/gcc/d/dmd/typinf.d
index 35d5ad4..58102cd 100644
--- a/gcc/d/dmd/typinf.d
+++ b/gcc/d/dmd/typinf.d
@@ -35,7 +35,7 @@ import core.stdc.stdio;
* Returns:
* true if `TypeInfo` was generated and needs compiling to object file
*/
-bool genTypeInfo(Expression e, const ref Loc loc, Type torig, Scope* sc)
+bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
{
// printf("genTypeInfo() %s\n", torig.toChars());
@@ -103,7 +103,7 @@ bool genTypeInfo(Expression e, const ref Loc loc, Type torig, Scope* sc)
* Returns:
* The type of the `TypeInfo` object associated with `t`
*/
-extern (C++) Type getTypeInfoType(const ref Loc loc, Type t, Scope* sc);
+extern (C++) Type getTypeInfoType(Loc loc, Type t, Scope* sc);
private TypeInfoDeclaration getTypeInfoDeclaration(Type t)
{
diff --git a/gcc/d/dmd/typinf.h b/gcc/d/dmd/typinf.h
index 6414ecd..4a8c942 100644
--- a/gcc/d/dmd/typinf.h
+++ b/gcc/d/dmd/typinf.h
@@ -18,8 +18,8 @@ struct Scope;
namespace dmd
{
- bool genTypeInfo(Expression *e, const Loc &loc, Type *torig, Scope *sc);
+ bool genTypeInfo(Expression *e, Loc loc, Type *torig, Scope *sc);
bool isSpeculativeType(Type *t);
bool builtinTypeInfo(Type *t);
}
-Type *getTypeInfoType(const Loc &loc, Type *t, Scope *sc);
+Type *getTypeInfoType(Loc loc, Type *t, Scope *sc);
diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
index 1675436..776caaf 100644
--- a/gcc/d/imports.cc
+++ b/gcc/d/imports.cc
@@ -77,7 +77,7 @@ public:
void visit (Module *m) final override
{
Loc loc = (m->md != NULL) ? m->md->loc
- : Loc (m->srcfile.toChars (), 1, 0);
+ : Loc::singleFilename (m->srcfile.toChars ());
this->result_ = build_decl (make_location_t (loc), NAMESPACE_DECL,
get_identifier (m->toPrettyChars ()),
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index ec75105..85b6e42 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -146,7 +146,7 @@ get_internal_fn (tree ident, const Visibility &visibility)
FuncDeclaration *fd = FuncDeclaration::genCfunc (NULL, Type::tvoid,
Identifier::idPool (name));
fd->isGenerated (true);
- fd->loc = Loc (mod->srcfile.toChars (), 1, 0);
+ fd->loc = Loc::singleFilename (mod->srcfile.toChars ());
fd->parent = mod;
fd->visibility = visibility;
fd->semanticRun = PASS::semantic3done;