Skip to content

Commit

Permalink
Merge pull request #4798 from kinke/merge_stable
Browse files Browse the repository at this point in the history
Merge upstream stable
  • Loading branch information
kinke authored Dec 8, 2024
2 parents f241166 + 5c3509e commit dd44cfa
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784, #4792)
- 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)
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784, #4792, #4798)
- Support for [LLVM 19](https://releases.llvm.org/19.1.0/docs/ReleaseNotes.html). The prebuilt packages use v19.1.3 (incl. macOS arm64). (#4712, #4735, #4763, #4772)
- Objective-C: The compiler now properly supports Objective-C classes and protocols, as well as swift stub classes (via the `@swift` UDA). (#4777)
- Android: NDK for prebuilt package bumped from r26d to r27c. (#4711, #4772)
- ldc2.conf: %%ldcconfigpath%% placeholder added - specifies the directory where current configuration file is located. (#4717)
- ldc2.conf: `%%ldcconfigpath%%` placeholder added - specifies the directory where current configuration file is located. (#4717)
- Add support for building against a system copy of zlib through `-DPHOBOS_SYSTEM_ZLIB=ON`. (#4742)
- Emscripten: The compiler now mimicks a musl Linux platform wrt. extra predefined versions (`linux`, `Posix`, `CRuntime_Musl`, `CppRuntime_LLVM`). (#4750)
- Objective-C: The compiler now properly supports Objective-C classes and protocols, as well as swift stub classes (via the `@swift` UDA). (#4777)

#### Platform support
- Supports LLVM 15 - 19.
Expand Down
2 changes: 1 addition & 1 deletion dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -5588,7 +5588,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
symtab = sds.symtab;
}
assert(symtab);
Identifier id = Identifier.generateIdWithLoc(s, exp.loc);
Identifier id = Identifier.generateIdWithLoc(s, exp.loc, cast(string) toDString(sc.parent.toPrettyChars()));
exp.fd.ident = id;
if (exp.td)
exp.td.ident = id;
Expand Down
17 changes: 13 additions & 4 deletions dmd/identifier.d
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,14 @@ nothrow:
* Params:
* prefix = first part of the identifier name.
* loc = source location to use in the identifier name.
* parent = (optional) extra part to be used in uniqueness check,
* if (prefix1, loc1) == (prefix2, loc2), but
* parent1 != parent2, no new name will be generated.
* Returns:
* Identifier (inside Identifier.idPool) with deterministic name based
* on the source location.
*/
extern (D) static Identifier generateIdWithLoc(string prefix, const ref Loc loc)
extern (D) static Identifier generateIdWithLoc(string prefix, const ref Loc loc, string parent = "")
{
// generate `<prefix>_L<line>_C<col>`
OutBuffer idBuf;
Expand All @@ -234,14 +237,20 @@ nothrow:
* https://issues.dlang.org/show_bug.cgi?id=18880
* https://issues.dlang.org/show_bug.cgi?id=18868
* https://issues.dlang.org/show_bug.cgi?id=19058
*
* It is a bit trickier for lambdas/dgliterals: we want them to be unique per
* module/mixin + function/template instantiation context. So we use extra parent
* argument for that when dealing with lambdas. We could have added it to prefix
* 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; }
static struct Key { Loc loc; 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),
counters.update(Key(loc, prefix, parent),
() => 1u, // insertion
(ref uint counter) // update
{
Expand All @@ -253,7 +262,7 @@ nothrow:
}
else
{
const key = Key(loc, prefix);
const key = Key(loc, prefix, parent);
if (auto pCounter = key in counters)
{
idBuf.writestring("_");
Expand Down
2 changes: 1 addition & 1 deletion runtime/phobos
Submodule phobos updated 1 files
+7 −16 std/process.d
13 changes: 13 additions & 0 deletions tests/dmd/runnable/imports/test23722_2b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module imports.test23722_2b;

struct T(alias fun) { }

struct S(int i) {
auto t = T!(x => i)();
}

string g() {
S!0 s0;
S!1 s1;
return s1.t.init.mangleof;
}
10 changes: 10 additions & 0 deletions tests/dmd/runnable/test23722_2.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// COMPILE_SEPARATELY:
// EXTRA_SOURCES: imports/test23722_2b.d
// https://issues.dlang.org/show_bug.cgi?id=23722
// Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code
import imports.test23722_2b;

void main() {
S!1 s1;
assert(s1.t.init.mangleof == g);
}

0 comments on commit dd44cfa

Please sign in to comment.