Skip to content

Commit d6b64d8

Browse files
authored
Merge branch 'main' into clangd
2 parents 786d347 + 56ddbef commit d6b64d8

File tree

1,867 files changed

+46121
-16989
lines changed

Some content is hidden

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

1,867 files changed

+46121
-16989
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This workflow is for pre-commit testing of the LLVM-libc project.
2+
name: LLVM-libc Pre-commit Fullbuild Tests
3+
4+
on:
5+
pull_request:
6+
branches: [ "main" ]
7+
paths:
8+
- 'libc/**'
9+
- '.github/workflows/libc-fullbuild-tests.yml'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-24.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- c_compiler: clang
19+
cpp_compiler: clang++
20+
# TODO: add back gcc build when it is fixed
21+
# - c_compiler: gcc
22+
# cpp_compiler: g++
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup ccache
27+
uses: hendrikmuhs/[email protected]
28+
with:
29+
max-size: 1G
30+
key: libc_fullbuild_${{ matrix.c_compiler }}
31+
variant: sccache
32+
33+
- name: Prepare dependencies (Ubuntu)
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-headers-generic linux-libc-dev
37+
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm
38+
39+
- name: Set reusable strings
40+
id: strings
41+
shell: bash
42+
run: |
43+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
44+
echo "build-install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT"
45+
46+
- name: Configure CMake
47+
run: >
48+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
49+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
50+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
51+
-DCMAKE_BUILD_TYPE=MinSizeRel
52+
-DCMAKE_C_COMPILER_LAUNCHER=sccache
53+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
54+
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}
55+
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt"
56+
-DLLVM_LIBC_FULL_BUILD=ON
57+
-DLLVM_LIBC_INCLUDE_SCUDO=ON
58+
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON
59+
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
60+
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF
61+
-G Ninja
62+
-S ${{ github.workspace }}/runtimes
63+
64+
- name: Build
65+
run: >
66+
cmake
67+
--build ${{ steps.strings.outputs.build-output-dir }}
68+
--parallel
69+
--target install
70+
71+
- name: Test
72+
run: >
73+
cmake
74+
--build ${{ steps.strings.outputs.build-output-dir }}
75+
--parallel
76+
--target check-libc
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This workflow is for pre-commit testing of the LLVM-libc project.
2+
name: LLVM-libc Pre-commit Overlay Tests
3+
4+
on:
5+
pull_request:
6+
branches: [ "main" ]
7+
paths:
8+
- 'libc/**'
9+
- '.github/workflows/libc-overlay-tests.yml'
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
16+
fail-fast: false
17+
matrix:
18+
include:
19+
# TODO: add linux gcc when it is fixed
20+
- os: ubuntu-24.04
21+
compiler:
22+
c_compiler: clang
23+
cpp_compiler: clang++
24+
- os: windows-2022
25+
compiler:
26+
c_compiler: clang-cl
27+
cpp_compiler: clang-cl
28+
- os: macos-14
29+
compiler:
30+
c_compiler: clang
31+
cpp_compiler: clang++
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Setup ccache
37+
uses: hendrikmuhs/ccache-action@v1
38+
with:
39+
max-size: 1G
40+
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
41+
variant: sccache
42+
43+
- name: Prepare dependencies (Ubuntu)
44+
if: runner.os == 'Linux'
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build
48+
49+
- name: Prepare dependencies (Windows)
50+
if: runner.os == 'Windows'
51+
run: |
52+
choco install ninja
53+
54+
- name: Prepare dependencies (macOS)
55+
if: runner.os == 'macOS'
56+
run: |
57+
brew install ninja
58+
59+
- name: Set reusable strings
60+
id: strings
61+
shell: bash
62+
run: |
63+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
64+
65+
- name: Configure CMake
66+
run: >
67+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
68+
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
69+
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
70+
-DCMAKE_BUILD_TYPE=MinSizeRel
71+
-DCMAKE_C_COMPILER_LAUNCHER=sccache
72+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
73+
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
74+
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
75+
-DLLVM_ENABLE_RUNTIMES=libc
76+
-G Ninja
77+
-S ${{ github.workspace }}/runtimes
78+
79+
- name: Build
80+
run: >
81+
cmake
82+
--build ${{ steps.strings.outputs.build-output-dir }}
83+
--parallel
84+
--config MinSizeRel
85+
--target libc
86+
87+
- name: Test
88+
run: >
89+
cmake
90+
--build ${{ steps.strings.outputs.build-output-dir }}
91+
--parallel
92+
--target check-libc

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ jobs:
145145
with:
146146
script: |
147147
const FAILURE_REGEX = /Process completed with exit code 1./
148-
const PREEMPTION_REGEX = /The runner has received a shutdown signal|The operation was canceled/
148+
const PREEMPTION_REGEX = /(The runner has received a shutdown signal)|(The operation was canceled)/
149149
150150
function log(msg) {
151151
core.notice(msg)

clang-tools-extra/clangd/HeuristicResolver.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ const Type *resolveDeclsToType(const std::vector<const NamedDecl *> &Decls,
118118
return nullptr;
119119
}
120120

121+
TemplateName getReferencedTemplateName(const Type *T) {
122+
if (const auto *TST = T->getAs<TemplateSpecializationType>()) {
123+
return TST->getTemplateName();
124+
}
125+
if (const auto *DTST = T->getAs<DeducedTemplateSpecializationType>()) {
126+
return DTST->getTemplateName();
127+
}
128+
return TemplateName();
129+
}
130+
121131
// Helper function for HeuristicResolver::resolveDependentMember()
122132
// which takes a possibly-dependent type `T` and heuristically
123133
// resolves it to a CXXRecordDecl in which we can try name lookup.
@@ -142,12 +152,12 @@ CXXRecordDecl *HeuristicResolverImpl::resolveTypeToRecordDecl(const Type *T) {
142152
if (!T)
143153
return nullptr;
144154

145-
const auto *TST = T->getAs<TemplateSpecializationType>();
146-
if (!TST)
155+
TemplateName TN = getReferencedTemplateName(T);
156+
if (TN.isNull())
147157
return nullptr;
148158

149-
const ClassTemplateDecl *TD = dyn_cast_or_null<ClassTemplateDecl>(
150-
TST->getTemplateName().getAsTemplateDecl());
159+
const ClassTemplateDecl *TD =
160+
dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl());
151161
if (!TD)
152162
return nullptr;
153163

clang-tools-extra/clangd/index/dex/Dex.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ class Dex : public SymbolIndex {
146146
// Set of files which were used during this index build.
147147
llvm::StringSet<> Files;
148148
// Contents of the index (symbols, references, etc.)
149+
// This is only populated if `Files` is, which applies to some but not all
150+
// consumers of this class.
149151
IndexContents IdxContents = IndexContents::None;
150152
// Size of memory retained by KeepAlive.
151153
size_t BackingDataSize = 0;

clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ TEST_F(TargetDeclTest, OverloadExpr) {
842842
}
843843

844844
TEST_F(TargetDeclTest, DependentExprs) {
845+
Flags.push_back("--std=c++20");
846+
845847
// Heuristic resolution of method of dependent field
846848
Code = R"cpp(
847849
struct A { void foo() {} };
@@ -962,6 +964,21 @@ TEST_F(TargetDeclTest, DependentExprs) {
962964
};
963965
)cpp";
964966
EXPECT_DECLS("MemberExpr", "void find()");
967+
968+
// Base expression is the type of a non-type template parameter
969+
// which is deduced using CTAD.
970+
Code = R"cpp(
971+
template <int N>
972+
struct Waldo {
973+
const int found = N;
974+
};
975+
976+
template <Waldo W>
977+
int test() {
978+
return W.[[found]];
979+
}
980+
)cpp";
981+
EXPECT_DECLS("CXXDependentScopeMemberExpr", "const int found = N");
965982
}
966983

