Skip to content

Commit a1e694c

Browse files
authored
Merge pull request #4792 from kinke/merge_stable
Merge upstream stable
2 parents 6c519ec + fbe4c6f commit a1e694c

Some content is hidden

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

55 files changed

+198
-103
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# LDC master
22

33
#### Big news
4-
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784)
4+
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784, #4792)
55
- Support for [LLVM 19](https://releases.llvm.org/19.1.0/docs/ReleaseNotes.html); LLVM for prebuilt packages bumped to v19.1.3 (incl. macOS arm64). (#4712, #4735, #4763, #4772)
66
- Android: NDK for prebuilt package bumped from r26d to r27c. (#4711, #4772)
77
- ldc2.conf: %%ldcconfigpath%% placeholder added - specifies the directory where current configuration file is located. (#4717)

dmd/expressionsem.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
55545554
{
55555555
if (exp.fd.ident == Id.empty)
55565556
{
5557-
const(char)[] s;
5557+
string s;
55585558
if (exp.fd.fes)
55595559
s = "__foreachbody";
55605560
else if (exp.fd.tok == TOK.reserved)
@@ -5588,7 +5588,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
55885588
symtab = sds.symtab;
55895589
}
55905590
assert(symtab);
5591-
Identifier id = Identifier.generateId(s, symtab.length() + 1);
5591+
Identifier id = Identifier.generateIdWithLoc(s, exp.loc);
55925592
exp.fd.ident = id;
55935593
if (exp.td)
55945594
exp.td.ident = id;

dmd/frontend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8692,6 +8692,7 @@ struct Id final
86928692
static Identifier* isRef;
86938693
static Identifier* isOut;
86948694
static Identifier* isLazy;
8695+
static Identifier* isCOMClass;
86958696
static Identifier* hasMember;
86968697
static Identifier* identifier;
86978698
static Identifier* fullyQualifiedName;

dmd/id.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ immutable Msgtable[] msgtable =
482482
{ "isRef" },
483483
{ "isOut" },
484484
{ "isLazy" },
485+
{ "isCOMClass" },
485486
{ "hasMember" },
486487
{ "identifier" },
487488
{ "fullyQualifiedName" },

dmd/traits.d

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,26 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
693693

694694
return isDeclX(d => (d.storage_class & STC.lazy_) != 0);
695695
}
696+
if (e.ident == Id.isCOMClass)
697+
{
698+
if (dim != 1)
699+
return dimError(1);
700+
701+
auto o = (*e.args)[0];
702+
auto s = getDsymbol(o);
703+
AggregateDeclaration agg;
704+
705+
if (!s || ((agg = s.isAggregateDeclaration()) is null))
706+
{
707+
error(e.loc, "argument to `__traits(isCOMClass, %s)` is not a declaration", o.toChars());
708+
return ErrorExp.get();
709+
}
710+
711+
if (ClassDeclaration cd = agg.isClassDeclaration())
712+
return cd.com ? True() : False();
713+
else
714+
return False();
715+
}
696716
if (e.ident == Id.identifier)
697717
{
698718
// Get identifier for symbol as a string literal

runtime/druntime/src/core/internal/array/arrayassign.d

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Tarr _d_arraysetassign(Tarr : T[], T)(return scope Tarr to, scope ref T value) @
347347
static if (__traits(isCopyable, T))
348348
copyEmplace(value, dst);
349349
else
350-
memcpy(cast(void*) &value, cast(void*) &dst, elemSize);
350+
memcpy(cast(void*) &dst, cast(void*) &value, elemSize);
351351
auto elem = cast(Unqual!T*) &tmp;
352352
destroy(*elem);
353353
}
@@ -395,6 +395,20 @@ Tarr _d_arraysetassign(Tarr : T[], T)(return scope Tarr to, scope ref T value) @
395395
assert(arr == [S(1234), S(1234), S(1234), S(1234)]);
396396
}
397397

398+
// disabled copy constructor
399+
@safe unittest
400+
{
401+
static struct S
402+
{
403+
int val;
404+
@disable this(ref S);
405+
}
406+
S[1] arr;
407+
S s = S(1234);
408+
_d_arraysetassign(arr[], s);
409+
assert(arr[0].val == 1234);
410+
}
411+
398412
// throwing and `nothrow`
399413
@safe nothrow unittest
400414
{

runtime/druntime/src/core/lifetime.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,8 +2739,11 @@ if (is(T == class))
27392739
auto init = __traits(initSymbol, T);
27402740
void* p;
27412741

2742-
static if (__traits(getLinkage, T) == "Windows")
2742+
static if (__traits(isCOMClass, T))
27432743
{
2744+
// If this is a COM class we allocate it using malloc.
2745+
// This allows the reference counting to outlive the reference known about by the GC.
2746+
27442747
p = pureMalloc(init.length);
27452748
if (!p)
27462749
onOutOfMemoryError();

tests/codegen/funcliteral_defaultarg_gh1634.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ int foo(int function() d = () { return 123; })
1414
// CHECK-LABEL: define{{.*}} @{{.*}}D3mod8call_fooFZi
1515
int call_foo()
1616
{
17-
// CHECK: call {{.*}}D3mod3fooFPFZiZi{{.*}}D3mod9__lambda5FNaNbNiNfZi
17+
// CHECK: call {{.*}}D3mod3fooFPFZiZi{{.*}}D3mod15__lambda_L9_C28FNaNbNiNfZi
1818
return foo();
1919
}
2020

2121
// The lambda is defined by the first call to foo with default arguments.
22-
// CHECK-LABEL: define{{.*}} @{{.*}}D3mod9__lambda5FNaNbNiNfZi
22+
// CHECK-LABEL: define{{.*}} @{{.*}}D3mod15__lambda_L9_C28FNaNbNiNfZi
2323
// CHECK: ret i32 123
2424

2525
// CHECK-LABEL: define{{.*}} @{{.*}}Dmain
2626
void main()
2727
{
28-
// CHECK: call {{.*}}D3mod3fooFPFZiZi{{.*}}D3mod9__lambda5FNaNbNiNfZi
28+
// CHECK: call {{.*}}D3mod3fooFPFZiZi{{.*}}D3mod15__lambda_L9_C28FNaNbNiNfZi
2929
assert(foo() == 123);
3030
}

tests/codegen/lambdas_gh3648.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ void foo()
2626
}
2727

2828
// the global variables should be defined as internal:
29-
// CHECK: _D14lambdas_gh36489__lambda5FZ10global_bari{{.*}} = internal thread_local global
30-
// CHECK: _D14lambdas_gh36489__lambda6FZ18global_bar_inlinedOi{{.*}} = internal global
31-
// CHECK: _D14lambdas_gh36483fooFZ__T9__lambda1TiZQnFiZ12lambda_templi{{.*}} = internal global
29+
// CHECK: _D14lambdas_gh364815__lambda_L5_C12FZ10global_bari{{.*}} = internal thread_local global
30+
// CHECK: _D14lambdas_gh364816__lambda_L10_C20FZ18global_bar_inlinedOi{{.*}} = internal global
31+
// CHECK: _D14lambdas_gh36483fooFZ__T15__lambda_L21_C5TiZQuFiZ12lambda_templi{{.*}} = internal global
3232

3333
// foo() should only call two lambdas:
3434
// CHECK: define {{.*}}_D14lambdas_gh36483fooFZv
35-
// CHECK-NEXT: call {{.*}}__lambda5
36-
// CHECK-NEXT: call {{.*}}__T9__lambda1
35+
// CHECK-NEXT: call {{.*}}__lambda_L5_C12
36+
// CHECK-NEXT: call {{.*}}__T15__lambda_L21_C5
3737
// CHECK-NEXT: ret void
3838

3939
// bar() should be defined as internal:
40-
// CHECK: define internal {{.*}}__lambda5
40+
// CHECK: define internal {{.*}}__lambda_L5_C12
4141

4242
// bar_inlined() should NOT have made it to the .ll:
43-
// CHECK-NOT: define {{.*}}__lambda6
43+
// CHECK-NOT: define {{.*}}__lambda_L10_C20
4444

4545
// the template lambda instance should be defined as internal:
46-
// CHECK: define internal {{.*}}__T9__lambda1
46+
// CHECK: define internal {{.*}}__T15__lambda_L21_C5

tests/codegen/lambdas_gh3648b.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ void foo()
1111
}
1212

1313
// the global variables should be defined as internal:
14-
// CHECK: _D14lambdas_gh36489__lambda5FZ10global_bari{{.*}} = internal thread_local global
15-
// CHECK: _D14lambdas_gh36489__lambda6FZ18global_bar_inlinedOi{{.*}} = internal global
14+
// CHECK: _D14lambdas_gh364815__lambda_L5_C12FZ10global_bari{{.*}} = internal thread_local global
15+
// CHECK: _D14lambdas_gh364816__lambda_L10_C20FZ18global_bar_inlinedOi{{.*}} = internal global
1616

1717
// foo() should only call one lambda:
1818
// CHECK: define {{.*}}_D15lambdas_gh3648b3fooFZv
19-
// CHECK-NEXT: call {{.*}}__lambda5
19+
// CHECK-NEXT: call {{.*}}__lambda_L5_C12
2020
// CHECK-NEXT: ret void
2121

2222
// bar() should be defined as internal:
23-
// CHECK: define internal {{.*}}__lambda5
23+
// CHECK: define internal {{.*}}__lambda_L5_C12
2424

2525
// bar_inlined() should NOT have made it to the .ll:
26-
// CHECK-NOT: define {{.*}}__lambda6
26+
// CHECK-NOT: define {{.*}}__lambda_L10_C20

0 commit comments

Comments
 (0)