Skip to content

Commit 3f6c0b2

Browse files
authored
Merge branch 'llvm:main' into exclude-libc-provided-aeabi-builtins
2 parents 72ce8a9 + 6c4dd8d commit 3f6c0b2

File tree

878 files changed

+16718
-6140
lines changed

Some content is hidden

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

878 files changed

+16718
-6140
lines changed

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,23 @@ jobs:
1919
include:
2020
- os: ubuntu-24.04
2121
ccache-variant: sccache
22-
c_compiler: clang-20
23-
cpp_compiler: clang++-20
22+
c_compiler: clang-21
23+
cpp_compiler: clang++-21
24+
target: x86_64-unknown-linux-llvm
25+
include_scudo: ON
2426
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
2527
- os: ubuntu-24.04-arm
2628
ccache-variant: ccache
27-
c_compiler: clang-20
28-
cpp_compiler: clang++-20
29+
c_compiler: clang-21
30+
cpp_compiler: clang++-21
31+
target: aarch64-unknown-linux-llvm
32+
include_scudo: ON
33+
- os: ubuntu-24.04
34+
ccache-variant: ccache
35+
c_compiler: clang-21
36+
cpp_compiler: clang++-21
37+
target: x86_64-unknown-uefi-llvm
38+
include_scudo: OFF
2939
# TODO: add back gcc build when it is fixed
3040
# - c_compiler: gcc
3141
# cpp_compiler: g++
@@ -53,7 +63,7 @@ jobs:
5363
run: |
5464
wget https://apt.llvm.org/llvm.sh
5565
chmod +x llvm.sh
56-
sudo ./llvm.sh 20
66+
sudo ./llvm.sh 21
5767
sudo apt-get update
5868
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
5969
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm
@@ -68,22 +78,31 @@ jobs:
6878
# Configure libc fullbuild with scudo.
6979
# Use MinSizeRel to reduce the size of the build.
7080
- name: Configure CMake
71-
run: >
72-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
73-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
74-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
75-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
76-
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
77-
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
78-
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}
79-
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt"
80-
-DLLVM_LIBC_FULL_BUILD=ON
81-
-DLLVM_LIBC_INCLUDE_SCUDO=ON
82-
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON
83-
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
84-
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF
85-
-G Ninja
86-
-S ${{ github.workspace }}/runtimes
81+
run: |
82+
export RUNTIMES="libc"
83+
84+
if [[ ${{ matrix.include_scudo}} == "ON" ]]; then
85+
export RUNTIMES="$RUNTIMES;compiler-rt"
86+
export CMAKE_FLAGS="
87+
-DLLVM_LIBC_INCLUDE_SCUDO=ON
88+
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON
89+
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
90+
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF"
91+
fi
92+
93+
cmake -B ${{ steps.strings.outputs.build-output-dir }} \
94+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
95+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
96+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
97+
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
98+
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
99+
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} \
100+
-DLLVM_RUNTIMES_TARGET=${{ matrix.target }} \
101+
-DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \
102+
-DLLVM_LIBC_FULL_BUILD=ON \
103+
-G Ninja \
104+
-S ${{ github.workspace }}/runtimes \
105+
$CMAKE_FLAGS
87106
88107
- name: Build
89108
run: >
@@ -93,6 +112,8 @@ jobs:
93112
--target install
94113
95114
- name: Test
115+
# Skip UEFI tests until we have testing set up.
116+
if: ${{ ! endsWith(matrix.target, '-uefi-llvm') }}
96117
run: >
97118
cmake
98119
--build ${{ steps.strings.outputs.build-output-dir }}

