Skip to content

Commit acaea3d

Browse files
committed
Merge remote-tracking branch 'upstream/release/20.x' into rustc/20.1-2025-02-13
2 parents 1c3bb96 + 424c2d9 commit acaea3d

File tree

104 files changed

+2525
-497
lines changed

Some content is hidden

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

104 files changed

+2525
-497
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ jobs:
251251
- name: Install a current LLVM
252252
if: ${{ matrix.mingw != true }}
253253
run: |
254-
choco install -y llvm --version=18.1.6 --allow-downgrade
254+
choco install -y llvm --version=19.1.7 --allow-downgrade
255255
- name: Install llvm-mingw
256256
if: ${{ matrix.mingw == true }}
257257
run: |
258-
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20240606/llvm-mingw-20240606-ucrt-x86_64.zip
258+
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-x86_64.zip
259259
powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
260260
del llvm-mingw*.zip
261261
mv llvm-mingw* c:\llvm-mingw

.github/workflows/release-binaries-all.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
required: true
2828
default: false
2929
type: boolean
30+
secrets:
31+
RELEASE_TASKS_USER_TOKEN:
32+
description: "Secret used to check user permissions."
33+
required: false
3034

3135
pull_request:
3236
types:

.github/workflows/release-binaries.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
# add extra CMake args to disable them.
134134
# See https://github.com/llvm/llvm-project/issues/99767
135135
if [ "$RUNNER_OS" = "macOS" ]; then
136-
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
136+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
137137
if [ "$RUNNER_ARCH" = "ARM64" ]; then
138138
arches=arm64
139139
else
@@ -144,7 +144,7 @@ jobs:
144144
# so we need to disable flang there.
145145
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
146146
fi
147-
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
147+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
148148
fi
149149
150150
build_flang="true"

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Improvements to clangd
5656
Inlay hints
5757
^^^^^^^^^^^
5858

