Skip to content

Commit 7e8c93c

Browse files
committed
Merge remote-tracking branch 'upstream/release/19.x' into rustc/19.1-2024-12-03
2 parents 59512b0 + cd70802 commit 7e8c93c

36 files changed

+381
-46
lines changed

.github/workflows/libclang-python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
projects: clang
4444
# There is an issue running on "windows-2019".
4545
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
46-
os_list: '["ubuntu-latest"]'
46+
os_list: '["ubuntu-22.04"]'
4747
python_version: ${{ matrix.python-version }}

.github/workflows/llvm-project-tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ on:
3939
type: string
4040
# Use windows-2019 due to:
4141
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42-
default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
42+
# Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu
43+
# version in the CI container. Without this, setup-python tries
44+
# to install a python version linked against a newer version of glibc.
45+
# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
46+
# container is bumped.
47+
default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
4348

4449
python_version:
4550
required: false
@@ -113,7 +118,8 @@ jobs:
113118
run: |
114119
if [ "${{ runner.os }}" == "Linux" ]; then
115120
builddir="/mnt/build/"
116-
mkdir -p $builddir
121+
sudo mkdir -p $builddir
122+
sudo chown gha $builddir
117123
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
118124
else
119125
builddir="$(pwd)"/build

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,8 @@ Bug Fixes to C++ Support
11231123
- Fixed assertion failure by skipping the analysis of an invalid field declaration. (#GH99868)
11241124
- Fix an issue with dependent source ___location expressions (#GH106428), (#GH81155), (#GH80210), (#GH85373)
11251125
- Fix handling of ``_`` as the name of a lambda's init capture variable. (#GH107024)
1126-
1126+
- Fixed recognition of ``std::initializer_list`` when it's surrounded with ``extern "C++"`` and exported
1127+
out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218)
11271128

11281129
Bug Fixes to AST Handling
11291130
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6189,6 +6189,11 @@ std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
61896189
if (auto P = SearchPaths(TC.getFilePaths()))
61906190
return *P;
61916191

6192+
SmallString<128> R2(ResourceDir);
6193+
llvm::sys::path::append(R2, "..", "..", Name);
6194+
if (llvm::sys::fs::exists(Twine(R2)))
6195+
return std::string(R2);
6196+
61926197
return std::string(Name);
61936198
}
61946199

clang/lib/Driver/ToolChains/Hexagon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
379379
if (NeedsXRayDeps)
380380
linkXRayRuntimeDeps(HTC, Args, CmdArgs);
381381

382-
CmdArgs.push_back("-lclang_rt.builtins-hexagon");
383382
if (!Args.hasArg(options::OPT_nolibc))
384383
CmdArgs.push_back("-lc");
384+
CmdArgs.push_back("-lclang_rt.builtins-hexagon");
385385
}
386386
if (D.CCCIsCXX()) {
387387
if (HTC.ShouldLinkCXXStdlib(Args))

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
512512
break;
513513
do {
514514
NextTok = Tokens->getNextToken();
515-
} while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof));
515+
} while (!NextTok->HasUnescapedNewline && NextTok->isNot(tok::eof));
516516

517517
while (NextTok->is(tok::comment))
518518
NextTok = Tokens->getNextToken();

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11919,7 +11919,7 @@ bool Sema::isStdInitializerList(QualType Ty, QualType *Element) {
1191911919
if (TemplateClass->getIdentifier() !=
1192011920
&PP.getIdentifierTable().get("initializer_list") ||
1192111921
!getStdNamespace()->InEnclosingNamespaceSetOf(
11922-
TemplateClass->getDeclContext()))
11922+
TemplateClass->getNonTransparentDeclContext()))
1192311923
return false;
1192411924
// This is a template called std::initializer_list, but is it the right
1192511925
// template?

