Skip to content

Commit 3482b4e

Browse files
committed
merge main into amd-staging
2 parents 640cb90 + f33dc8e commit 3482b4e

File tree

168 files changed

+3451
-1884
lines changed

Some content is hidden

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

168 files changed

+3451
-1884
lines changed

.ci/metrics/metrics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
# Lists the Github workflows we want to track. Maps the Github job name to
2222
# the metric name prefix in grafana.
2323
# This metric name is also used as a key in the job->name map.
24-
GITHUB_WORKFLOW_TO_TRACK = {"LLVM Premerge Checks": "github_llvm_premerge_checks"}
24+
GITHUB_WORKFLOW_TO_TRACK = {"CI Checks": "github_llvm_premerge_checks"}
2525

2626
# Lists the Github jobs to track for a given workflow. The key is the stable
2727
# name (metric name) of the workflow (see GITHUB_WORKFLOW_TO_TRACK).
2828
# Each value is a map to link the github job name to the corresponding metric
2929
# name.
3030
GITHUB_JOB_TO_TRACK = {
3131
"github_llvm_premerge_checks": {
32-
"Linux Premerge Checks (Test Only - Please Ignore Results)": "premerge_linux",
33-
"Windows Premerge Checks (Test Only - Please Ignore Results)": "premerge_windows",
32+
"Build and Test Linux (Test Only - Please Ignore Results)": "premerge_linux",
33+
"Build and Test Windows (Test Only - Please Ignore Results)": "premerge_windows",
3434
}
3535
}
3636

.github/workflows/premerge.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: LLVM Premerge Checks
1+
name: CI Checks
22

33
permissions:
44
contents: read
@@ -25,7 +25,7 @@ concurrency:
2525

2626
jobs:
2727
premerge-checks-linux:
28-
name: Linux Premerge Checks (Test Only - Please Ignore Results)
28+
name: Build and Test Linux (Test Only - Please Ignore Results)
2929
if: >-
3030
github.repository_owner == 'llvm' &&
3131
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -74,7 +74,7 @@ jobs:
7474
include-hidden-files: 'true'
7575

7676
premerge-checks-windows:
77-
name: Windows Premerge Checks (Test Only - Please Ignore Results)
77+
name: Build and Test Windows (Test Only - Please Ignore Results)
7878
if: >-
7979
github.repository_owner == 'llvm' &&
8080
(github.event_name != 'pull_request' || github.event.action != 'closed')

clang/bindings/python/tests/cindex/test_cursor.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,18 @@ def test_specialized_template(self):
10351035
self.assertNotEqual(foos[0], foos[1])
10361036
self.assertEqual(foos[0], prime_foo)
10371037
self.assertIsNone(tu.cursor.specialized_template)
1038+
1039+
def test_equality(self):
1040+
tu = get_tu(CHILDREN_TEST, lang="cpp")
1041+
cursor1 = get_cursor(tu, "s0")
1042+
cursor1_2 = get_cursor(tu, "s0")
1043+
cursor2 = get_cursor(tu, "f0")
1044+
1045+
self.assertIsNotNone(cursor1)
1046+
self.assertIsNotNone(cursor1_2)
1047+
self.assertIsNotNone(cursor2)
1048+
1049+
self.assertEqual(cursor1, cursor1)
1050+
self.assertEqual(cursor1, cursor1_2)
1051+
self.assertNotEqual(cursor1, cursor2)
1052+
self.assertNotEqual(cursor1, "foo")

clang/bindings/python/tests/cindex/test_location.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23