bolt/docs/BinaryAnalysis.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,6 @@ The following are current known cases of false negatives:
180180
[prototype branch](
181181
https://github.com/llvm/llvm-project/compare/main...kbeyls:llvm-project:bolt-gadget-scanner-prototype).
182182

183-
BOLT cannot currently handle functions with `cfi_negate_ra_state` correctly,
184-
i.e. any binaries built with `-mbranch-protection=pac-ret`. The scanner is meant
185-
to be used on specifically such binaries, so this is a major limitation! Work is
186-
going on in PR [#120064](https://github.com/llvm/llvm-project/pull/120064) to
187-
fix this.
188-
189183
## How to add your own binary analysis
190184

191185
_TODO: this section needs to be written. Ideally, we should have a simple

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ extern cl::opt<bool> StrictMode;
6565
extern cl::opt<bool> UpdateDebugSections;
6666
extern cl::opt<unsigned> Verbosity;
6767

68+
extern bool BinaryAnalysisMode;
69+
extern bool HeatmapMode;
6870
extern bool processAllFunctions();
6971

7072
static cl::opt<bool> CheckEncoding(
@@ -2760,13 +2762,19 @@ struct CFISnapshot {
27602762
}
27612763
case MCCFIInstruction::OpAdjustCfaOffset:
27622764
case MCCFIInstruction::OpWindowSave:
2763-
case MCCFIInstruction::OpNegateRAState:
27642765
case MCCFIInstruction::OpNegateRAStateWithPC:
27652766
case MCCFIInstruction::OpLLVMDefAspaceCfa:
27662767
case MCCFIInstruction::OpLabel:
27672768
case MCCFIInstruction::OpValOffset:
27682769
llvm_unreachable("unsupported CFI opcode");
27692770
break;
2771+
case MCCFIInstruction::OpNegateRAState:
2772+
if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
2773+
llvm_unreachable("BOLT-ERROR: binaries using pac-ret hardening (e.g. "
2774+
"as produced by '-mbranch-protection=pac-ret') are "
2775+
"currently not supported by BOLT.");
2776+
}
2777+
break;
27702778
case MCCFIInstruction::OpRememberState:
27712779
case MCCFIInstruction::OpRestoreState:
27722780
case MCCFIInstruction::OpGnuArgsSize:
@@ -2900,13 +2908,19 @@ struct CFISnapshotDiff : public CFISnapshot {
29002908
return CFAReg == Instr.getRegister() && CFAOffset == Instr.getOffset();
29012909
case MCCFIInstruction::OpAdjustCfaOffset:
29022910
case MCCFIInstruction::OpWindowSave:
2903-
case MCCFIInstruction::OpNegateRAState:
29042911
case MCCFIInstruction::OpNegateRAStateWithPC:
29052912
case MCCFIInstruction::OpLLVMDefAspaceCfa:
29062913
case MCCFIInstruction::OpLabel:
29072914
case MCCFIInstruction::OpValOffset:
29082915
llvm_unreachable("unsupported CFI opcode");
29092916
return false;
2917+
case MCCFIInstruction::OpNegateRAState:
2918+
if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
2919+
llvm_unreachable("BOLT-ERROR: binaries using pac-ret hardening (e.g. "
2920+
"as produced by '-mbranch-protection=pac-ret') are "
2921+
"currently not supported by BOLT.");
2922+
}
2923+
break;
29102924
case MCCFIInstruction::OpRememberState:
29112925
case MCCFIInstruction::OpRestoreState:
29122926
case MCCFIInstruction::OpGnuArgsSize:
@@ -3051,13 +3065,19 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
30513065
break;
30523066
case MCCFIInstruction::OpAdjustCfaOffset:
30533067
case MCCFIInstruction::OpWindowSave:
3054-
case MCCFIInstruction::OpNegateRAState:
30553068
case MCCFIInstruction::OpNegateRAStateWithPC:
30563069
case MCCFIInstruction::OpLLVMDefAspaceCfa:
30573070
case MCCFIInstruction::OpLabel:
30583071
case MCCFIInstruction::OpValOffset:
30593072
llvm_unreachable("unsupported CFI opcode");
30603073
break;
3074+
case MCCFIInstruction::OpNegateRAState:
3075+
if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
3076+
llvm_unreachable("BOLT-ERROR: binaries using pac-ret hardening (e.g. "
3077+
"as produced by '-mbranch-protection=pac-ret') are "
3078+
"currently not supported by BOLT.");
3079+
}
3080+
break;
30613081
case MCCFIInstruction::OpGnuArgsSize:
30623082
// do not affect CFI state
30633083
break;

clang-tools-extra/clangd/index/YAMLSerialization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ template <> struct MappingTraits<Ref> {
319319
MappingNormalization<NormalizedRefKind, RefKind> NKind(IO, R.Kind);
320320
IO.mapRequired("Kind", NKind->Kind);
321321
IO.mapRequired("Location", R.Location);
322+
IO.mapOptional("Container", R.Container);
322323
}
323324
};
324325

