Skip to content

Commit 1e1c523

Browse files
committed
merge main into amd-staging
2 parents 4d9fd46 + eee7211 commit 1e1c523

File tree

177 files changed

+5992
-3289
lines changed

Some content is hidden

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

177 files changed

+5992
-3289
lines changed

clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]:
391391
args, extra_args = parser.parse_known_args()
392392
if args.std is None:
393393
_, extension = os.path.splitext(args.assume_filename or args.input_file_name)
394-
args.std = [
395-
"c++11-or-later" if extension in [".cpp", ".hpp", ".mm"] else "c99-or-later"
396-
]
394+
args.std = ["c99-or-later" if extension in [".c", ".m"] else "c++11-or-later"]
397395

398396
return (args, extra_args)
399397

clang/bindings/python/clang/cindex.py

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"tuple[str, Optional[list[Any]], Any]",
111111
"tuple[str, Optional[list[Any]], Any, Callable[..., Any]]",
112112
]
113+
CObjP: TypeAlias = _Pointer[Any]
113114

114115
TSeq = TypeVar("TSeq", covariant=True)
115116

@@ -2981,25 +2982,25 @@ class _CXUnsavedFile(Structure):
29812982

29822983
class CompletionChunk:
29832984
class Kind:
2984-
def __init__(self, name):
2985+
def __init__(self, name: str):
29852986
self.name = name
29862987

2987-
def __str__(self):
2988+
def __str__(self) -> str:
29882989
return self.name
29892990

2990-
def __repr__(self):
2991+
def __repr__(self) -> str:
29912992
return "<ChunkKind: %s>" % self
29922993

2993-
def __init__(self, completionString, key):
2994+
def __init__(self, completionString: CObjP, key: int):
29942995
self.cs = completionString
29952996
self.key = key
29962997
self.__kindNumberCache = -1
29972998

2998-
def __repr__(self):
2999+
def __repr__(self) -> str:
29993000
return "{'" + self.spelling + "', " + str(self.kind) + "}"
30003001

