Skip to content

Commit 47e231a

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents 9cc1545 + d3d2ea6 commit 47e231a

File tree

119 files changed

+3560
-592
lines changed

Some content is hidden

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

119 files changed

+3560
-592
lines changed

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ getNewFieldsOrder(const RecordDecl *Definition,
7070
}
7171
SmallVector<unsigned, 4> NewFieldsOrder;
7272
for (const auto &Name : DesiredFieldsOrder) {
73-
if (!NameToIndex.count(Name)) {
73+
auto It = NameToIndex.find(Name);
74+
if (It == NameToIndex.end()) {
7475
llvm::errs() << "Field " << Name << " not found in definition.\n";
7576
return {};
7677
}
77-
NewFieldsOrder.push_back(NameToIndex[Name]);
78+
NewFieldsOrder.push_back(It->second);
7879
}
7980
assert(NewFieldsOrder.size() == NameToIndex.size());
8081
return NewFieldsOrder;

clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,12 @@ void NonConstParameterCheck::addParm(const ParmVarDecl *Parm) {
119119
T->getPointeeType()->isFloatingType()))
120120
return;
121121

122-
if (Parameters.find(Parm) != Parameters.end())
122+
auto [It, Inserted] = Parameters.try_emplace(Parm);
123+
if (!Inserted)
123124
return;
124125

125-
ParmInfo PI;
126-
PI.IsReferenced = false;
127-
PI.CanBeConst = true;
128-
Parameters[Parm] = PI;
126+
It->second.IsReferenced = false;
127+
It->second.CanBeConst = true;
129128
}
130129

