Skip to content

Commit a0a7aa4

Browse files
authored
Merge branch 'main' into fix/125810
2 parents 83899ec + a1a1073 commit a0a7aa4

File tree

1,289 files changed

+38288
-14024
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,289 files changed

+38288
-14024
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ clang:static analyzer:
499499
- clang/tools/scan-build/**
500500
- clang/utils/analyzer/**
501501
- clang/docs/analyzer/**
502+
- clang/test/Analysis/**
502503

503504
pgo:
504505
- llvm/lib/Transforms/Instrumentation/CGProfile.cpp

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
3939
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
40+
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
4141
continue-on-error: false
4242
strategy:
4343
fail-fast: false
@@ -48,8 +48,8 @@ jobs:
4848
'generic-cxx26',
4949
'generic-modules'
5050
]
51-
cc: [ 'clang-20' ]
52-
cxx: [ 'clang++-20' ]
51+
cc: [ 'clang-21' ]
52+
cxx: [ 'clang++-21' ]
5353
include:
5454
- config: 'generic-gcc'
5555
cc: 'gcc-14'
@@ -75,7 +75,7 @@ jobs:
7575
stage2:
7676
if: github.repository_owner == 'llvm'
7777
runs-on: libcxx-self-hosted-linux
78-
container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
78+
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
7979
needs: [ stage1 ]
8080
continue-on-error: false
8181
strategy:
@@ -88,18 +88,22 @@ jobs:
8888
'generic-cxx20',
8989
'generic-cxx23'
9090
]
91-
cc: [ 'clang-20' ]
92-
cxx: [ 'clang++-20' ]
91+
cc: [ 'clang-21' ]
92+
cxx: [ 'clang++-21' ]
9393
include:
9494
- config: 'generic-gcc-cxx11'
9595
cc: 'gcc-14'
9696
cxx: 'g++-14'
97-
- config: 'generic-cxx23'
98-
cc: 'clang-18'
99-
cxx: 'clang++-18'
97+
- config: 'generic-cxx26'
98+
cc: 'clang-20'
99+
cxx: 'clang++-20'
100100
- config: 'generic-cxx26'
101101
cc: 'clang-19'
102102
cxx: 'clang++-19'
103+
# Release transition
104+
- config: 'generic-cxx23'
105+
cc: 'clang-18'
106+
cxx: 'clang++-18'
103107
steps:
104108
- uses: actions/checkout@v4
105109
- name: ${{ matrix.config }}
@@ -163,14 +167,14 @@ jobs:
163167
- config: 'generic-msan'
164168
machine: libcxx-self-hosted-linux
165169
runs-on: ${{ matrix.machine }}
166-
container: ghcr.io/llvm/libcxx-linux-builder:d8a0709b1090350a7fe3604d8ab78c7d62f10698
170+
container: ghcr.io/llvm/libcxx-linux-builder:b319dfef21f6c7b0bc6a356d6b9f41a3b3b98ae9
167171
steps:
168172
- uses: actions/checkout@v4
169173
- name: ${{ matrix.config }}
170174
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
171175
env:
172-
CC: clang-20
173-
CXX: clang++-20
176+
CC: clang-21
177+
CXX: clang++-21
174178
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
175179
if: always()
176180
with:

.github/workflows/premerge.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ on:
1414
# do this is that it allows us to take advantage of concurrency groups
1515
# to cancel in progress CI jobs whenever the PR is closed.
1616
- closed
17-
paths:
18-
- .github/workflows/premerge.yaml
1917
push:
2018
branches:
2119
- 'main'

.github/workflows/release-binaries.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ jobs:
138138
arches=arm64
139139
else
140140
arches=x86_64
141+
# Disable Flang builds on macOS x86_64. The FortranLower library takes
142+
# 2-3 hours to build on macOS, much slower than on Linux.
143+
# The long build time causes the release build to time out on x86_64,
144+
# so we need to disable flang there.
145+
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;bolt;polly;mlir'"
141146
fi
142147
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
143148
fi

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,11 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
498498
if (!IslandOffset)
499499
return;
500500

501+
// Print label if it exists at this offset.
502+
if (const BinaryData *BD =
503+
BC.getBinaryDataAtAddress(getAddress() + *IslandOffset))
504+
OS << BD->getName() << ":\n";
505+
501506
const size_t IslandSize = getSizeOfDataInCodeAt(*IslandOffset);
502507
BC.printData(OS, BC.extractData(getAddress() + *IslandOffset, IslandSize),
503508
*IslandOffset);
@@ -1066,7 +1071,7 @@ size_t BinaryFunction::getSizeOfDataInCodeAt(uint64_t Offset) const {
10661071
auto Iter = Islands->CodeOffsets.upper_bound(Offset);
10671072
if (Iter != Islands->CodeOffsets.end())
10681073
return *Iter - Offset;
1069-
return getSize() - Offset;
1074+
return getMaxSize() - Offset;
10701075
}
10711076

10721077
std::optional<uint64_t>

bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void InstrumentationRuntimeLibrary::link(
219219
}
220220
outs() << "BOLT-INFO: output linked against instrumentation runtime "
221221
"library, lib entry point is 0x"
222-
<< Twine::utohexstr(RuntimeFiniAddress) << "\n";
222+
<< Twine::utohexstr(RuntimeStartAddress) << "\n";
223223
outs() << "BOLT-INFO: clear procedure is 0x"
224224
<< Twine::utohexstr(
225225
Linker.lookupSymbol("__bolt_instr_clear_counters").value_or(0))

bolt/test/AArch64/data-in-code.s

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
## Check disassembly of BOLT input.
88
# RUN: llvm-objdump %t.exe -d | FileCheck %s
99

10-
# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm | FileCheck %s
10+
# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm \
11+
# RUN: | FileCheck %s --check-prefixes CHECK,CHECK-BOLT-ONLY
1112

1213
.text
1314
.balign 4
@@ -16,16 +17,21 @@
1617
.type _start, %function
1718
_start:
1819
mov x0, #0x0
20+
ldr x1, .L1
1921
.word 0x4f82e010
2022
ret
23+
.size _start, .-_start
24+
.L1:
2125
.byte 0x0, 0xff, 0x42
2226
# CHECK-LABEL: _start
2327
# CHECK: mov x0, #0x0
28+
# CHECK-NEXT: ldr x1
29+
# CHECK-BOLT-ONLY-SAME: ISLANDat[[ADDR:]]
2430
# CHECK-NEXT: .word 0x4f82e010
2531
# CHECK-NEXT: ret
32+
# CHECK-BOLT-ONLY-NEXT: ISLANDat[[ADDR]]
2633
# CHECK-NEXT: .short 0xff00
2734
# CHECK-NEXT: .byte 0x42
28-
.size _start, .-_start
2935

3036
## Force relocation mode.
3137
.reloc 0, R_AARCH64_NONE

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include "ConstCorrectnessCheck.h"
1010
#include "../utils/FixItHintUtils.h"
11+
#include "../utils/Matchers.h"
12+
#include "../utils/OptionsUtils.h"
1113
#include "clang/AST/ASTContext.h"
1214
#include "clang/ASTMatchers/ASTMatchFinder.h"
1315
#include "clang/ASTMatchers/ASTMatchers.h"
@@ -41,7 +43,9 @@ ConstCorrectnessCheck::ConstCorrectnessCheck(StringRef Name,
4143
TransformValues(Options.get("TransformValues", true)),
4244
TransformReferences(Options.get("TransformReferences", true)),
4345
TransformPointersAsValues(
44-
Options.get("TransformPointersAsValues", false)) {
46+
Options.get("TransformPointersAsValues", false)),
47+
AllowedTypes(
48+
utils::options::parseStringList(Options.get("AllowedTypes", ""))) {
4549
if (AnalyzeValues == false && AnalyzeReferences == false)
4650
this->configurationDiag(
4751
"The check 'misc-const-correctness' will not "
@@ -57,6 +61,8 @@ void ConstCorrectnessCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
5761
Options.store(Opts, "TransformValues", TransformValues);
5862
Options.store(Opts, "TransformReferences", TransformReferences);
5963
Options.store(Opts, "TransformPointersAsValues", TransformPointersAsValues);
64+
Options.store(Opts, "AllowedTypes",
65+
utils::options::serializeStringList(AllowedTypes));
6066
}
6167

6268
void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
@@ -73,6 +79,12 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
7379
hasType(referenceType(pointee(hasCanonicalType(templateTypeParmType())))),
7480
hasType(referenceType(pointee(substTemplateTypeParmType()))));
7581

82+
const auto AllowedType = hasType(qualType(anyOf(
83+
hasDeclaration(namedDecl(matchers::matchesAnyListedName(AllowedTypes))),
84+
references(namedDecl(matchers::matchesAnyListedName(AllowedTypes))),
85+
pointerType(pointee(hasDeclaration(
86+
namedDecl(matchers::matchesAnyListedName(AllowedTypes))))))));
87+
7688
const auto AutoTemplateType = varDecl(
7789
anyOf(hasType(autoType()), hasType(referenceType(pointee(autoType()))),
7890
hasType(pointerType(pointee(autoType())))));
@@ -87,7 +99,8 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
8799
unless(anyOf(ConstType, ConstReference, TemplateType,
88100
hasInitializer(isInstantiationDependent()), AutoTemplateType,
89101
RValueReference, FunctionPointerRef,
90-
hasType(cxxRecordDecl(isLambda())), isImplicit())));
102+
hasType(cxxRecordDecl(isLambda())), isImplicit(),
103+
AllowedType)));
91104

92105
// Match the function scope for which the analysis of all local variables
93106
// shall be run.

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ConstCorrectnessCheck : public ClangTidyCheck {
4545
const bool TransformValues;
4646
const bool TransformReferences;
4747
const bool TransformPointersAsValues;
48+
const std::vector<StringRef> AllowedTypes;
4849
};
4950

5051
} // namespace clang::tidy::misc

clang-tools-extra/clangd/CollectMacros.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
namespace clang {
1919
namespace clangd {
2020

21-
Range MacroOccurrence::toRange(const SourceManager &SM) const {
21+
CharSourceRange MacroOccurrence::toSourceRange(const SourceManager &SM) const {
2222
auto MainFile = SM.getMainFileID();
23-
return halfOpenToRange(
24-
SM, syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM));
23+
return syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM);
24+
}
25+
26+
Range MacroOccurrence::toRange(const SourceManager &SM) const {
27+
return halfOpenToRange(SM, toSourceRange(SM));
2528
}
2629

2730
void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,

0 commit comments

Comments
 (0)