59-
- Added `DefaultArguments` Inlay Hints option.
59+
- Added support for inlay hints for default arguments, enabled using the
60+
`DefaultArguments` config option (#GH95712)
6061

6162
Diagnostics
6263
^^^^^^^^^^^
@@ -67,35 +68,81 @@ Semantic Highlighting
6768
Compile flags
6869
^^^^^^^^^^^^^
6970

71+
- Fixed a bug where clangd would unnecessarily reparse open files whose
72+
compile command did not change when receiving a new compile command
73+
via an LSP `workspace/configuration` request (#GH115438)
74+
7075
Hover
7176
^^^^^
7277

78+
- Hovering over a function name now shows the function's documentation
79+
comment even if the comment is written above the function's out-of-line
80+
definition in a different source file (#GH67802)
81+
7382
Code completion
7483
^^^^^^^^^^^^^^^
7584

85+
- Added an `ArgumentLists` config option under `Completion`. This is a more
86+
flexible version of the `--function-arg-placeholders` command line flag,
87+
allowing users more detailed control of what is inserted in argument list
88+
position when clangd completes the name of a function in a function call
89+
context. (#GH111322)
90+
- Clangd now supports configuring which headers should be inserted using
91+
`<>` vs. `""` syntax using the `QuotedHeaders` and `AngledHeaders` config
92+
options under `Style` (#GH67749)
7693
- Added completion for C++20 keywords.
94+
- Improved code completion behaviour in dependent/templated code
95+
- Completion items now include documentation comments in more cases (#GH120099)
7796

7897
Code actions
7998
^^^^^^^^^^^^
8099

81100
- Added `Swap operands` tweak for certain binary operators.
82-
83101
- Improved the extract-to-function code action to allow extracting statements
84102
with overloaded operators like ``<<`` of ``std::ostream``.
103+
- `Define outline` now handles member functions of class templates, and
104+
member function templates.
105+
- `Extract variable` can now operate on the top-level expression in an
106+
expression statement (#GH112525)
85107

86108
Signature help
87109
^^^^^^^^^^^^^^
88110

89111
Cross-references
90112
^^^^^^^^^^^^^^^^
91113

114+
- Clangd now supports the "outgoing calls" direction of call hierarchy
115+
(#GH77556)
116+
- Call hierarchy can now be invoked on fields and namespace-scope
117+
variables (#GH113900)
118+
- Improved heuristics for filtering out generated Protobuf symbol names
119+
during indexing (#GH110091)
120+
- Compiler intrinsics defined in `*intrin.h` system headers are now
121+
indexed even if they have reserved names (#GH119735)
122+
- Various improvements to go-to-definition in templated code
123+
92124
Objective-C
93125
^^^^^^^^^^^
94126

127+
Clang-tidy integration
128+
^^^^^^^^^^^^^^^^^^^^^^
129+
130+
- Improved robustness in handling clang-tidy check names (#GH109421)
131+
132+
C++20 Modules Support
133+
^^^^^^^^^^^^^^^^^^^^^
134+
135+
- Support code completion for symbols defined in modules (#GH110083)
136+
- Improve performance when opening files that import modules (#GH106683)
137+
- Compile commands for modules now respect modifications specified in `.clangd`
138+
files (#GH122606)
139+
95140
Miscellaneous
96141
^^^^^^^^^^^^^
97142

98-
- The DefineOutline tweak now handles member functions of class templates.
143+
- Fixed an OOM affecting some versions of libcxx headers compiled in C++20
144+
mode (#GH108866)
145+
- Various other stability improvements, e.g. crash fixes
99146

100147
Improvements to clang-doc
101148
-------------------------

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4735,15 +4735,24 @@ the configuration (without a prefix: ``Auto``).
47354735
.. _Language:
47364736

47374737
**Language** (``LanguageKind``) :versionbadge:`clang-format 3.5` :ref:`<Language>`
4738-
Language, this format style is targeted at.
4738+
The language that this format style targets.
4739+
4740+
.. note::
4741+
4742+
You can specify the language (``C``, ``Cpp``, or ``ObjC``) for ``.h``
4743+
files by adding a ``// clang-format Language:`` line before the first
4744+
non-comment (and non-empty) line, e.g. ``// clang-format Language: Cpp``.
47394745

47404746
Possible values:
47414747

47424748
* ``LK_None`` (in configuration: ``None``)
47434749
Do not use.
47444750

4751+
* ``LK_C`` (in configuration: ``C``)
4752+
Should be used for C.
4753+
47454754
* ``LK_Cpp`` (in configuration: ``Cpp``)
4746-
Should be used for C, C++.
4755+
Should be used for C++.
47474756

47484757
* ``LK_CSharp`` (in configuration: ``CSharp``)
47494758
Should be used for C#.

clang/docs/HIPSupport.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,26 @@ Example Usage
286286
basePtr->virtualFunction(); // Allowed since obj is constructed in device code
287287
}
288288

289+
Host and Device Attributes of Default Destructors
290+
===================================================
291+
292+
If a default destructor does not have explicit host or device attributes,
293+
clang infers these attributes based on the destructors of its data members
294+
and base classes. If any conflicts are detected among these destructors,
295+
clang diagnoses the issue. Otherwise, clang adds an implicit host or device
296+
attribute according to whether the data members's and base classes's
297+
destructors can execute on the host or device side.
298+
299+
For explicit template classes with virtual destructors, which must be emitted,
300+
the inference adopts a conservative approach. In this case, implicit host or
301+
device attributes from member and base class destructors are ignored. This
302+
precaution is necessary because, although a constexpr destructor carries
303+
implicit host or device attributes, a constexpr function may call a
304+
non-constexpr function, which is by default a host function.
305+
306+
Users can override the inferred host and device attributes of default
307+
destructors by adding explicit host and device attributes to them.
308+
289309
C++ Standard Parallelism Offload Support: Compiler And Runtime
290310
==============================================================
291311

clang/docs/ReleaseNotes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,8 @@ Bug Fixes to C++ Support
10581058
- Fixed a substitution bug in transforming CTAD aliases when the type alias contains a non-pack template argument
10591059
corresponding to a pack parameter (#GH124715)
10601060
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
1061+
- Fixed an integer overflow bug in computing template parameter depths when synthesizing CTAD guides. (#GH128691)
1062+
- Fixed an incorrect pointer access when checking access-control on concepts. (#GH131530)
10611063

10621064
Bug Fixes to AST Handling
10631065
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1298,6 +1300,11 @@ AVR Support
12981300

12991301
- Reject C/C++ compilation for avr1 devices which have no SRAM.
13001302

1303+
BPF Support
1304+
^^^^^^^^^^^
1305+
1306+
- Make ``-mcpu=v3`` as the default.
1307+
13011308
DWARF Support in Clang
13021309
----------------------
13031310

@@ -1358,6 +1365,10 @@ clang-format
13581365
- Adds ``WrapNamespaceBodyWithEmptyLines`` option.
13591366
- Adds the ``IndentExportBlock`` option.
13601367
- Adds ``PenaltyBreakBeforeMemberAccess`` option.
1368+
- Add the C language instead of treating it like C++.
1369+
- Allow specifying the language (C, C++, or Objective-C) for a ``.h`` file by
1370+
adding a special comment (e.g. ``// clang-format Language: ObjC``) near the
1371+
top of the file.
13611372

13621373
libclang
13631374
--------

clang/include/clang/Format/Format.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,7 +3275,9 @@ struct FormatStyle {
32753275
enum LanguageKind : int8_t {
32763276
/// Do not use.
32773277
LK_None,
3278-
/// Should be used for C, C++.
3278+
/// Should be used for C.
3279+
LK_C,
3280+
/// Should be used for C++.
32793281
LK_Cpp,
32803282
/// Should be used for C#.
32813283
LK_CSharp,
@@ -3300,7 +3302,9 @@ struct FormatStyle {
33003302
/// https://sci-hub.st/10.1109/IEEESTD.2018.8299595
33013303
LK_Verilog
33023304
};
3303-
bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
3305+
bool isCpp() const {
3306+
return Language == LK_Cpp || Language == LK_C || Language == LK_ObjC;
3307+
}
33043308
bool isCSharp() const { return Language == LK_CSharp; }
33053309
bool isJson() const { return Language == LK_Json; }
33063310
bool isJavaScript() const { return Language == LK_JavaScript; }
@@ -3310,7 +3314,12 @@ struct FormatStyle {
33103314
}
33113315
bool isTableGen() const { return Language == LK_TableGen; }
33123316

3313-
/// Language, this format style is targeted at.
3317+
/// The language that this format style targets.
3318+
/// \note
3319+
/// You can specify the language (``C``, ``Cpp``, or ``ObjC``) for ``.h``
3320+
/// files by adding a ``// clang-format Language:`` line before the first
3321+
/// non-comment (and non-empty) line, e.g. ``// clang-format Language: Cpp``.
3322+
/// \endnote
33143323
/// \version 3.5
33153324
LanguageKind Language;
33163325

@@ -5665,6 +5674,8 @@ FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
56655674
// Returns a string representation of ``Language``.
56665675
inline StringRef getLanguageName(FormatStyle::LanguageKind Language) {
56675676
switch (Language) {
5677+
case FormatStyle::LK_C:
5678+
return "C";
56685679
case FormatStyle::LK_Cpp:
56695680
return "C++";
56705681
case FormatStyle::LK_CSharp:

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4336,11 +4336,11 @@ class Sema final : public SemaBase {
43364336
// Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
43374337
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee);
43384338

4339-
private:
43404339
/// Function or variable declarations to be checked for whether the deferred
43414340
/// diagnostics should be emitted.
43424341
llvm::SmallSetVector<Decl *, 4> DeclsToCheckForDeferredDiags;
43434342

4343+
private:
43444344
/// Map of current shadowing declarations to shadowed declarations. Warn if
43454345
/// it looks like the user is trying to modify the shadowing declaration.
43464346
llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
@@ -10671,9 +10671,8 @@ class Sema final : public SemaBase {
1067110671
SourceLocation EndLoc);
1067210672
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
1067310673

10674-
/// DiagnoseDiscardedExprMarkedNodiscard - Given an expression that is
10675-
/// semantically a discarded-value expression, diagnose if any [[nodiscard]]
10676-
/// value has been discarded.
10674+
10675+
// Unused, kept in Clang 20 for ABI stability.
1067710676
void DiagnoseDiscardedExprMarkedNodiscard(const Expr *E);
1067810677

1067910678
/// DiagnoseUnusedExprResult - If the statement passed in is an expression

clang/lib/AST/ExprConstant.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,16 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
24192419
LVal.getLValueCallIndex() == 0) &&
24202420
"have call index for global lvalue");
24212421

2422+
if (LVal.allowConstexprUnknown()) {
2423+
if (BaseVD) {
2424+
Info.FFDiag(Loc, diag::note_constexpr_var_init_non_constant, 1) << BaseVD;
2425+
NoteLValueLocation(Info, Base);
2426+
} else {
2427+
Info.FFDiag(Loc);
2428+
}
2429+
return false;
2430+
}
2431+
24222432
if (Base.is<DynamicAllocLValue>()) {
24232433
Info.FFDiag(Loc, diag::note_constexpr_dynamic_alloc)
24242434
<< IsReferenceType << !Designator.Entries.empty();
@@ -3597,7 +3607,8 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
35973607
// expressions here; doing so would regress diagnostics for things like
35983608
// reading from a volatile constexpr variable.
35993609
if ((Info.getLangOpts().CPlusPlus && !VD->hasConstantInitialization() &&
3600-
VD->mightBeUsableInConstantExpressions(Info.Ctx)) ||
3610+
VD->mightBeUsableInConstantExpressions(Info.Ctx) &&
3611+
!AllowConstexprUnknown) ||
36013612
((Info.getLangOpts().CPlusPlus || Info.getLangOpts().OpenCL) &&
36023613
!Info.getLangOpts().CPlusPlus11 && !VD->hasICEInitializer(Info.Ctx))) {
36033614
if (Init) {
@@ -3628,8 +3639,6 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
36283639
if (AllowConstexprUnknown) {
36293640
if (!Result)
36303641
Result = &Info.CurrentCall->createConstexprUnknownAPValues(VD, Base);
3631-
else
3632-
Result->setConstexprUnknown();
36333642
}
36343643
return true;
36353644
}

0 commit comments

Comments
 (0)