967984
TEST_F(TargetDeclTest, DependentTypes) {

clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void S::x(int i = 12) {}
2626
int main() {
2727
S s;
2828
s.x();
29-
// CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
29+
// CHECK-NOTES: [[@LINE-1]]:5: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
3030
// CHECK-NOTES: [[@LINE-6]]:11: note: default parameter was declared here
3131
// CHECK-NEXT: void S::x(int i = 12) {}
3232
x();

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,22 @@ if(FUCHSIA_SDK)
300300
set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
301301
endif()
302302

303-
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi)
303+
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi;aarch64-none-elf)
304304
list(APPEND BUILTIN_TARGETS "${target}")
305305
set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
306306
set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
307307
set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
308308
set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
309309
foreach(lang C;CXX;ASM)
310-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb")
310+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target}")
311+
if(NOT ${target} STREQUAL "aarch64-none-elf")
312+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mthumb")
313+
endif()
311314
if(${target} STREQUAL "armv8m.main-none-eabi")
312-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
315+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33")
313316
endif()
314317
if(${target} STREQUAL "armv8.1m.main-none-eabi")
315-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
318+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55")
316319
endif()
317320
set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "${BUILTINS_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
318321
endforeach()
@@ -330,12 +333,15 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.
330333
foreach(lang C;CXX;ASM)
331334
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
332335
# These should be addressed and removed over time.
333-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
336+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
337+
if(NOT ${target} STREQUAL "aarch64-none-elf")
338+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mthumb")
339+
endif()
334340
if(${target} STREQUAL "armv8m.main-none-eabi")
335-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
341+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33")
336342
endif()
337343
if(${target} STREQUAL "armv8.1m.main-none-eabi")
338-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
344+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55")
339345
endif()
340346
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "${RUNTIMES_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
341347
endforeach()

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ elementwise to the input.
648648
Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±infinity
649649

650650
The integer elementwise intrinsics, including ``__builtin_elementwise_popcount``,
651-
``__builtin_elementwise_bitreverse``, can be called in a ``constexpr`` context.
651+
``__builtin_elementwise_bitreverse``, ``__builtin_elementwise_add_sat``,
652+
``__builtin_elementwise_sub_sat`` can be called in a ``constexpr`` context.
652653

653654
============================================== ====================================================================== =========================================
654655
Name Operation Supported element types

clang/docs/RealtimeSanitizer.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ A **partial** list of flags RealtimeSanitizer respects:
196196
- ``""``
197197
- path
198198
- If set to a valid suppressions file, will suppress issue reporting. See details in `Disabling and Suppressing`_.
199-
199+
* - ``verify_interceptors``
200+
- ``true``
201+
- boolean
202+
- If true, verifies interceptors are working at initialization. The program will abort with error ``==ERROR: Interceptors are not working. This may be because RealtimeSanitizer is loaded too late (e.g. via dlopen)`` if an issue is detected.
200203

201204
Some issues with flags can be debugged using the ``verbosity=$NUM`` flag:
202205

0 commit comments

Comments
 (0)