clang-tools-extra/clangd/index/remote/Index.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ message Symbol {
8181
message Ref {
8282
optional SymbolLocation location = 1;
8383
optional uint32 kind = 2;
84+
optional string container = 3;
8485
}
8586

8687
message SymbolInfo {

clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ llvm::Expected<clangd::Ref> Marshaller::fromProtobuf(const Ref &Message) {
203203
return Location.takeError();
204204
Result.Location = *Location;
205205
Result.Kind = static_cast<RefKind>(Message.kind());
206+
auto ContainerID = SymbolID::fromStr(Message.container());
207+
if (ContainerID)
208+
Result.Container = *ContainerID;
206209
return Result;
207210
}
208211

@@ -340,6 +343,7 @@ llvm::Expected<Ref> Marshaller::toProtobuf(const clangd::Ref &From) {
340343
if (!Location)
341344
return Location.takeError();
342345
*Result.mutable_location() = *Location;
346+
Result.set_container(From.Container.str());
343347
return Result;
344348
}
345349

clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ TEST(RemoteMarshallingTest, RefSerialization) {
223223
Location.FileURI = testPathURI(
224224
"llvm-project/llvm/clang-tools-extra/clangd/Protocol.h", Strings);
225225
Ref.Location = Location;
226+
Ref.Container = llvm::cantFail(SymbolID::fromStr("0000000000000001"));
226227

227228
Marshaller ProtobufMarshaller(testPath("llvm-project/"),
228229
testPath("llvm-project/"));

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5195,6 +5195,29 @@ the configuration (without a prefix: ``Auto``).
51955195
Add a space in front of an Objective-C protocol list, i.e. use
51965196
``Foo <Protocol>`` instead of ``Foo<Protocol>``.
51975197

5198+
.. _OneLineFormatOffRegex:
5199+
5200+
**OneLineFormatOffRegex** (``String``) :versionbadge:`clang-format 21` :ref:`<OneLineFormatOffRegex>`
5201+
A regular expression that describes markers for turning formatting off for
5202+
one line. If it matches a comment that is the only token of a line,
5203+
clang-format skips the comment and the next line. Otherwise, clang-format
5204+
skips lines containing a matched token.
5205+
5206+
.. code-block:: c++
5207+
5208+
// OneLineFormatOffRegex: ^(// NOLINT|logger$)
5209+
// results in the output below:
5210+
int a;
5211+
int b ; // NOLINT
5212+
int c;
5213+
// NOLINTNEXTLINE
5214+
int d ;
5215+
int e;
5216+
s = "// NOLINT";
5217+
logger() ;
5218+
logger2();
5219+
my_logger();
5220+
51985221
.. _PPIndentWidth:
51995222

52005223
**PPIndentWidth** (``Integer``) :versionbadge:`clang-format 13` :ref:`<PPIndentWidth>`

clang/docs/ReleaseNotes.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ C Language Changes
171171
``-Wenum-conversion`` and ``-Wimplicit-int-enum-cast``. This conversion is an
172172
int-to-enum conversion because the enumeration on the right-hand side is
173173
promoted to ``int`` before the assignment.
174+
- Added ``-Wunterminated-string-initialization``, grouped under ``-Wextra``,
175+
which diagnoses an initialization from a string literal where only the null
176+
terminator cannot be stored. e.g.,
177+
178+
.. code-block:: c
179+
180+
181+
char buf1[3] = "foo"; // -Wunterminated-string-initialization
182+
char buf2[3] = "flarp"; // -Wexcess-initializers
183+
184+
This diagnostic can be suppressed by adding the new ``nonstring`` attribute
185+
to the field or variable being initialized. #GH137705
186+
- Added ``-Wc++-unterminated-string-initialization``, grouped under
187+
``-Wc++-compat``, which also diagnoses the same cases as
188+
``-Wunterminated-string-initialization``. However, this diagnostic is not
189+
silenced by the ``nonstring`` attribute as these initializations are always
190+
incompatible with C++.
174191

175192
C2y Feature Support
176193
^^^^^^^^^^^^^^^^^^^
@@ -234,6 +251,10 @@ Non-comprehensive list of changes in this release
234251
- Added `__builtin_elementwise_minnum` and `__builtin_elementwise_maxnum`.
235252
- No longer crashing on invalid Objective-C categories and extensions when
236253
dumping the AST as JSON. (#GH137320)
254+
- Clang itself now uses split stacks instead of threads for allocating more
255+
stack space when running on Apple AArch64 based platforms. This means that
256+
stack traces of Clang from debuggers, crashes, and profilers may look
257+
different than before.
237258

238259
New Compiler Flags
239260
------------------
@@ -244,6 +265,8 @@ New Compiler Flags
244265
The feature has `existed <https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program>`_)
245266
for a while and this is just a user facing option.
246267

268+
- New option ``-ftime-report-json`` added which outputs the same timing data as `-ftime-report` but formatted as JSON.
269+
247270
Deprecated Compiler Flags
248271
-------------------------
249272

@@ -494,6 +517,9 @@ Bug Fixes in This Version
494517
evaluation. The crashes were happening during diagnostics emission due to
495518
unimplemented statement printer. (#GH132641)
496519
- Fixed visibility calculation for template functions. (#GH103477)
520+
- Fixed a bug where an attribute before a ``pragma clang attribute`` or
521+
``pragma clang __debug`` would cause an assertion. Instead, this now diagnoses
522+
the invalid attribute location appropriately. (#GH137861)
497523

498524
Bug Fixes to Compiler Builtins
499525
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -720,6 +746,7 @@ clang-format
720746
top of the file.
721747
- Add ``EnumTrailingComma`` option for inserting/removing commas at the end of
722748
``enum`` enumerator lists.
749+
- Add ``OneLineFormatOffRegex`` option for turning formatting off for one line.
723750

724751
libclang
725752
--------

clang/include/clang/AST/Mangle.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ struct ThisAdjustment;
4040
struct ThunkInfo;
4141
class VarDecl;
4242

43+
/// Extract mangling function name from MangleContext such that swift can call
44+
/// it to prepare for ObjCDirect in swift.
45+
void mangleObjCMethodName(raw_ostream &OS, bool includePrefixByte,
46+
bool isInstanceMethod, StringRef ClassName,
47+
std::optional<StringRef> CategoryName,
48+
StringRef MethodName);
49+
4350
/// MangleContext - Context for tracking state which persists across multiple
4451
/// calls to the C++ name mangler.
4552
class MangleContext {

0 commit comments

Comments
 (0)