Skip to content

Commit 348d41e

Browse files
committed
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.
1 parent 53fc26e commit 348d41e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1210
-916
lines changed

gcc/d/d-codegen.cc

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,33 @@ along with GCC; see the file COPYING3. If not see
4343
#include "d-tree.h"
4444

4545

46-
/* Return the GCC location for the D frontend location LOC. */
46+
/* Return the GCC location for the D frontend source location LOC. */
4747

4848
location_t
49-
make_location_t (const Loc &loc)
49+
make_location_t (const SourceLoc &loc)
5050
{
5151
location_t gcc_location = input_location;
5252

53-
if (const char *filename = loc.filename ())
53+
if (loc.filename.length != 0)
5454
{
55-
linemap_add (line_table, LC_ENTER, 0, filename, loc.linnum ());
56-
linemap_line_start (line_table, loc.linnum (), 0);
57-
gcc_location = linemap_position_for_column (line_table, loc.charnum ());
55+
linemap_add (line_table, LC_ENTER, 0, loc.filename.ptr, loc.line);
56+
linemap_line_start (line_table, loc.line, 0);
57+
gcc_location = linemap_position_for_column (line_table, loc.column);
5858
linemap_add (line_table, LC_LEAVE, 0, NULL, 0);
5959
}
6060

6161
return gcc_location;
6262
}
6363

64+
/* Likewise, but converts LOC from a compact opaque location. */
65+
66+
location_t
67+
make_location_t (const Loc loc)
68+
{
69+
const SourceLoc sloc = loc.toSourceLoc ();
70+
return make_location_t (sloc);
71+
}
72+
6473
/* Return the DECL_CONTEXT for symbol DSYM. */
6574

6675
tree

gcc/d/d-diagnostic.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,14 @@ escape_d_format (const char *format)
183183
front-end, which does not get translated by the gcc diagnostic routines. */
184184