34
from clang.cindex import (
45
Config,
@@ -16,6 +17,8 @@
1617

1718
from .util import get_cursor, get_tu
1819

20+
INPUTS_DIR = Path(__file__).parent / "INPUTS"
21+
1922
BASE_INPUT = "int one;\nint two;\n"
2023

2124

@@ -151,3 +154,21 @@ def test_operator_lt(self):
151154
assert l_t1_12 < l_t2_13 < l_t1_14
152155
assert not l_t2_13 < l_t1_12
153156
assert not l_t1_14 < l_t2_13
157+
158+
def test_equality(self):
159+
path = INPUTS_DIR / "testfile.c"
160+
path_a = INPUTS_DIR / "a.inc"
161+
tu = TranslationUnit.from_source(path)
162+
main_file = File.from_name(tu, path)
163+
a_file = File.from_name(tu, path_a)
164+
165+
location1 = SourceLocation.from_position(tu, main_file, 1, 3)
166+
location2 = SourceLocation.from_position(tu, main_file, 2, 2)
167+
location1_2 = SourceLocation.from_position(tu, main_file, 1, 3)
168+
file2_location1 = SourceLocation.from_position(tu, a_file, 1, 3)
169+
170+
self.assertEqual(location1, location1)
171+
self.assertEqual(location1, location1_2)
172+
self.assertNotEqual(location1, location2)
173+
self.assertNotEqual(location1, file2_location1)
174+
self.assertNotEqual(location1, "foo")

clang/bindings/python/tests/cindex/test_source_range.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23

34
from clang.cindex import Config, SourceLocation, SourceRange, TranslationUnit
45

@@ -9,6 +10,8 @@
910

1011
from .util import get_tu
1112

13+
INPUTS_DIR = Path(__file__).parent / "INPUTS"
14+
1215

1316
def create_range(tu, line1, column1, line2, column2):
1417
return SourceRange.from_locations(
@@ -83,3 +86,16 @@ def test_contains(self):
8386
r_curly = create_range(tu2, 1, 11, 3, 1)
8487
l_f2 = SourceLocation.from_position(tu2, tu2.get_file("./numbers.inc"), 4, 1)
8588
assert l_f2 in r_curly
89+
90+
def test_equality(self):
91+
path = INPUTS_DIR / "testfile.c"
92+
tu = TranslationUnit.from_source(path)
93+
94+
r1 = create_range(tu, 1, 1, 2, 2)
95+
r2 = create_range(tu, 1, 2, 2, 2)
96+
r1_2 = create_range(tu, 1, 1, 2, 2)
97+
98+
self.assertEqual(r1, r1)
99+
self.assertEqual(r1, r1_2)
100+
self.assertNotEqual(r1, r2)
101+
self.assertNotEqual(r1, "foo")

clang/docs/OpenMPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ implementation.
207207
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
208208
| misc | library shutdown (omp_pause_resource[_all]) | :good:`done` | D55078 |
209209
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
210-
| misc | metadirectives | :part:`mostly done` | D91944 |
210+
| misc | metadirectives | :part:`mostly done` | D91944, https://github.com/llvm/llvm-project/pull/128640 |
211211
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
212212
| misc | conditional modifier for lastprivate clause | :good:`done` | |
213213
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ C Language Changes
154154
- Added ``-Wimplicit-void-ptr-cast``, grouped under ``-Wc++-compat``, which
155155
diagnoses implicit conversion from ``void *`` to another pointer type as
156156
being incompatible with C++. (#GH17792)
157+
- Added ``-Wc++-keyword``, grouped under ``-Wc++-compat``, which diagnoses when
158+
a C++ keyword is used as an identifier in C. (#GH21898)
157159
- Added ``-Wc++-hidden-decl``, grouped under ``-Wc++-compat``, which diagnoses
158160
use of tag types which are visible in C but not visible in C++ due to scoping
159161
rules. e.g.,
@@ -498,6 +500,8 @@ Improvements to Clang's diagnostics
498500
- ``-Winitializer-overrides`` and ``-Wreorder-init-list`` are now grouped under
499501
the ``-Wc99-designator`` diagnostic group, as they also are about the
500502
behavior of the C99 feature as it was introduced into C++20. Fixes #GH47037
503+
- ``-Wreserved-identifier`` now fires on reserved parameter names in a function
504+
declaration which is not a definition.
501505

502506
Improvements to Clang's time-trace
503507
----------------------------------
@@ -637,6 +641,8 @@ Bug Fixes to C++ Support
637641
- Clang now issues an error when placement new is used to modify a const-qualified variable
638642
in a ``constexpr`` function. (#GH131432)
639643
- Clang now emits a warning when class template argument deduction for alias templates is used in C++17. (#GH133806)
644+
- Fix a crash when checking the template template parameters of a dependent lambda appearing in an alias declaration.
645+
(#GH136432), (#GH137014), (#GH138018)
640646

641647
Bug Fixes to AST Handling
642648
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def C99Compat : DiagGroup<"c99-compat">;
157157
def C23Compat : DiagGroup<"c23-compat">;
158158
def : DiagGroup<"c2x-compat", [C23Compat]>;
159159

160+
def CppKeywordInC : DiagGroup<"c++-keyword">;
160161
def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">;
161162
def InitStringTooLongMissingNonString :
162163
DiagGroup<"unterminated-string-initialization">;
@@ -178,9 +179,9 @@ def ImplicitIntToEnumCast : DiagGroup<"implicit-int-enum-cast",
178179
[ImplicitEnumEnumCast]>;
179180
def TentativeDefnCompat : DiagGroup<"tentative-definition-compat">;
180181
def CXXCompat: DiagGroup<"c++-compat", [ImplicitVoidPtrCast, DefaultConstInit,
181-
ImplicitIntToEnumCast, HiddenCppDecl,
182-
InitStringTooLongForCpp,
183-
TentativeDefnCompat,
182+
ImplicitIntToEnumCast, CppKeywordInC,
183+
HiddenCppDecl, TentativeDefnCompat,
184+
InitStringTooLongForCpp,
184185
DuplicateDeclSpecifier]>;
185186

186187
def ExternCCompat : DiagGroup<"extern-c-compat">;

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ def warn_pp_macro_is_reserved_attribute_id : Warning<
421421
def warn_pp_objc_macro_redef_ignored : Warning<
422422
"ignoring redefinition of Objective-C qualifier macro">,
423423
InGroup<DiagGroup<"objc-macro-redefinition">>;
424+
def warn_pp_identifier_is_cpp_keyword : Warning<
425+
"identifier %0 conflicts with a C++ keyword">,
426+
InGroup<CppKeywordInC>, DefaultIgnore;
424427

425428
def pp_invalid_string_literal : Warning<
426429
"invalid string literal, ignoring final '\\'">;

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,8 @@ def err_omp_expected_colon : Error<"missing ':' in %0">;
16681668
def err_omp_missing_comma : Error< "missing ',' after %0">;
16691669
def err_omp_expected_context_selector
16701670
: Error<"expected valid context selector in %0">;
1671+
def warn_omp_default_deprecated : Warning<"'default' clause for"
1672+
" 'metadirective' is deprecated; use 'otherwise' instead">, InGroup<Deprecated>;
16711673
def err_omp_requires_out_inout_depend_type : Error<
16721674
"reserved locator 'omp_all_memory' requires 'out' or 'inout' "
16731675
"dependency types">;

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
195195
LLVM_PREFERRED_TYPE(bool)
196196
unsigned IsFinal : 1;
197197

198-
// 22 bits left in a 64-bit word.
198+
// True if this identifier would be a keyword in C++ mode.
199+
LLVM_PREFERRED_TYPE(bool)
200+
unsigned IsKeywordInCpp : 1;
201+
202+
// 21 bits left in a 64-bit word.
199203

200204
// Managed by the language front-end.
201205
void *FETokenInfo = nullptr;
@@ -212,7 +216,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
212216
IsFromAST(false), ChangedAfterLoad(false), FEChangedAfterLoad(false),
213217
RevertedTokenID(false), OutOfDate(false), IsModulesImport(false),
214218
IsMangledOpenMPVariantName(false), IsDeprecatedMacro(false),
215-
IsRestrictExpansion(false), IsFinal(false) {}
219+
IsRestrictExpansion(false), IsFinal(false), IsKeywordInCpp(false) {}
216220

217221
public:
218222
IdentifierInfo(const IdentifierInfo &) = delete;
@@ -444,6 +448,10 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
444448
}
445449
bool isCPlusPlusOperatorKeyword() const { return IsCPPOperatorKeyword; }
446450

451+
/// Return true if this identifier would be a keyword in C++ mode.
452+
bool IsKeywordInCPlusPlus() const { return IsKeywordInCpp; }
453+
void setIsKeywordInCPlusPlus(bool Val = true) { IsKeywordInCpp = Val; }
454+
447455
/// Return true if this token is a keyword in the specified language.
448456
bool isKeyword(const LangOptions &LangOpts) const;
449457

@@ -462,6 +470,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
462470
/// If this returns false, we know that HandleIdentifier will not affect
463471
/// the token.
464472
bool isHandleIdentifierCase() const { return NeedsHandleIdentifier; }
473+
void setHandleIdentifierCase(bool Val = true) { NeedsHandleIdentifier = Val; }
465474

466475
/// Return true if the identifier in its current state was loaded
467476
/// from an AST file.

clang/include/clang/Basic/TokenKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ ANNOTATION(embed)
10421042
#undef TYPE_TRAIT_2
10431043
#undef TYPE_TRAIT_1
10441044
#undef TYPE_TRAIT
1045+
#undef MODULES_KEYWORD
10451046
#undef CXX20_KEYWORD
10461047
#undef CXX11_KEYWORD
10471048
#undef KEYWORD

clang/include/clang/Basic/arm_sve.td

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,13 +1990,13 @@ def SVSM4E : SInst<"svsm4e[_{d}]", "ddd", "Ui", MergeNone, "aarch64_sve_sm
19901990
def SVSM4EKEY : SInst<"svsm4ekey[_{d}]", "ddd", "Ui", MergeNone, "aarch64_sve_sm4ekey", [IsOverloadNone]>;
19911991
}
19921992

1993-
let SVETargetGuard = "sve2,sve-bitperm", SMETargetGuard = InvalidMode in {
1994-
def SVBDEP : SInst<"svbdep[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x">;
1995-
def SVBDEP_N : SInst<"svbdep[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x">;
1996-
def SVBEXT : SInst<"svbext[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bext_x">;
1997-
def SVBEXT_N : SInst<"svbext[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bext_x">;
1998-
def SVBGRP : SInst<"svbgrp[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bgrp_x">;
1999-
def SVBGRP_N : SInst<"svbgrp[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bgrp_x">;
1993+
let SVETargetGuard = "sve2,sve-bitperm", SMETargetGuard = "sme,ssve-bitperm" in {
1994+
def SVBDEP : SInst<"svbdep[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x", [VerifyRuntimeMode]>;
1995+
def SVBDEP_N : SInst<"svbdep[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x", [VerifyRuntimeMode]>;
1996+
def SVBEXT : SInst<"svbext[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bext_x", [VerifyRuntimeMode]>;
1997+
def SVBEXT_N : SInst<"svbext[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bext_x", [VerifyRuntimeMode]>;
1998+
def SVBGRP : SInst<"svbgrp[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bgrp_x", [VerifyRuntimeMode]>;
1999+
def SVBGRP_N : SInst<"svbgrp[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bgrp_x", [VerifyRuntimeMode]>;
20002000
}
20012001

20022002
let SVETargetGuard = "sve2p1", SMETargetGuard = "sme" in {

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,11 @@ def PtrStrideOp : CIR_Op<"ptr_stride",
254254
```
255255
}];
256256

257-
let arguments = (ins CIR_PointerType:$base, PrimitiveInt:$stride);
257+
let arguments = (ins
258+
CIR_PointerType:$base,
259+
CIR_AnyFundamentalIntType:$stride
260+
);
261+
258262
let results = (outs CIR_PointerType:$result);
259263

260264
let assemblyFormat = [{

0 commit comments

Comments
 (0)