Skip to content

Commit e17e7b1

Browse files
committed
Merge from 'main' to 'sycl-web' (117 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CGDebugInfo.cpp
2 parents a8ce719 + 831484e commit e17e7b1

File tree

455 files changed

+194578
-8177
lines changed

Some content is hidden

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

455 files changed

+194578
-8177
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ jobs:
160160
'generic-no-tzdb',
161161
'generic-no-unicode',
162162
'generic-no-wide-characters',
163+
'generic-no-rtti',
163164
'generic-static',
164165
'generic-with_llvm_unwinder',
165166
# TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive

.github/workflows/new-prs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ jobs:
2020
permissions:
2121
pull-requests: write
2222
# Only comment on PRs that have been opened for the first time, by someone
23-
# new to LLVM or to GitHub as a whole.
23+
# new to LLVM or to GitHub as a whole. Ideally we'd look for FIRST_TIMER
24+
# or FIRST_TIME_CONTRIBUTOR, but this does not appear to work. Instead check
25+
# that we do not have any of the other author associations.
26+
# See https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request
27+
# for all the possible values.
2428
if: >-
2529
(github.repository == 'llvm/llvm-project') &&
2630
(github.event.action == 'opened') &&
27-
(github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
28-
github.event.pull_request.author_association == 'FIRST_TIMER')
31+
(github.event.pull_request.author_association != 'COLLABORATOR') &&
32+
(github.event.pull_request.author_association != 'CONTRIBUTOR') &&
33+
(github.event.pull_request.author_association != 'MANNEQUIN') &&
34+
(github.event.pull_request.author_association != 'MEMBER') &&
35+
(github.event.pull_request.author_association != 'OWNER')
2936
steps:
3037
- name: Setup Automation Script
3138
run: |

.github/workflows/pr-code-format.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ jobs:
6767
START_REV: ${{ github.event.pull_request.base.sha }}
6868
END_REV: ${{ github.event.pull_request.head.sha }}
6969
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
70+
# TODO(boomanaiden154): Once clang v18 is released, we should be able
71+
# to take advantage of the new --diff_from_common_commit option
72+
# explicitly in code-format-helper.py and not have to diff starting at
73+
# the merge base.
7074
run: |
7175
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
7276
--token ${{ secrets.GITHUB_TOKEN }} \
7377
--issue-number $GITHUB_PR_NUMBER \
74-
--start-rev $START_REV \
78+
--start-rev $(git merge-base $START_REV $END_REV) \
7579
--end-rev $END_REV \
7680
--changed-files "$CHANGED_FILES"

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ Relaxed constexpr __cpp_constexpr C++14
14701470
``if constexpr`` __cpp_if_constexpr C++17 C++11
14711471
fold expressions __cpp_fold_expressions C++17 C++03
14721472
Lambda capture of \*this by value __cpp_capture_star_this C++17 C++11
1473-
Attributes on enums __cpp_enumerator_attributes C++17 C++11
1473+
Attributes on enums __cpp_enumerator_attributes C++17 C++03
14741474
Guaranteed copy elision __cpp_guaranteed_copy_elision C++17 C++03
14751475
Hexadecimal floating literals __cpp_hex_float C++17 C++03
14761476
``inline`` variables __cpp_inline_variables C++17 C++03

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,10 @@ Miscellaneous Clang Crashes Fixed
870870
`Issue 41302 <https://github.com/llvm/llvm-project/issues/41302>`_
871871
- Fixed a crash when ``-ast-dump=json`` was used for code using class
872872
template deduction guides.
873+
- Fixed a crash when a lambda marked as ``static`` referenced a captured
874+
variable in an expression.
875+
`Issue 74608 <https://github.com/llvm/llvm-project/issues/74608>`_
876+
873877

874878
OpenACC Specific Changes
875879
------------------------
@@ -1069,6 +1073,9 @@ Static Analyzer
10691073
`#65888 <https://github.com/llvm/llvm-project/pull/65888>`_, and
10701074
`#65887 <https://github.com/llvm/llvm-project/pull/65887>`_
10711075

1076+
- Move checker ``alpha.cplusplus.EnumCastOutOfRange`` out of the ``alpha``
1077+
package to ``optin.core.EnumCastOutOfRange``.
1078+
10721079
.. _release-notes-sanitizers:
10731080

10741081
Sanitizers

clang/docs/analyzer/checkers.rst

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,52 @@ optin
535535
536536
Checkers for portability, performance or coding style specific rules.
537537
538+
.. _optin-core-EnumCastOutOfRange:
539+
540+
optin.core.EnumCastOutOfRange (C, C++)
541+
""""""""""""""""""""""""""""""""""""""
542+
Check for integer to enumeration casts that would produce a value with no
543+
corresponding enumerator. This is not necessarily undefined behavior, but can
544+
lead to nasty surprises, so projects may decide to use a coding standard that
545+
disallows these "unusual" conversions.
546+
547+
Note that no warnings are produced when the enum type (e.g. `std::byte`) has no
548+
enumerators at all.
549+
550+
.. code-block:: cpp
551+
552+
enum WidgetKind { A=1, B, C, X=99 };
553+
554+
void foo() {
555+
WidgetKind c = static_cast<WidgetKind>(3); // OK
556+
WidgetKind x = static_cast<WidgetKind>(99); // OK
557+
WidgetKind d = static_cast<WidgetKind>(4); // warn
558+
}
559+
560+
**Limitations**
561+
562+
This checker does not accept the coding pattern where an enum type is used to
563+
store combinations of flag values:
564+
565+
.. code-block:: cpp
566+
567+
enum AnimalFlags
568+
{
569+
HasClaws = 1,
570+
CanFly = 2,
571+
EatsFish = 4,
572+
Endangered = 8
573+
};
574+
575+
AnimalFlags operator|(AnimalFlags a, AnimalFlags b)
576+
{
577+
return static_cast<AnimalFlags>(static_cast<int>(a) | static_cast<int>(b));
578+
}
579+
580+
auto flags = HasClaws | CanFly;
581+
582+
Projects that use this pattern should not enable this optin checker.
583+
538584
.. _optin-cplusplus-UninitializedObject:
539585
540586
optin.cplusplus.UninitializedObject (C++)
@@ -2113,23 +2159,6 @@ Reports destructions of polymorphic objects with a non-virtual destructor in the
21132159
// destructor
21142160
}
21152161
2116-
.. _alpha-cplusplus-EnumCastOutOfRange:
2117-
2118-
alpha.cplusplus.EnumCastOutOfRange (C++)
2119-
""""""""""""""""""""""""""""""""""""""""
2120-
Check for integer to enumeration casts that could result in undefined values.
2121-
2122-
.. code-block:: cpp
2123-
2124-
enum TestEnum {
2125-
A = 0
2126-
};
2127-
2128-
void foo() {
2129-
TestEnum t = static_cast(-1);
2130-
// warn: the value provided to the cast expression is not in
2131-
// the valid range of values for the enum
2132-
21332162
.. _alpha-cplusplus-InvalidatedIterator:
21342163
21352164
alpha.cplusplus.InvalidatedIterator (C++)

clang/include/clang/Basic/arm_sve.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,3 +2262,14 @@ let TargetGuard = "sme2" in {
22622262
def SVQCVTN_U16_U64_X4 : SInst<"svqcvtn_u16[_{d}_x4]", "b4.d", "Ul", MergeNone, "aarch64_sve_uqcvtn_x4", [IsStreaming], []>;
22632263
def SVQCVTN_U16_S64_X4 : SInst<"svqcvtn_u16[_{d}_x4]", "b4.d", "l", MergeNone, "aarch64_sve_sqcvtun_x4", [IsStreaming], []>;
22642264
}
2265+
2266+
//
2267+
// Multi-vector unpack
2268+
//
2269+
2270+
let TargetGuard = "sme2" in {
2271+
def SVSUNPK_X2 : SInst<"svunpk_{d}[_{1}_x2]", "2h", "sil", MergeNone, "aarch64_sve_sunpk_x2", [IsStreaming], []>;
2272+
def SVUUNPK_X2 : SInst<"svunpk_{d}[_{1}_x2]", "2h", "UsUiUl", MergeNone, "aarch64_sve_uunpk_x2", [IsStreaming], []>;
2273+
def SVSUNPK_X4 : SInst<"svunpk_{d}[_{3}_x4]", "42.h", "sil", MergeNone, "aarch64_sve_sunpk_x4", [IsStreaming], []>;
2274+
def SVUUNPK_X4 : SInst<"svunpk_{d}[_{3}_x4]", "42.h", "UsUiUl", MergeNone, "aarch64_sve_uunpk_x4", [IsStreaming], []>;
2275+
}

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7590,8 +7590,7 @@ class Sema final {
75907590

75917591
/// ActOnLambdaExpr - This is called when the body of a lambda expression
75927592
/// was successfully completed.
7593-
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
7594-
Scope *CurScope);
7593+
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body);
75957594

75967595
/// Does copying/destroying the captured variable have side effects?
75977596
bool CaptureHasSideEffects(const sema::Capture &From);

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def CoreAlpha : Package<"core">, ParentPackage<Alpha>;
3636
// Note: OptIn is *not* intended for checkers that are too noisy to be on by
3737
// default. Such checkers belong in the alpha package.
3838
def OptIn : Package<"optin">;
39+
def CoreOptIn : Package<"core">, ParentPackage<OptIn>;
3940

4041
// In the Portability package reside checkers for finding code that relies on
4142
// implementation-defined behavior. Such checks are wanted for cross-platform
@@ -439,6 +440,18 @@ def UndefinedNewArraySizeChecker : Checker<"NewArraySize">,
439440

440441
} // end "core.uninitialized"
441442

443+
//===----------------------------------------------------------------------===//
444+
// Optin checkers for core language features
445+
//===----------------------------------------------------------------------===//
446+
447+
let ParentPackage = CoreOptIn in {
448+
449+
def EnumCastOutOfRangeChecker : Checker<"EnumCastOutOfRange">,
450+
HelpText<"Check integer to enumeration casts for out of range values">,
451+
Documentation<HasDocumentation>;
452+
453+
} // end "optin.core"
454+
442455
//===----------------------------------------------------------------------===//
443456
// Unix API checkers.
444457
//===----------------------------------------------------------------------===//
@@ -774,10 +787,6 @@ def DeleteWithNonVirtualDtorChecker : Checker<"DeleteWithNonVirtualDtor">,
774787
"destructor in their base class">,
775788
Documentation<HasDocumentation>;
776789

777-
def EnumCastOutOfRangeChecker : Checker<"EnumCastOutOfRange">,
778-
HelpText<"Check integer to enumeration casts for out of range values">,
779-
Documentation<HasDocumentation>;
780-
781790
def IteratorModeling : Checker<"IteratorModeling">,
782791
HelpText<"Models iterators of C++ containers">,
783792
Dependencies<[ContainerModeling]>,

clang/lib/AST/ExprConstant.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8514,14 +8514,24 @@ bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD) {
85148514
return false;
85158515

85168516
if (auto *FD = Info.CurrentCall->LambdaCaptureFields.lookup(VD)) {
8517+
const auto *MD = cast<CXXMethodDecl>(Info.CurrentCall->Callee);
8518+
8519+
// Static lambda function call operators can't have captures. We already
8520+
// diagnosed this, so bail out here.
8521+
if (MD->isStatic()) {
8522+
assert(Info.CurrentCall->This == nullptr &&
8523+
"This should not be set for a static call operator");
8524+
return false;
8525+
}
8526+
85178527
// Start with 'Result' referring to the complete closure object...
8518-
if (auto *MD = cast<CXXMethodDecl>(Info.CurrentCall->Callee);
8519-
MD->isExplicitObjectMemberFunction()) {
8528+
if (MD->isExplicitObjectMemberFunction()) {
85208529
APValue *RefValue =
85218530
Info.getParamSlot(Info.CurrentCall->Arguments, MD->getParamDecl(0));
85228531
Result.setFrom(Info.Ctx, *RefValue);
85238532
} else
85248533
Result = *Info.CurrentCall->This;
8534+
85258535
// ... then update it to refer to the field of the closure object
85268536
// that represents the capture.
85278537
if (!HandleLValueMember(Info, E, Result, FD))

0 commit comments

Comments
 (0)