Skip to content

Commit 89eaefb

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents b16ff9f + dc15a80 commit 89eaefb

File tree

323 files changed

+10692
-5915
lines changed

Some content is hidden

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

323 files changed

+10692
-5915
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ Improvements to Clang's diagnostics
626626
- Clang now diagnoses the requirement that non-template friend declarations with requires clauses
627627
and template friend declarations with a constraint that depends on a template parameter from an
628628
enclosing template must be a definition.
629+
- Clang now diagnoses function/variable templates that shadow their own template parameters, e.g. ``template<class T> void T();``.
629630

630631

631632
Improvements to Clang's time-trace
@@ -826,6 +827,9 @@ Bug Fixes in This Version
826827
- Fix crashes when using the binding decl from an invalid structured binding.
827828
Fixes (`#67495 <https://github.com/llvm/llvm-project/issues/67495>`_) and
828829
(`#72198 <https://github.com/llvm/llvm-project/issues/72198>`_)
830+
- Fix assertion failure when call noreturn-attribute function with musttail
831+
attribute.
832+
Fixes (`#76631 <https://github.com/llvm/llvm-project/issues/76631>`_)
829833

830834
Bug Fixes to Compiler Builtins
831835
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Attr.td

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ class VariadicEnumArgument<string name, string type, list<string> values,
306306
bit IsExternalType = isExternalType;
307307
}
308308

