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

+1-1
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

+8-2
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

+2-1
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

+5
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

+1-1
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

+1-1
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

+1-1
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

+5-5
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

+26
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
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+
}

clang/unittests/Format/FormatTest.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -5724,6 +5724,24 @@ TEST_F(FormatTest, HashInMacroDefinition) {
57245724
getLLVMStyleWithColumns(22));
57255725

57265726
verifyFormat("#define A void # ## #", getLLVMStyleWithColumns(22));
5727+
5728+
#if 0
5729+
// FIXME: The correct format is:
5730+
verifyFormat("{\n"
5731+
" {\n"
5732+
"#define GEN_ID(_x) char *_x{#_x}\n"
5733+
" GEN_ID(one);\n"
5734+
" }\n"
5735+
"}");
5736+
#endif
5737+
verifyFormat("{\n"
5738+
" {\n"
5739+
"#define GEN_ID(_x) \\\n"
5740+
" char *_x { #_x }\n"
5741+
" GEN_ID(one);\n"
5742+
" }\n"
5743+
"}",
5744+
getGoogleStyle());
57275745
}
57285746

57295747
TEST_F(FormatTest, RespectWhitespaceInMacroDefinitions) {

clang/unittests/Format/TokenAnnotatorTest.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,25 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
32033203
EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
32043204
EXPECT_BRACE_KIND(Tokens[13], BK_Block);
32053205

3206+
Tokens = annotate("{\n"
3207+
" {\n"
3208+
"#define GEN_ID(_x) char *_x{#_x}\n"
3209+
" GEN_ID(one);\n"
3210+
" }\n"
3211+
"}");
3212+
ASSERT_EQ(Tokens.size(), 23u) << Tokens;
3213+
EXPECT_TOKEN(Tokens[0], tok::l_brace, TT_BlockLBrace);
3214+
EXPECT_BRACE_KIND(Tokens[0], BK_Block);
3215+
EXPECT_TOKEN(Tokens[1], tok::l_brace, TT_BlockLBrace);
3216+
EXPECT_BRACE_KIND(Tokens[1], BK_Block);
3217+
#if 0
3218+
// FIXME:
3219+
EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
3220+
EXPECT_BRACE_KIND(Tokens[14], BK_BracedInit);
3221+
#endif
3222+
EXPECT_BRACE_KIND(Tokens[20], BK_Block);
3223+
EXPECT_BRACE_KIND(Tokens[21], BK_Block);
3224+
32063225
Tokens = annotate("a = class extends goog.a {};",
32073226
getGoogleStyle(FormatStyle::LK_JavaScript));
32083227
ASSERT_EQ(Tokens.size(), 11u) << Tokens;

cmake/Modules/LLVMVersion.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
77
set(LLVM_VERSION_MINOR 1)
88
endif()
99
if(NOT DEFINED LLVM_VERSION_PATCH)
10-
set(LLVM_VERSION_PATCH 6)
10+
set(LLVM_VERSION_PATCH 7)
1111
endif()
1212
if(NOT DEFINED LLVM_VERSION_SUFFIX)
1313
set(LLVM_VERSION_SUFFIX)

compiler-rt/lib/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include(SanitizerUtils)
99
#
1010
#TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, utils).
1111
if (COMPILER_RT_HAS_SANITIZER_COMMON AND
12-
(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR COMPILER_RT_BUILD_MEMPROF))
12+
(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR COMPILER_RT_BUILD_MEMPROF OR COMPILER_RT_BUILD_CTX_PROFILE))
1313
add_subdirectory(sanitizer_common)
1414
endif()
1515

compiler-rt/lib/lsan/lsan_interceptors.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ INTERCEPTOR(void*, malloc, uptr size) {
7777
}
7878

7979
INTERCEPTOR(void, free, void *p) {
80+
if (UNLIKELY(!p))
81+
return;
8082
if (DlsymAlloc::PointerIsMine(p))
8183
return DlsymAlloc::Free(p);
8284
ENSURE_LSAN_INITED;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// RUN: %clang -O0 %s -o %t && %run %t
2+
3+
// FIXME: TSAN does not use DlsymAlloc.
4+
// UNSUPPORTED: tsan
5+
// FIXME: investigate why this fails on macos
6+
// UNSUPPORTED: darwin
7+
8+
#include <stdlib.h>
9+
10+
const char *test() __attribute__((disable_sanitizer_instrumentation)) {
11+
void *volatile p = malloc(3);
12+
p = realloc(p, 7);
13+
free(p);
14+
15+
p = calloc(3, 7);
16+
free(p);
17+
18+
free(NULL);
19+
20+
return "";
21+
}
22+
23+
const char *__asan_default_options()
24+
__attribute__((disable_sanitizer_instrumentation)) {
25+
return test();
26+
}
27+
const char *__hwasan_default_options()
28+
__attribute__((disable_sanitizer_instrumentation)) {
29+
return test();
30+
}
31+
const char *__lsan_default_options()
32+
__attribute__((disable_sanitizer_instrumentation)) {
33+
return test();
34+
}
35+
const char *__memprof_default_options()
36+
__attribute__((disable_sanitizer_instrumentation)) {
37+
return test();
38+
}
39+
const char *__msan_default_options()
40+
__attribute__((disable_sanitizer_instrumentation)) {
41+
return test();
42+
}
43+
const char *__nsan_default_options()
44+
__attribute__((disable_sanitizer_instrumentation)) {
45+
return test();
46+
}
47+
const char *__rtsan_default_options()
48+
__attribute__((disable_sanitizer_instrumentation)) {
49+
return test();
50+
}
51+
const char *__tsan_default_options()
52+
__attribute__((disable_sanitizer_instrumentation)) {
53+
return test();
54+
}
55+
const char *__ubsan_default_options()
56+
__attribute__((disable_sanitizer_instrumentation)) {
57+
return test();
58+
}
59+
60+
int main(int argc, char **argv) { return 0; }

libcxx/include/__config

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
2828
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
2929
// defined to XXYYZZ.
30-
# define _LIBCPP_VERSION 190106
30+
# define _LIBCPP_VERSION 190107
3131

3232
# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
3333
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)

llvm/cmake/modules/Findzstd.cmake

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# zstd::libzstd_shared
1111
# zstd::libzstd_static
1212

13-
if(MSVC)
13+
if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
1414
set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
1515
else()
1616
set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
@@ -33,7 +33,8 @@ if(zstd_FOUND)
3333
set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
3434
elseif (NOT TARGET zstd::libzstd_shared)
3535
add_library(zstd::libzstd_shared SHARED IMPORTED)
36-
if(MSVC)
36+
if(MSVC OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
37+
include(GNUInstallDirs) # For CMAKE_INSTALL_LIBDIR and friends.
3738
# IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the "library".
3839
get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)
3940
if(NOT "${CMAKE_INSTALL_LIBDIR}" STREQUAL "" AND NOT "${CMAKE_INSTALL_BINDIR}" STREQUAL "")

llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
838838
SDValue ScalarizeVecRes_BUILD_VECTOR(SDNode *N);
839839
SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
840840
SDValue ScalarizeVecRes_FP_ROUND(SDNode *N);
841-
SDValue ScalarizeVecRes_ExpOp(SDNode *N);
841+
SDValue ScalarizeVecRes_UnaryOpWithExtraInput(SDNode *N);
842842
SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
843843
SDValue ScalarizeVecRes_LOAD(LoadSDNode *N);
844844
SDValue ScalarizeVecRes_SCALAR_TO_VECTOR(SDNode *N);

0 commit comments

Comments
 (0)