Skip to content

Commit 544bf96

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into gfx1x_fwd_progress
2 parents a9c7b8c + 40b0619 commit 544bf96

File tree

148 files changed

+3102
-1211
lines changed

Some content is hidden

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

148 files changed

+3102
-1211
lines changed

.github/workflows/premerge.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ concurrency:
2525

2626
jobs:
2727
premerge-checks-linux:
28+
name: Linux Premerge Checks (Test Only - Please Ignore Results)
2829
if: >-
2930
github.repository_owner == 'llvm' &&
3031
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -83,6 +84,7 @@ jobs:
8384
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
8485
8586
premerge-checks-windows:
87+
name: Windows Premerge Checks (Test Only - Please Ignore Results)
8688
if: >-
8789
github.repository_owner == 'llvm' &&
8890
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -143,6 +145,7 @@ jobs:
143145
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
144146
145147
premerge-check-macos:
148+
name: MacOS Premerge Checks
146149
runs-on: macos-14
147150
if: >-
148151
github.repository_owner == 'llvm' &&

clang-tools-extra/docs/clang-tidy/checks/bugprone/implicit-widening-of-multiplication-result.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ Options
3737
.. option:: UseCXXStaticCastsInCppSources
3838

3939
When suggesting fix-its for C++ code, should C++-style ``static_cast<>()``'s
40-
be suggested, or C-style casts. Defaults to ``true``.
40+
be suggested, or C-style casts. Defaults to `true`.
4141

4242
.. option:: UseCXXHeadersInCppSources
4343

4444
When suggesting to include the appropriate header in C++ code,
4545
should ``<cstddef>`` header be suggested, or ``<stddef.h>``.
46-
Defaults to ``true``.
46+
Defaults to `true`.
4747

4848
.. option:: IgnoreConstantIntExpr
4949

5050
If the multiplication operands are compile-time constants (like literals or
5151
are ``constexpr``) and fit within the source expression type, do not emit a
5252
diagnostic or suggested fix. Only considers expressions where the source
53-
expression is a signed integer type. Defaults to ``false``.
53+
expression is a signed integer type. Defaults to `false`.
5454

5555
Examples:
5656

clang-tools-extra/docs/clang-tidy/checks/cert/err33-c.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ This check is an alias of check :doc:`bugprone-unused-return-value <../bugprone/
190190
with a fixed set of functions.
191191

192192
Suppressing issues by casting to ``void`` is enabled by default and can be
193-
disabled by setting `AllowCastToVoid` option to ``false``.
193+
disabled by setting `AllowCastToVoid` option to `false`.
194194

195195
The check corresponds to a part of CERT C Coding Standard rule `ERR33-C.
196196
Detect and handle standard library errors

clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ lives.
144144

145145
When set to true convert loops when in C++20 or later mode using
146146
``std::ranges::reverse_view``.
147-
Default value is ``true``.
147+
Default value is `true`.
148148

149149
.. option:: MakeReverseRangeFunction
150150

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4786,17 +4786,20 @@ the configuration (without a prefix: ``Auto``).
47864786

47874787
.. note::
47884788

4789-
You can also specify the language (``Cpp`` or ``ObjC``) for ``.h`` files
4790-
by adding a ``// clang-format Language:`` line before the first
4789+
You can specify the language (``C``, ``Cpp``, or ``ObjC``) for ``.h``
4790+
files by adding a ``// clang-format Language:`` line before the first
47914791
non-comment (and non-empty) line, e.g. ``// clang-format Language: Cpp``.
47924792

47934793
Possible values:
47944794

47954795
* ``LK_None`` (in configuration: ``None``)
47964796
Do not use.
47974797