131130
void NonConstParameterCheck::setReferenced(const DeclRefExpr *Ref) {

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ LoongArch Support
217217
RISC-V Support
218218
^^^^^^^^^^^^^^
219219

220+
- Add support for `-mtune=generic-ooo` (a generic out-of-order model).
221+
220222
CUDA/HIP Language Changes
221223
^^^^^^^^^^^^^^^^^^^^^^^^^
222224

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,14 @@ def __nvvm_redux_sync_umax : NVPTXBuiltinSMAndPTX<"unsigned int(unsigned int, in
669669
def __nvvm_redux_sync_and : NVPTXBuiltinSMAndPTX<"int(int, int)", SM_80, PTX70>;
670670
def __nvvm_redux_sync_xor : NVPTXBuiltinSMAndPTX<"int(int, int)", SM_80, PTX70>;
671671
def __nvvm_redux_sync_or : NVPTXBuiltinSMAndPTX<"int(int, int)", SM_80, PTX70>;
672+
def __nvvm_redux_sync_fmin : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
673+
def __nvvm_redux_sync_fmin_abs : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
674+
def __nvvm_redux_sync_fmin_NaN : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
675+
def __nvvm_redux_sync_fmin_abs_NaN : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
676+
def __nvvm_redux_sync_fmax : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
677+
def __nvvm_redux_sync_fmax_abs : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
678+
def __nvvm_redux_sync_fmax_NaN : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
679+
def __nvvm_redux_sync_fmax_abs_NaN : NVPTXBuiltinSMAndPTX<"float(float, int)", SM_100a, PTX86>;
672680

673681
// Membar
674682

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7495,7 +7495,7 @@ class MappableExprsHandler {
74957495
// Update info about the lowest and highest elements for this struct
74967496
if (!PartialStruct.Base.isValid()) {
74977497
PartialStruct.LowestElem = {FieldIndex, LowestElem};
7498-
if (IsFinalArraySection) {
7498+
if (IsFinalArraySection && OASE) {
74997499
Address HB =
75007500
CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false)
75017501
.getAddress();
@@ -7508,7 +7508,7 @@ class MappableExprsHandler {
75087508
} else if (FieldIndex < PartialStruct.LowestElem.first) {
75097509
PartialStruct.LowestElem = {FieldIndex, LowestElem};
75107510
} else if (FieldIndex > PartialStruct.HighestElem.first) {
7511-
if (IsFinalArraySection) {
7511+
if (IsFinalArraySection && OASE) {
75127512
Address HB =
75137513
CGF.EmitArraySectionExpr(OASE, /*IsLowerBound=*/false)
75147514
.getAddress();

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ class LineJoiner {
366366
// instead of TheLine->First.
367367

368368
if (Style.AllowShortNamespacesOnASingleLine &&
369-
TheLine->First->is(tok::kw_namespace) &&
370-
TheLine->Last->is(tok::l_brace)) {
369+
TheLine->First->is(tok::kw_namespace)) {
371370
const auto result = tryMergeNamespace(I, E, Limit);
372371
if (result > 0)
373372
return result;
@@ -633,24 +632,37 @@ class LineJoiner {
633632
if (Limit == 0)
634633
return 0;
635634

636-
assert(I[1]);
637-
const auto &L1 = *I[1];
635+
// The merging code is relative to the opening namespace brace, which could
636+
// be either on the first or second line due to the brace wrapping rules.
637+
const bool OpenBraceWrapped = Style.BraceWrapping.AfterNamespace;
638+
const auto *BraceOpenLine = I + OpenBraceWrapped;
639+
640+
assert(*BraceOpenLine);
641+
if (BraceOpenLine[0]->Last->isNot(TT_NamespaceLBrace))
642+
return 0;
643+
644+
if (std::distance(BraceOpenLine, E) <= 2)
645+
return 0;
646+
647+
if (BraceOpenLine[0]->Last->is(tok::comment))
648+
return 0;
649+
650+
assert(BraceOpenLine[1]);
651+
const auto &L1 = *BraceOpenLine[1];
638652
if (L1.InPPDirective != (*I)->InPPDirective ||
639653
(L1.InPPDirective && L1.First->HasUnescapedNewline)) {
640654
return 0;
641655
}
642656

643-
if (std::distance(I, E) <= 2)
644-
return 0;
645-
646-
assert(I[2]);
647-
const auto &L2 = *I[2];
657+
assert(BraceOpenLine[2]);
658+
const auto &L2 = *BraceOpenLine[2];
648659
if (L2.Type == LT_Invalid)
649660
return 0;
650661

651662
Limit = limitConsideringMacros(I + 1, E, Limit);
652663

653-
if (!nextTwoLinesFitInto(I, Limit))
664+
const auto LinesToBeMerged = OpenBraceWrapped + 2;
665+
if (!nextNLinesFitInto(I, I + LinesToBeMerged, Limit))
654666
return 0;
655667

656668
// Check if it's a namespace inside a namespace, and call recursively if so.
@@ -661,17 +673,19 @@ class LineJoiner {
661673

662674
assert(Limit >= L1.Last->TotalLength + 3);
663675
const auto InnerLimit = Limit - L1.Last->TotalLength - 3;
664-
const auto MergedLines = tryMergeNamespace(I + 1, E, InnerLimit);
676+
const auto MergedLines =
677+
tryMergeNamespace(BraceOpenLine + 1, E, InnerLimit);
665678
if (MergedLines == 0)
666679
return 0;
667-
const auto N = MergedLines + 2;
680+
const auto N = MergedLines + LinesToBeMerged;
668681
// Check if there is even a line after the inner result.
669682
if (std::distance(I, E) <= N)
670683
return 0;
671684
// Check that the line after the inner result starts with a closing brace
672685
// which we are permitted to merge into one line.
673-
if (I[N]->First->is(tok::r_brace) && !I[N]->First->MustBreakBefore &&
674-
I[MergedLines + 1]->Last->isNot(tok::comment) &&
686+
if (I[N]->First->is(TT_NamespaceRBrace) &&
687+
!I[N]->First->MustBreakBefore &&
688+
BraceOpenLine[MergedLines + 1]->Last->isNot(tok::comment) &&
675689
nextNLinesFitInto(I, I + N + 1, Limit)) {
676690
return N;
677691
}
@@ -686,11 +700,11 @@ class LineJoiner {
686700
return 0;
687701

688702
// Last, check that the third line starts with a closing brace.
689-
if (L2.First->isNot(tok::r_brace) || L2.First->MustBreakBefore)
703+
if (L2.First->isNot(TT_NamespaceRBrace) || L2.First->MustBreakBefore)
690704
return 0;
691705

692-
// If so, merge all three lines.
693-
return 2;
706+
// If so, merge all lines.
707+
return LinesToBeMerged;
694708
}
695709

696710
unsigned

clang/lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6024,7 +6024,7 @@ Parser::DeclGroupPtrTy Parser::ParseTopLevelStmtDecl() {
60246024
TopLevelStmtDecl *TLSD = Actions.ActOnStartTopLevelStmtDecl(getCurScope());
60256025
StmtResult R = ParseStatementOrDeclaration(Stmts, SubStmtCtx);
60266026
if (!R.isUsable())
6027-
return nullptr;
6027+
R = Actions.ActOnNullStmt(Tok.getLocation());
60286028

60296029
Actions.ActOnFinishTopLevelStmtDecl(TLSD, R.get());
60306030

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4905,7 +4905,7 @@ bool Sema::CheckTemplateTypeArgument(
49054905
[[fallthrough]];
49064906
}
49074907
default: {
4908-
// We allow instantiateing a template with template argument packs when
4908+
// We allow instantiating a template with template argument packs when
49094909
// building deduction guides.
49104910
if (Arg.getKind() == TemplateArgument::Pack &&
49114911
CodeSynthesisContexts.back().Kind ==

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,18 @@ namespace {
14661466
}
14671467
}
14681468

1469+
static TemplateArgument
1470+
getTemplateArgumentPackPatternForRewrite(const TemplateArgument &TA) {
1471+
if (TA.getKind() != TemplateArgument::Pack)
1472+
return TA;
1473+
assert(TA.pack_size() == 1 &&
1474+
"unexpected pack arguments in template rewrite");
1475+
TemplateArgument Arg = *TA.pack_begin();
1476+
if (Arg.isPackExpansion())
1477+
Arg = Arg.getPackExpansionPattern();
1478+
return Arg;
1479+
}
1480+
14691481
/// Transform the given declaration by instantiating a reference to
14701482
/// this declaration.
14711483
Decl *TransformDecl(SourceLocation Loc, Decl *D);
@@ -1627,7 +1639,7 @@ namespace {
16271639
TemplateArgumentLoc Input = SemaRef.getTrivialTemplateArgumentLoc(
16281640
pack, QualType(), SourceLocation{});
16291641
TemplateArgumentLoc Output;
1630-
if (SemaRef.SubstTemplateArgument(Input, TemplateArgs, Output))
1642+
if (TransformTemplateArgument(Input, Output, Uneval))
16311643
return true; // fails
16321644
TArgs.push_back(Output.getArgument());
16331645
}
@@ -2040,11 +2052,7 @@ TemplateName TemplateInstantiator::TransformTemplateName(
20402052
if (TemplateArgs.isRewrite()) {
20412053
// We're rewriting the template parameter as a reference to another
20422054
// template parameter.
2043-
if (Arg.getKind() == TemplateArgument::Pack) {
2044-
assert(Arg.pack_size() == 1 && Arg.pack_begin()->isPackExpansion() &&
2045-
"unexpected pack arguments in template rewrite");
2046-
Arg = Arg.pack_begin()->getPackExpansionPattern();
2047-
}
2055+
Arg = getTemplateArgumentPackPatternForRewrite(Arg);
20482056
assert(Arg.getKind() == TemplateArgument::Template &&
20492057
"unexpected nontype template argument kind in template rewrite");
20502058
return Arg.getAsTemplate();
@@ -2125,11 +2133,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
21252133
if (TemplateArgs.isRewrite()) {
21262134
// We're rewriting the template parameter as a reference to another
21272135
// template parameter.
2128-
if (Arg.getKind() == TemplateArgument::Pack) {
2129-
assert(Arg.pack_size() == 1 && Arg.pack_begin()->isPackExpansion() &&
2130-
"unexpected pack arguments in template rewrite");
2131-
Arg = Arg.pack_begin()->getPackExpansionPattern();
2132-
}
2136+
Arg = getTemplateArgumentPackPatternForRewrite(Arg);
21332137
assert(Arg.getKind() == TemplateArgument::Expression &&
21342138
"unexpected nontype template argument kind in template rewrite");
21352139
// FIXME: This can lead to the same subexpression appearing multiple times
@@ -2591,11 +2595,7 @@ TemplateInstantiator::TransformTemplateTypeParmType(TypeLocBuilder &TLB,
25912595
if (TemplateArgs.isRewrite()) {
25922596
// We're rewriting the template parameter as a reference to another
25932597
// template parameter.
2594-
if (Arg.getKind() == TemplateArgument::Pack) {
2595-
assert(Arg.pack_size() == 1 && Arg.pack_begin()->isPackExpansion() &&
2596-
"unexpected pack arguments in template rewrite");
2597-
Arg = Arg.pack_begin()->getPackExpansionPattern();
2598-
}
2598+
Arg = getTemplateArgumentPackPatternForRewrite(Arg);
25992599
assert(Arg.getKind() == TemplateArgument::Type &&
26002600
"unexpected nontype template argument kind in template rewrite");
26012601
QualType NewT = Arg.getAsType();

clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE,
314314
RegionArgIsBad = true;
315315
}
316316

317+
assert(ArgSM);
317318
// Is the argument to the call being tracked?
318319
const AllocationState *AS = State->get<AllocatedData>(ArgSM);
319320
if (!AS)

0 commit comments

Comments
 (0)