309+
// Represents an attribute wrapped by another attribute.
310+
class WrappedAttr<string name, bit opt = 0> : Argument<name, opt>;
311+
309312
// This handles one spelling of an attribute.
310313
class Spelling<string name, string variety, int version = 1> {
311314
string Name = name;
@@ -2291,7 +2294,7 @@ def ObjCBridgeRelated : InheritableAttr {
22912294
def NSErrorDomain : InheritableAttr {
22922295
let Spellings = [GNU<"ns_error_domain">];
22932296
let Subjects = SubjectList<[Enum], ErrorDiag>;
2294-
let Args = [DeclArgument<Var, "ErrorDomain">];
2297+
let Args = [IdentifierArgument<"ErrorDomain">];
22952298
let Documentation = [NSErrorDomainDocs];
22962299
}
22972300

@@ -2648,6 +2651,22 @@ def SwiftError : InheritableAttr {
26482651
let Documentation = [SwiftErrorDocs];
26492652
}
26502653

2654+
def SwiftImportAsNonGeneric : InheritableAttr {
2655+
// This attribute has no spellings as it is only ever created implicitly
2656+
// from API notes.
2657+
let Spellings = [];
2658+
let SemaHandler = 0;
2659+
let Documentation = [InternalOnly];
2660+
}
2661+
2662+
def SwiftImportPropertyAsAccessors : InheritableAttr {
2663+
// This attribute has no spellings as it is only ever created implicitly
2664+
// from API notes.
2665+
let Spellings = [];
2666+
let SemaHandler = 0;
2667+
let Documentation = [InternalOnly];
2668+
}
2669+
26512670
def SwiftName : InheritableAttr {
26522671
let Spellings = [GNU<"swift_name">];
26532672
let Args = [StringArgument<"Name">];
@@ -2669,6 +2688,31 @@ def SwiftPrivate : InheritableAttr {
26692688
let SimpleHandler = 1;
26702689
}
26712690

2691+
def SwiftVersionedAddition : Attr {
2692+
// This attribute has no spellings as it is only ever created implicitly
2693+
// from API notes.
2694+
let Spellings = [];
2695+
let Args = [VersionArgument<"Version">, WrappedAttr<"AdditionalAttr">,
2696+
BoolArgument<"IsReplacedByActive">];
2697+
let SemaHandler = 0;
2698+
let Documentation = [InternalOnly];
2699+
}
2700+
2701+
def SwiftVersionedRemoval : Attr {
2702+
// This attribute has no spellings as it is only ever created implicitly
2703+
// from API notes.
2704+
let Spellings = [];
2705+
let Args = [VersionArgument<"Version">, UnsignedArgument<"RawKind">,
2706+
BoolArgument<"IsReplacedByActive">];
2707+
let SemaHandler = 0;
2708+
let Documentation = [InternalOnly];
2709+
let AdditionalMembers = [{
2710+
attr::Kind getAttrKindToRemove() const {
2711+
return static_cast<attr::Kind>(getRawKind());
2712+
}
2713+
}];
2714+
}
2715+
26722716
def NoDeref : TypeAttr {
26732717
let Spellings = [Clang<"noderef">];
26742718
let Documentation = [NoDerefDocs];

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,9 @@ def err_pragma_invalid_keyword : Error<
16171617
def err_pragma_pipeline_invalid_keyword : Error<
16181618
"invalid argument; expected 'disable'">;
16191619

1620+
// API notes.
1621+
def err_type_unparsed : Error<"unparsed tokens following type">;
1622+
16201623
// Pragma unroll support.
16211624
def warn_pragma_unroll_cuda_value_in_parens : Warning<
16221625
"argument to '#pragma unroll' should not be in parentheses in CUDA C/C++">,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,8 @@ def err_musttail_scope : Error<
31133113
"cannot perform a tail call from this return statement">;
31143114
def err_musttail_no_variadic : Error<
31153115
"%0 attribute may not be used with variadic functions">;
3116+
def err_musttail_no_return : Error<
3117+
"%0 attribute may not be used with no-return-attribute functions">;
31163118

31173119
def err_nsobject_attribute : Error<
31183120
"'NSObject' attribute is for pointer types only">;

clang/include/clang/Basic/OpenACCKinds.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ enum class OpenACCClauseKind {
217217
/// 'reduction' clause, allowed on Parallel, Serial, Loop, and the combined
218218
/// constructs.
219219
Reduction,
220+
/// 'collapse' clause, allowed on 'loop' and Combined constructs.
221+
Collapse,
220222

221223
/// Represents an invalid clause, for the purposes of parsing.
222224
Invalid,
@@ -312,6 +314,9 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &Out,
312314
case OpenACCClauseKind::Reduction:
313315
return Out << "reduction";
314316

317+
case OpenACCClauseKind::Collapse:
318+
return Out << "collapse";
319+
315320
case OpenACCClauseKind::Invalid:
316321
return Out << "<invalid>";
317322
}

clang/include/clang/Lex/Lexer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ class Lexer : public PreprocessorLexer {
198198
/// from. Currently this is only used by _Pragma handling.
199199
SourceLocation getFileLoc() const { return FileLoc; }
200200

201-
private:
202201
/// Lex - Return the next token in the file. If this is the end of file, it
203202
/// return the tok::eof token. This implicitly involves the preprocessor.
204203
bool Lex(Token &Result);
205204

205+
private:
206206
/// Called when the preprocessor is in 'dependency scanning lexing mode'.
207207
bool LexDependencyDirectiveToken(Token &Result);
208208

clang/include/clang/Parse/Parser.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,6 +3656,18 @@ class Parser : public CodeCompletionHandler {
36563656
ParseConceptDefinition(const ParsedTemplateInfo &TemplateInfo,
36573657
SourceLocation &DeclEnd);
36583658

3659+
/// Parse the given string as a type.
3660+
///
3661+
/// This is a dangerous utility function currently employed only by API notes.
3662+
/// It is not a general entry-point for safely parsing types from strings.
3663+
///
3664+
/// \param TypeStr The string to be parsed as a type.
3665+
/// \param Context The name of the context in which this string is being
3666+
/// parsed, which will be used in diagnostics.
3667+
/// \param IncludeLoc The location at which this parse was triggered.
3668+
TypeResult ParseTypeFromString(StringRef TypeStr, StringRef Context,
3669+
SourceLocation IncludeLoc);
3670+
36593671
//===--------------------------------------------------------------------===//
36603672
// Modules
36613673
DeclGroupPtrTy ParseModuleDecl(Sema::ModuleImportState &ImportState);

clang/include/clang/Sema/Sema.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,10 @@ class Sema final {
955955
OpaqueParser = P;
956956
}
957957

958+
/// Callback to the parser to parse a type expressed as a string.
959+
std::function<TypeResult(StringRef, StringRef, SourceLocation)>
960+
ParseTypeFromStringCallback;
961+
958962
class DelayedDiagnostics;
959963

960964
class DelayedDiagnosticsState {
@@ -3017,6 +3021,9 @@ class Sema final {
30173021
ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC,
30183022
SourceLocation Loc,
30193023
QualType T);
3024+
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T,
3025+
SourceLocation NameLoc,
3026+
TypeSourceInfo *TSInfo);
30203027
ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc,
30213028
SourceLocation NameLoc, IdentifierInfo *Name,
30223029
QualType T, TypeSourceInfo *TSInfo,
@@ -4820,6 +4827,29 @@ class Sema final {
48204827
/// Valid types should not have multiple attributes with different CCs.
48214828
const AttributedType *getCallingConvAttributedType(QualType T) const;
48224829

4830+
/// Check whether a nullability type specifier can be added to the given
4831+
/// type through some means not written in source (e.g. API notes).
4832+
///
4833+
/// \param Type The type to which the nullability specifier will be
4834+
/// added. On success, this type will be updated appropriately.
4835+
///
4836+
/// \param Nullability The nullability specifier to add.
4837+
///
4838+
/// \param DiagLoc The location to use for diagnostics.
4839+
///
4840+
/// \param AllowArrayTypes Whether to accept nullability specifiers on an
4841+
/// array type (e.g., because it will decay to a pointer).
4842+
///
4843+
/// \param OverrideExisting Whether to override an existing, locally-specified
4844+
/// nullability specifier rather than complaining about the conflict.
4845+
///
4846+
/// \returns true if nullability cannot be applied, false otherwise.
4847+
bool CheckImplicitNullabilityTypeSpecifier(QualType &Type,
4848+
NullabilityKind Nullability,
4849+
SourceLocation DiagLoc,
4850+
bool AllowArrayTypes,
4851+
bool OverrideExisting);
4852+
48234853
/// Process the attributes before creating an attributed statement. Returns
48244854
/// the semantic attributes that have been processed.
48254855
void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs,

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,7 @@ ParsedTargetAttr AArch64TargetInfo::parseTargetAttr(StringRef Features) const {
10861086
FoundArch = true;
10871087
std::pair<StringRef, StringRef> Split =
10881088
Feature.split("=").second.trim().split("+");
1089-
const std::optional<llvm::AArch64::ArchInfo> AI =
1090-
llvm::AArch64::parseArch(Split.first);
1089+
const llvm::AArch64::ArchInfo *AI = llvm::AArch64::parseArch(Split.first);
10911090

10921091
// Parse the architecture version, adding the required features to
10931092
// Ret.Features.

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
10191019
FAMSize = Builder.CreateIntCast(FAMSize, ResType, IsSigned);
10201020
Value *Res = FAMSize;
10211021

1022-
if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
1022+
if (isa<DeclRefExpr>(Base)) {
10231023
// The whole struct is specificed in the __bdos.
10241024
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(OuterRD);
10251025

0 commit comments

Comments
 (0)