4798+
* ``LK_C`` (in configuration: ``C``)
4799+
Should be used for C.
4800+
47984801
* ``LK_Cpp`` (in configuration: ``Cpp``)
4799-
Should be used for C, C++.
4802+
Should be used for C++.
48004803

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

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ clang-format
271271
- Adds ``BreakBeforeTemplateCloser`` option.
272272
- Adds ``BinPackLongBracedList`` option to override bin packing options in
273273
long (20 item or more) braced list initializer lists.
274-
- Allow specifying the language (C++ or Objective-C) for a ``.h`` file by adding
275-
a special comment (e.g. ``// clang-format Language: ObjC``) near the top of
276-
the file.
274+
- Add the C language instead of treating it like C++.
275+
- Allow specifying the language (C, C++, or Objective-C) for a ``.h`` file by
276+
adding a special comment (e.g. ``// clang-format Language: ObjC``) near the
277+
top of the file.
277278

278279
libclang
279280
--------

clang/include/clang/Format/Format.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,7 +3318,9 @@ struct FormatStyle {
33183318
enum LanguageKind : int8_t {
33193319
/// Do not use.
33203320
LK_None,
3321-
/// Should be used for C, C++.
3321+
/// Should be used for C.
3322+
LK_C,
3323+
/// Should be used for C++.
33223324
LK_Cpp,
33233325
/// Should be used for C#.
33243326
LK_CSharp,
@@ -3343,7 +3345,9 @@ struct FormatStyle {
33433345
/// https://sci-hub.st/10.1109/IEEESTD.2018.8299595
33443346
LK_Verilog
33453347
};
3346-
bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
3348+
bool isCpp() const {
3349+
return Language == LK_Cpp || Language == LK_C || Language == LK_ObjC;
3350+
}
33473351
bool isCSharp() const { return Language == LK_CSharp; }
33483352
bool isJson() const { return Language == LK_Json; }
33493353
bool isJavaScript() const { return Language == LK_JavaScript; }
@@ -3355,8 +3359,8 @@ struct FormatStyle {
33553359

33563360
/// The language that this format style targets.
33573361
/// \note
3358-
/// You can also specify the language (``Cpp`` or ``ObjC``) for ``.h`` files
3359-
/// by adding a ``// clang-format Language:`` line before the first
3362+
/// You can specify the language (``C``, ``Cpp``, or ``ObjC``) for ``.h``
3363+
/// files by adding a ``// clang-format Language:`` line before the first
33603364
/// non-comment (and non-empty) line, e.g. ``// clang-format Language: Cpp``.
33613365
/// \endnote
33623366
/// \version 3.5
@@ -5715,6 +5719,8 @@ FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
57155719
// Returns a string representation of ``Language``.
57165720
inline StringRef getLanguageName(FormatStyle::LanguageKind Language) {
57175721
switch (Language) {
5722+
case FormatStyle::LK_C:
5723+
return "C";
57185724
case FormatStyle::LK_Cpp:
57195725
return "C++";
57205726
case FormatStyle::LK_CSharp:

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,11 +1015,14 @@ static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) {
10151015
assert(Desc->isRecord() || Desc->isCompositeArray());
10161016

10171017
if (Desc->isCompositeArray()) {
1018+
unsigned N = Desc->getNumElems();
1019+
if (N == 0)
1020+
return true;
10181021
const Descriptor *ElemDesc = Desc->ElemDesc;
10191022
assert(ElemDesc->isRecord());
10201023

10211024
Pointer RP(const_cast<Block *>(B));
1022-
for (unsigned I = 0; I != Desc->getNumElems(); ++I) {
1025+
for (int I = static_cast<int>(N) - 1; I >= 0; --I) {
10231026
if (!runRecordDestructor(S, OpPC, RP.atIndex(I).narrow(), ElemDesc))
10241027
return false;
10251028
}
@@ -1238,8 +1241,10 @@ static bool checkConstructor(InterpState &S, CodePtr OpPC, const Function *Func,
12381241
const Pointer &ThisPtr) {
12391242
assert(Func->isConstructor());
12401243

1241-
const Descriptor *D = ThisPtr.getFieldDesc();
1244+
if (Func->getParentDecl()->isInvalidDecl())
1245+
return false;
12421246

1247+
const Descriptor *D = ThisPtr.getFieldDesc();
12431248
// FIXME: I think this case is not 100% correct. E.g. a pointer into a
12441249
// subobject of a composite array.
12451250
if (!D->ElemRecord)
@@ -1377,6 +1382,18 @@ bool CallVirt(InterpState &S, CodePtr OpPC, const Function *Func,
13771382
size_t ArgSize = Func->getArgSize() + VarArgSize;
13781383
size_t ThisOffset = ArgSize - (Func->hasRVO() ? primSize(PT_Ptr) : 0);
13791384
Pointer &ThisPtr = S.Stk.peek<Pointer>(ThisOffset);
1385+
const FunctionDecl *Callee = Func->getDecl();
1386+
1387+
// C++2a [class.abstract]p6:
1388+
// the effect of making a virtual call to a pure virtual function [...] is
1389+
// undefined
1390+
if (Callee->isPureVirtual()) {
1391+
S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_pure_virtual_call,
1392+
1)
1393+
<< Callee;
1394+
S.Note(Callee->getLocation(), diag::note_declared_at);
1395+
return false;
1396+
}
13801397

13811398
const CXXRecordDecl *DynamicDecl = nullptr;
13821399
{
@@ -1393,7 +1410,7 @@ bool CallVirt(InterpState &S, CodePtr OpPC, const Function *Func,
13931410
assert(DynamicDecl);
13941411

13951412
const auto *StaticDecl = cast<CXXRecordDecl>(Func->getParentDecl());
1396-
const auto *InitialFunction = cast<CXXMethodDecl>(Func->getDecl());
1413+
const auto *InitialFunction = cast<CXXMethodDecl>(Callee);
13971414
const CXXMethodDecl *Overrider = S.getContext().getOverridingFunction(
13981415
DynamicDecl, StaticDecl, InitialFunction);
13991416

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,13 +862,15 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
862862
const llvm::Triple &Triple = ToolChain.getTriple();
863863
const bool IsOSAIX = Triple.isOSAIX();
864864
const bool IsAMDGCN = Triple.isAMDGCN();
865-
const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
865+
StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ);
866+
const char *LinkerPath = Args.MakeArgString(ToolChain.GetLinkerPath());
866867
const Driver &D = ToolChain.getDriver();
867868
const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects,
868869
options::OPT_fno_fat_lto_objects, false);
869870
const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto);
870-
if (llvm::sys::path::filename(Linker) != "ld.lld" &&
871-
llvm::sys::path::stem(Linker) != "ld.lld" && !Triple.isOSOpenBSD()) {
871+
if (Linker != "lld" && Linker != "lld-link" &&
872+
llvm::sys::path::filename(LinkerPath) != "ld.lld" &&
873+
llvm::sys::path::stem(LinkerPath) != "ld.lld" && !Triple.isOSOpenBSD()) {
872874
// Tell the linker to load the plugin. This has to come before
873875
// AddLinkerInputs as gold requires -plugin and AIX ld requires -bplugin to
874876
// come before any -plugin-opt/-bplugin_opt that -Wl might forward.

clang/lib/Driver/ToolChains/Linux.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
343343
}
344344

345345
addPathIfExists(D, concat(SysRoot, "/usr/lib", MultiarchTriple), Paths);
346-
// 64-bit OpenEmbedded sysroots may not have a /usr/lib dir. So they cannot
347-
// find /usr/lib64 as it is referenced as /usr/lib/../lib64. So we handle
348-
// this here.
349-
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
350-
Triple.isArch64Bit())
351-
addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir), Paths);
352-
else
353-
addPathIfExists(D, concat(SysRoot, "/usr/lib/..", OSLibDir), Paths);
346+
addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir), Paths);
354347
if (IsRISCV) {
355348
StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
356349
addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);

0 commit comments

Comments
 (0)