30013002
@CachedProperty
3002-
def spelling(self):
3003+
def spelling(self) -> str:
30033004
if self.__kindNumber in SPELLING_CACHE:
30043005
return SPELLING_CACHE[self.__kindNumber]
30053006
return _CXString.from_result(
@@ -3010,38 +3011,38 @@ def spelling(self):
30103011
# apparently still significantly faster. Please profile carefully if you
30113012
# would like to add CachedProperty back.
30123013
@property
3013-
def __kindNumber(self):
3014+
def __kindNumber(self) -> int:
30143015
if self.__kindNumberCache == -1:
30153016
self.__kindNumberCache = conf.lib.clang_getCompletionChunkKind(
30163017
self.cs, self.key
30173018
)
30183019
return self.__kindNumberCache
30193020

30203021
@CachedProperty
3021-
def kind(self):
3022+
def kind(self) -> Kind:
30223023
return completionChunkKindMap[self.__kindNumber]
30233024

30243025
@CachedProperty
3025-
def string(self):
3026+
def string(self) -> CompletionString | None:
30263027
res = conf.lib.clang_getCompletionChunkCompletionString(self.cs, self.key)
30273028

30283029
if not res:
30293030
return None
30303031
return CompletionString(res)
30313032

3032-
def isKindOptional(self):
3033+
def isKindOptional(self) -> bool:
30333034
return self.__kindNumber == 0
30343035

3035-
def isKindTypedText(self):
3036+
def isKindTypedText(self) -> bool:
30363037
return self.__kindNumber == 1
30373038

3038-
def isKindPlaceHolder(self):
3039+
def isKindPlaceHolder(self) -> bool:
30393040
return self.__kindNumber == 3
30403041

3041-
def isKindInformative(self):
3042+
def isKindInformative(self) -> bool:
30423043
return self.__kindNumber == 4
30433044

3044-
def isKindResultType(self):
3045+
def isKindResultType(self) -> bool:
30453046
return self.__kindNumber == 15
30463047

30473048

@@ -3081,39 +3082,39 @@ def __str__(self):
30813082
def __repr__(self):
30823083
return "<Availability: %s>" % self
30833084

3084-
def __len__(self):
3085+
def __len__(self) -> int:
30853086
return self.num_chunks
30863087

30873088
@CachedProperty
3088-
def num_chunks(self):
3089+
def num_chunks(self) -> int:
30893090
return conf.lib.clang_getNumCompletionChunks(self.obj) # type: ignore [no-any-return]
30903091

3091-
def __getitem__(self, key):
3092+
def __getitem__(self, key: int) -> CompletionChunk:
30923093
if self.num_chunks <= key:
30933094
raise IndexError
30943095
return CompletionChunk(self.obj, key)
30953096

30963097
if TYPE_CHECKING:
30973098
# Defining __getitem__ and __len__ is enough to make an iterable
30983099
# but the typechecker doesn't understand that.
3099-
def __iter__(self):
3100+
def __iter__(self) -> Iterator[CompletionChunk]:
31003101
for i in range(len(self)):
31013102
yield self[i]
31023103

31033104
@property
3104-
def priority(self):
3105+
def priority(self) -> int:
31053106
return conf.lib.clang_getCompletionPriority(self.obj) # type: ignore [no-any-return]
31063107

31073108
@property
3108-
def availability(self):
3109+
def availability(self) -> CompletionChunk.Kind:
31093110
res = conf.lib.clang_getCompletionAvailability(self.obj)
31103111
return availabilityKinds[res]
31113112

31123113
@property
3113-
def briefComment(self):
3114+
def briefComment(self) -> str:
31143115
return _CXString.from_result(conf.lib.clang_getCompletionBriefComment(self.obj))
31153116

3116-
def __repr__(self):
3117+
def __repr__(self) -> str:
31173118
return (
31183119
" | ".join([str(a) for a in self])
31193120
+ " || Priority: "
@@ -3136,44 +3137,47 @@ def __repr__(self):
31363137
class CodeCompletionResult(Structure):
31373138
_fields_ = [("cursorKind", c_int), ("completionString", c_object_p)]
31383139

3139-
def __repr__(self):
3140+
def __repr__(self) -> str:
31403141
return str(CompletionString(self.completionString))
31413142

31423143
@property
3143-
def kind(self):
3144+
def kind(self) -> CursorKind:
31443145
return CursorKind.from_id(self.cursorKind)
31453146

31463147
@property
3147-
def string(self):
3148+
def string(self) -> CompletionString:
31483149
return CompletionString(self.completionString)
31493150

31503151

31513152
class CCRStructure(Structure):
31523153
_fields_ = [("results", POINTER(CodeCompletionResult)), ("numResults", c_int)]
31533154

3154-
def __len__(self):
3155+
results: NoSliceSequence[CodeCompletionResult]
3156+
numResults: int
3157+
3158+
def __len__(self) -> int:
31553159
return self.numResults
31563160

3157-
def __getitem__(self, key):
3161+
def __getitem__(self, key: int) -> CodeCompletionResult:
31583162
if len(self) <= key:
31593163
raise IndexError
31603164

31613165
return self.results[key]
31623166

31633167

31643168
class CodeCompletionResults(ClangObject):
3165-
def __init__(self, ptr):
3169+
def __init__(self, ptr: _Pointer[CCRStructure]):
31663170
assert isinstance(ptr, POINTER(CCRStructure)) and ptr
31673171
self.ptr = self._as_parameter_ = ptr
31683172

3169-
def from_param(self):
3173+
def from_param(self) -> _Pointer[CCRStructure]:
31703174
return self._as_parameter_
31713175

3172-
def __del__(self):
3176+
def __del__(self) -> None:
31733177
conf.lib.clang_disposeCodeCompleteResults(self)
31743178

31753179
@property
3176-
def results(self):
3180+
def results(self) -> CCRStructure:
31773181
return self.ptr.contents
31783182

31793183
@property

clang/docs/LanguageExtensions.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,12 +872,14 @@ of different sizes and signs is forbidden in binary and ternary builtins.
872872
for the comparison.
873873
T __builtin_elementwise_fshl(T x, T y, T z) perform a funnel shift left. Concatenate x and y (x is the most integer types
874874
significant bits of the wide value), the combined value is shifted
875-
left by z, and the most significant bits are extracted to produce
875+
left by z (modulo the bit width of the original arguments),
876+
and the most significant bits are extracted to produce
876877
a result that is the same size as the original arguments.
877878

878879
T __builtin_elementwise_fshr(T x, T y, T z) perform a funnel shift right. Concatenate x and y (x is the most integer types
879880
significant bits of the wide value), the combined value is shifted
880-
right by z, and the least significant bits are extracted to produce
881+
right by z (modulo the bit width of the original arguments),
882+
and the least significant bits are extracted to produce
881883
a result that is the same size as the original arguments.
882884
T __builtin_elementwise_ctlz(T x[, T y]) return the number of leading 0 bits in the first argument. If integer types
883885
the first argument is 0 and an optional second argument is provided,

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ C++ Specific Potentially Breaking Changes
8282
static_assert((b.*mp)() == 1); // newly rejected
8383
static_assert((c.*mp)() == 1); // accepted
8484
85+
- ``VarTemplateSpecializationDecl::getTemplateArgsAsWritten()`` method now
86+
returns ``nullptr`` for implicitly instantiated declarations.
87+
8588
ABI Changes in This Version
8689
---------------------------
8790

@@ -584,6 +587,8 @@ Bug Fixes to C++ Support
584587
- Fix the parsing of variadic member functions when the ellipis immediately follows a default argument.(#GH153445)
585588
- Fixed a bug that caused ``this`` captured by value in a lambda with a dependent explicit object parameter to not be
586589
instantiated properly. (#GH154054)
590+
- Fixed a crash when implicit conversions from initialize list to arrays of
591+
unknown bound during constant evaluation. (#GH151716)
587592

588593
Bug Fixes to AST Handling
589594
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Builtins.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,13 +1540,13 @@ def ElementwiseSubSat : Builtin {
15401540

15411541
def ElementwiseFshl : Builtin {
15421542
let Spellings = ["__builtin_elementwise_fshl"];
1543-
let Attributes = [NoThrow, Const, CustomTypeChecking];
1543+
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
15441544
let Prototype = "void(...)";
15451545
}
15461546

15471547
def ElementwiseFshr : Builtin {
15481548
let Spellings = ["__builtin_elementwise_fshr"];
1549-
let Attributes = [NoThrow, Const, CustomTypeChecking];
1549+
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
15501550
let Prototype = "void(...)";
15511551
}
15521552

clang/include/clang/Basic/arm_sve.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ let SVETargetGuard = "sve2,lut", SMETargetGuard = "sme2,lut" in {
18281828
////////////////////////////////////////////////////////////////////////////////
18291829
// SVE2 - Optional
18301830

1831-
let SVETargetGuard = "sve2,sve-aes", SMETargetGuard = "ssve-aes" in {
1831+
let SVETargetGuard = "sve-aes", SMETargetGuard = "ssve-aes" in {
18321832
def SVAESD : SInst<"svaesd[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aesd", [IsOverloadNone, VerifyRuntimeMode]>;
18331833
def SVAESIMC : SInst<"svaesimc[_{d}]", "dd", "Uc", MergeNone, "aarch64_sve_aesimc", [IsOverloadNone, VerifyRuntimeMode]>;
18341834
def SVAESE : SInst<"svaese[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aese", [IsOverloadNone, VerifyRuntimeMode]>;
@@ -1845,12 +1845,12 @@ let SVETargetGuard = "sve-sha3", SMETargetGuard = "sve-sha3,sme2p1" in {
18451845
def SVRAX1 : SInst<"svrax1[_{d}]", "ddd", "lUl", MergeNone, "aarch64_sve_rax1", [IsOverloadNone, VerifyRuntimeMode]>;
18461846
}
18471847

1848-
let SVETargetGuard = "sve2-sm4", SMETargetGuard = InvalidMode in {
1848+
let SVETargetGuard = "sve-sm4", SMETargetGuard = InvalidMode in {
18491849
def SVSM4E : SInst<"svsm4e[_{d}]", "ddd", "Ui", MergeNone, "aarch64_sve_sm4e", [IsOverloadNone]>;
18501850
def SVSM4EKEY : SInst<"svsm4ekey[_{d}]", "ddd", "Ui", MergeNone, "aarch64_sve_sm4ekey", [IsOverloadNone]>;
18511851
}
18521852

1853-
let SVETargetGuard = "sve2,sve-bitperm", SMETargetGuard = "ssve-bitperm" in {
1853+
let SVETargetGuard = "sve-bitperm", SMETargetGuard = "ssve-bitperm" in {
18541854
def SVBDEP : SInst<"svbdep[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x", [VerifyRuntimeMode]>;
18551855
def SVBDEP_N : SInst<"svbdep[_n_{d}]", "dda", "UcUsUiUl", MergeNone, "aarch64_sve_bdep_x", [VerifyRuntimeMode]>;
18561856
def SVBEXT : SInst<"svbext[_{d}]", "ddd", "UcUsUiUl", MergeNone, "aarch64_sve_bext_x", [VerifyRuntimeMode]>;
@@ -1979,7 +1979,7 @@ let SVETargetGuard = "sve2p1", SMETargetGuard = "sme2" in {
19791979
def SVPFALSE_COUNT_ALIAS : SInst<"svpfalse_c", "}v", "", MergeNone, "", [IsOverloadNone, VerifyRuntimeMode]>;
19801980
}
19811981

1982-
let SVETargetGuard = "sve2,sve-b16b16", SMETargetGuard = "sme2,sve-b16b16" in {
1982+
let SVETargetGuard = "sve-b16b16", SMETargetGuard = "sme2,sve-b16b16" in {
19831983
defm SVMUL_BF : SInstZPZZ<"svmul", "b", "aarch64_sve_fmul", "aarch64_sve_fmul_u", [VerifyRuntimeMode]>;
19841984
defm SVADD_BF : SInstZPZZ<"svadd", "b", "aarch64_sve_fadd", "aarch64_sve_fadd_u", [VerifyRuntimeMode]>;
19851985
defm SVSUB_BF : SInstZPZZ<"svsub", "b", "aarch64_sve_fsub", "aarch64_sve_fsub_u", [VerifyRuntimeMode]>;

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11668,7 +11668,8 @@ class Sema final : public SemaBase {
1166811668
DeclResult CheckVarTemplateId(VarTemplateDecl *Template,
1166911669
SourceLocation TemplateLoc,
1167011670
SourceLocation TemplateNameLoc,
11671-
const TemplateArgumentListInfo &TemplateArgs);
11671+
const TemplateArgumentListInfo &TemplateArgs,
11672+
bool SetWrittenArgs);
1167211673

1167311674
/// Form a reference to the specialization of the given variable template
1167411675
/// corresponding to the specified argument list, or a null-but-valid result
@@ -14028,7 +14029,6 @@ class Sema final : public SemaBase {
1402814029
VarTemplateSpecializationDecl *BuildVarTemplateInstantiation(
1402914030
VarTemplateDecl *VarTemplate, VarDecl *FromVar,
1403014031
const TemplateArgumentList *PartialSpecArgs,
14031-
const TemplateArgumentListInfo &TemplateArgsInfo,
1403214032
SmallVectorImpl<TemplateArgument> &Converted,
1403314033
SourceLocation PointOfInstantiation,
1403414034
LateInstantiatedAttrVec *LateAttrs = nullptr,

clang/include/clang/Sema/Template.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,8 @@ enum class TemplateSubstitutionKind : char {
723723
bool SubstQualifier(const TagDecl *OldDecl,
724724
TagDecl *NewDecl);
725725

726-
Decl *VisitVarTemplateSpecializationDecl(
726+
VarTemplateSpecializationDecl *VisitVarTemplateSpecializationDecl(
727727
VarTemplateDecl *VarTemplate, VarDecl *FromVar,
728-
const TemplateArgumentListInfo &TemplateArgsInfo,
729728
ArrayRef<TemplateArgument> Converted,
730729
VarTemplateSpecializationDecl *PrevDecl = nullptr);
731730

0 commit comments

Comments
 (0)