185185
static void ATTRIBUTE_GCC_DIAG(3,0)
186-
d_diagnostic_report_diagnostic (const Loc &loc, int opt, const char *format,
187-
va_list ap, diagnostic_t kind, bool verbatim)
186+
d_diagnostic_report_diagnostic (const SourceLoc &loc, int opt,
187+
const char *format, va_list ap,
188+
diagnostic_t kind, bool verbatim)
188189
{
189190
va_list argp;
190191
va_copy (argp, ap);
191192

192-
if (loc.filename () || !verbatim)
193+
if (loc.filename.length != 0 || !verbatim)
193194
{
194195
rich_location rich_loc (line_table, make_location_t (loc));
195196
diagnostic_info diagnostic;
@@ -220,8 +221,8 @@ d_diagnostic_report_diagnostic (const Loc &loc, int opt, const char *format,
220221
error count depending on how KIND is treated. */
221222

222223
void D_ATTRIBUTE_FORMAT(2,0) ATTRIBUTE_GCC_DIAG(2,0)
223-
verrorReport (const Loc& loc, const char *format, va_list ap, ErrorKind kind,
224-
const char *prefix1, const char *prefix2)
224+
verrorReport (const SourceLoc loc, const char *format, va_list ap,
225+
ErrorKind kind, const char *prefix1, const char *prefix2)
225226
{
226227
diagnostic_t diag_kind = DK_UNSPECIFIED;
227228
int opt = 0;
@@ -304,7 +305,7 @@ verrorReport (const Loc& loc, const char *format, va_list ap, ErrorKind kind,
304305
explicit location LOC. This doesn't increase the global error count. */
305306

306307
void D_ATTRIBUTE_FORMAT(2,0) ATTRIBUTE_GCC_DIAG(2,0)
307-
verrorReportSupplemental (const Loc& loc, const char* format, va_list ap,
308+
verrorReportSupplemental (const SourceLoc loc, const char* format, va_list ap,
308309
ErrorKind kind)
309310
{
310311
if (kind == ErrorKind::error)

gcc/d/d-frontend.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ isBuiltin (FuncDeclaration *fd)
5252
Return result; NULL if cannot evaluate it. */
5353

5454
Expression *
55-
eval_builtin (const Loc &loc, FuncDeclaration *fd, Expressions *arguments)
55+
eval_builtin (Loc loc, FuncDeclaration *fd, Expressions *arguments)
5656
{
5757
if (fd->builtin == BUILTIN::unimp)
5858
return NULL;
@@ -79,7 +79,7 @@ eval_builtin (const Loc &loc, FuncDeclaration *fd, Expressions *arguments)
7979
/* Build and return typeinfo type for TYPE. */
8080

8181
Type *
82-
getTypeInfoType (const Loc &loc, Type *type, Scope *sc)
82+
getTypeInfoType (Loc loc, Type *type, Scope *sc)
8383
{
8484
gcc_assert (type->ty != TY::Terror);
8585
check_typeinfo_type (loc, sc);

gcc/d/d-lang.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ d_parse_file (void)
11131113

11141114
if (count < 0)
11151115
{
1116-
error (Loc ("stdin", 0, 0), "%s", xstrerror (errno));
1116+
error (Loc::singleFilename ("stdin"), "%s", xstrerror (errno));
11171117
free (buffer);
11181118
continue;
11191119
}

gcc/d/d-target.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Target::fieldalign (Type *type)
241241
/* Returns a Type for the va_list type of the target. */
242242

243243
Type *
244-
Target::va_listType (const Loc &, Scope *)
244+
Target::va_listType (Loc, Scope *)
245245
{
246246
if (this->tvalist)
247247
return this->tvalist;
@@ -517,7 +517,7 @@ d_handle_target_object_format (void)
517517
LOC is the location to use for the returned expression. */
518518

519519
Expression *
520-
Target::getTargetInfo (const char *key, const Loc &loc)
520+
Target::getTargetInfo (const char *key, Loc loc)
521521
{
522522
unsigned ix;
523523
d_target_info_spec *spec;

gcc/d/d-tree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ extern Expression *d_eval_constant_expression (const Loc &, tree);
534534
extern void d_init_versions (void);
535535

536536
/* In d-codegen.cc. */
537-
extern location_t make_location_t (const Loc &);
537+
extern location_t make_location_t (const SourceLoc &);
538+
extern location_t make_location_t (const Loc);
538539
extern tree d_decl_context (Dsymbol *);
539540
extern tree copy_aggregate_type (tree);
540541
extern bool declaration_reference_p (Declaration *);

gcc/d/decl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ build_decl_tree (Dsymbol *d)
11141114
if (d->loc.filename ())
11151115
input_location = make_location_t (d->loc);
11161116
else
1117-
input_location = make_location_t (Loc ("<no_file>", 1, 0));
1117+
input_location = make_location_t (Loc::singleFilename ("<no_file>"));
11181118

11191119
DeclVisitor v = DeclVisitor ();
11201120
v.build_dsymbol (d);

gcc/d/dmd/MERGE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
d29e3eca45edaeef63b31f78c9846fc6e2870c49
1+
ffbad272b649b7ae3e88cfdc85688bfef3168994
22

33
The first line of this file holds the git revision number of the last
44
merge done from the dlang/dmd repository.

gcc/d/dmd/aggregate.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
154154
bool disableNew; /// disallow allocations using `new`
155155
Sizeok sizeok = Sizeok.none; /// set when structsize contains valid data
156156

157-
final extern (D) this(const ref Loc loc, Identifier id)
157+
final extern (D) this(Loc loc, Identifier id)
158158
{
159159
super(loc, id);
160160
visibility = Visibility(Visibility.Kind.public_);
@@ -189,7 +189,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
189189

190190
abstract void finalizeSize();
191191

192-
override final uinteger_t size(const ref Loc loc)
192+
override final uinteger_t size(Loc loc)
193193
{
194194
//printf("+AggregateDeclaration::size() %s, scope = %p, sizeok = %d\n", toChars(), _scope, sizeok);
195195
bool ok = determineSize(this, loc);

gcc/d/dmd/aggregate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace dmd
4545
{
4646
FuncDeclaration *search_toString(StructDeclaration *sd);
4747
void semanticTypeInfoMembers(StructDeclaration *sd);
48-
bool fill(StructDeclaration* sd, const Loc &loc, Expressions &elements, bool ctorinit);
48+
bool fill(StructDeclaration* sd, Loc loc, Expressions &elements, bool ctorinit);
4949
}
5050

5151
enum class ClassKind : uint8_t
@@ -119,7 +119,7 @@ class AggregateDeclaration : public ScopeDsymbol
119119

120120
virtual Scope *newScope(Scope *sc);
121121
virtual void finalizeSize() = 0;
122-
uinteger_t size(const Loc &loc) override final;
122+
uinteger_t size(Loc loc) override final;
123123
Type *getType() override final;
124124
bool isDeprecated() const override final; // is aggregate deprecated?
125125
bool isNested() const;
@@ -168,7 +168,7 @@ class StructDeclaration : public AggregateDeclaration
168168
private:
169169
uint16_t bitFields;
170170
public:
171-
static StructDeclaration *create(const Loc &loc, Identifier *id, bool inObject);
171+
static StructDeclaration *create(Loc loc, Identifier *id, bool inObject);
172172
StructDeclaration *syntaxCopy(Dsymbol *s) override;
173173
const char *kind() const override;
174174
void finalizeSize() override final;
@@ -278,7 +278,7 @@ class ClassDeclaration : public AggregateDeclaration
278278
ObjcClassDeclaration objc; // Data for a class declaration that is needed for the Objective-C integration
279279
Symbol *cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr
280280

281-
static ClassDeclaration *create(const Loc &loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
281+
static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
282282
const char *toPrettyChars(bool QualifyTypes = false) override;
283283
ClassDeclaration *syntaxCopy(Dsymbol *s) override;
284284
Scope *newScope(Scope *sc) override;

0 commit comments

Comments
 (0)