clang/test/Driver/hexagon-toolchain-linux.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// CHECK000-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o
1212
// CHECK000: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
1313
// CHECK000: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
14-
// CHECK000: "-lclang_rt.builtins-hexagon" "-lc"
14+
// CHECK000: "-lc" "-lclang_rt.builtins-hexagon"
1515
// -----------------------------------------------------------------------------
1616
// Passing --musl --shared
1717
// -----------------------------------------------------------------------------
@@ -21,7 +21,7 @@
2121
// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -shared %s 2>&1 | FileCheck -check-prefix=CHECK001 %s
2222
// CHECK001-NOT: -dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1
2323
// CHECK001: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o"
24-
// CHECK001: "-lclang_rt.builtins-hexagon" "-lc"
24+
// CHECK001: "-lc" "-lclang_rt.builtins-hexagon"
2525
// CHECK001-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
2626
// -----------------------------------------------------------------------------
2727
// Passing --musl -nostdlib
@@ -33,8 +33,8 @@
3333
// CHECK002: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
3434
// CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o
3535
// CHECK002-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
36-
// CHECK002-NOT: "-lclang_rt.builtins-hexagon"
3736
// CHECK002-NOT: "-lc"
37+
// CHECK002-NOT: "-lclang_rt.builtins-hexagon"
3838
// -----------------------------------------------------------------------------
3939
// Passing --musl -nostartfiles
4040
// -----------------------------------------------------------------------------
@@ -45,7 +45,7 @@
4545
// CHECK003: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
4646
// CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}Scrt1.o
4747
// CHECK003-NOT: {{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o
48-
// CHECK003: "-lclang_rt.builtins-hexagon" "-lc"
48+
// CHECK003: "-lc" "-lclang_rt.builtins-hexagon"
4949
// -----------------------------------------------------------------------------
5050
// Passing --musl -nodefaultlibs
5151
// -----------------------------------------------------------------------------
@@ -55,8 +55,8 @@
5555
// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=CHECK004 %s
5656
// CHECK004: "-dynamic-linker={{/|\\\\}}lib{{/|\\\\}}ld-musl-hexagon.so.1"
5757
// CHECK004: "{{.*}}basic_linux_libcxx_tree{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
58-
// CHECK004-NOT: "-lclang_rt.builtins-hexagon"
5958
// CHECK004-NOT: "-lc"
59+
// CHECK004-NOT: "-lclang_rt.builtins-hexagon"
6060
// -----------------------------------------------------------------------------
6161
// Passing --musl -nolibc
6262
// -----------------------------------------------------------------------------

clang/test/Driver/modules-print-library-module-manifest-path.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,28 @@
1818
// RUN: --target=x86_64-linux-gnu 2>&1 \
1919
// RUN: | FileCheck libcxx.cpp
2020

21+
// for macos there is a different directory structure
22+
// where the library and libc++.modules.json file are in lib
23+
// directly but headers are in clang/ver directory which
24+
// is the resource directory
25+
// RUN: mkdir -p %t/Inputs/usr/lib/clang/20
26+
// RUN: touch %t/Inputs/usr/lib/libc++.so
27+
// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
28+
// RUN: %clang -print-library-module-manifest-path \
29+
// RUN: -stdlib=libc++ \
30+
// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
31+
// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
32+
// RUN: | FileCheck libcxx.cpp.macos
33+
34+
// RUN: rm %t/Inputs/usr/lib/libc++.so
35+
// RUN: touch %t/Inputs/usr/lib/libc++.a
36+
// RUN: touch %t/Inputs/usr/lib/libc++.modules.json
37+
// RUN: %clang -print-library-module-manifest-path \
38+
// RUN: -stdlib=libc++ \
39+
// RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
40+
// RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
41+
// RUN: | FileCheck libcxx.cpp.macos
42+
2143
// RUN: rm %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
2244
// RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
2345
// RUN: %clang -print-library-module-manifest-path \
@@ -40,6 +62,10 @@
4062

4163
// CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}libc++.modules.json
4264

65+
//--- libcxx.cpp.macos
66+
67+
// CHECK: {{.*}}libc++.modules.json
68+
4369
//--- libcxx-no-shared-lib.cpp
4470

4571
// Note this might find a different path depending whether search path
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
//
5+
// RUN: %clang_cc1 -std=c++20 %t/std.cppm -emit-module-interface -o %t/std.pcm
6+
// RUN: %clang_cc1 -std=c++20 %t/mod.cppm -fprebuilt-module-path=%t -emit-module-interface -o %t/mod.pcm
7+
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -verify %t/main.cpp
8+
9+
//--- std.cppm
10+
export module std;
11+
12+
extern "C++" {
13+
namespace std {
14+
export template <class E>
15+
class initializer_list {
16+
const E* _1;
17+
const E* _2;
18+
};
19+
}
20+
}
21+
22+
//--- mod.cppm
23+
export module mod;
24+
25+
import std;
26+
27+
export struct A {
28+
void func(std::initializer_list<int>) {}
29+
};
30+
31+
//--- main.cpp
32+
// expected-no-diagnostics
33+
import std;
34+
import mod;
35+
36+
int main() {
37+
A{}.func({1,1});
38+
return 0;
39+
}

0 commit comments

Comments
 (0)