Skip to content

Commit 953acfc

Browse files
committed
Merge branch 'amd-staging' into amd/dev/dhchakra_amdeng/xteam_max_7
2 parents f89244c + 49e9381 commit 953acfc

File tree

184 files changed

+1616
-864
lines changed

Some content is hidden

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

184 files changed

+1616
-864
lines changed

bolt/include/bolt/Passes/DominatorAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class DominatorAnalysis
5454
HasNonDominatedPred = true;
5555
});
5656
if (HasDominatedPred && HasNonDominatedPred)
57-
Result.insert(Candidates.begin(), Candidates.end());
57+
Result.insert_range(Candidates);
5858
if ((*this->getStateAt(ProgramPoint::getLastPointAt(BB)))[DomIdx] &&
5959
BB.succ_begin() == BB.succ_end())
6060
Result.insert(ProgramPoint::getLastPointAt(BB));

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ void BinaryFunction::postProcessJumpTables() {
19971997
bool BinaryFunction::validateExternallyReferencedOffsets() {
19981998
SmallPtrSet<MCSymbol *, 4> JTTargets;
19991999
for (const JumpTable *JT : llvm::make_second_range(JumpTables))
2000-
JTTargets.insert(JT->Entries.begin(), JT->Entries.end());
2000+
JTTargets.insert_range(JT->Entries);
20012001

20022002
bool HasUnclaimedReference = false;
20032003
for (uint64_t Destination : ExternallyReferencedOffsets) {

clang/docs/analyzer/checkers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ pure virtual – but may be still surprising for the programmer.)
610610
void releaseResources() {
611611
// warn: This can call the pure virtual method A::getKind() when this is
612612
// called from the destructor.
613-
callSomeFunction(getKind())
613+
callSomeFunction(getKind());
614614
}
615615
};
616616
@@ -936,7 +936,7 @@ checker does not report them**.
936936
void releaseResources() {
937937
// warn: This can be called within ~A() and calls A::getKind() even if
938938
// we are destructing a class that is derived from A.
939-
callSomeFunction(getKind())
939+
callSomeFunction(getKind());
940940
}
941941
};
942942

clang/include/clang/Basic/TargetInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,7 @@ class TargetInfo : public TransferrableTargetInfo,
11751175
}
11761176
void setRequiresImmediate(llvm::ArrayRef<int> Exacts) {
11771177
Flags |= CI_ImmediateConstant;
1178-
for (int Exact : Exacts)
1179-
ImmSet.insert(Exact);
1178+
ImmSet.insert_range(Exacts);
11801179
}
11811180
void setRequiresImmediate(int Exact) {
11821181
Flags |= CI_ImmediateConstant;

clang/include/clang/Sema/Sema.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14660,7 +14660,8 @@ class Sema final : public SemaBase {
1466014660
bool First = true);
1466114661

1466214662
const NormalizedConstraint *getNormalizedAssociatedConstraints(
14663-
NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
14663+
const NamedDecl *ConstrainedDecl,
14664+
ArrayRef<const Expr *> AssociatedConstraints);
1466414665

1466514666
/// \brief Check whether the given declaration's associated constraints are
1466614667
/// at least as constrained than another declaration's according to the
@@ -14670,28 +14671,30 @@ class Sema final : public SemaBase {
1467014671
/// at least constrained than D2, and false otherwise.
1467114672
///
1467214673
/// \returns true if an error occurred, false otherwise.
14673-
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef<const Expr *> AC1,
14674-
NamedDecl *D2, MutableArrayRef<const Expr *> AC2,
14675-
bool &Result);
14674+
bool IsAtLeastAsConstrained(const NamedDecl *D1,
14675+
MutableArrayRef<const Expr *> AC1,
14676+
const NamedDecl *D2,
14677+
MutableArrayRef<const Expr *> AC2, bool &Result);
1467614678

1467714679
/// If D1 was not at least as constrained as D2, but would've been if a pair
1467814680
/// of atomic constraints involved had been declared in a concept and not
1467914681
/// repeated in two separate places in code.
1468014682
/// \returns true if such a diagnostic was emitted, false otherwise.
1468114683
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(
14682-
NamedDecl *D1, ArrayRef<const Expr *> AC1, NamedDecl *D2,
14684+
const NamedDecl *D1, ArrayRef<const Expr *> AC1, const NamedDecl *D2,
1468314685
ArrayRef<const Expr *> AC2);
1468414686

1468514687
private:
1468614688
/// Caches pairs of template-like decls whose associated constraints were
1468714689
/// checked for subsumption and whether or not the first's constraints did in
1468814690
/// fact subsume the second's.
14689-
llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
14691+
llvm::DenseMap<std::pair<const NamedDecl *, const NamedDecl *>, bool>
14692+
SubsumptionCache;
1469014693
/// Caches the normalized associated constraints of declarations (concepts or
1469114694
/// constrained declarations). If an error occurred while normalizing the
1469214695
/// associated constraints of the template or concept, nullptr will be cached
1469314696
/// here.
14694-
llvm::DenseMap<NamedDecl *, NormalizedConstraint *> NormalizationCache;
14697+
llvm::DenseMap<const NamedDecl *, NormalizedConstraint *> NormalizationCache;
1469514698

1469614699
llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
1469714700
SatisfactionCache;

clang/include/clang/Sema/SemaConcept.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ enum { ConstraintAlignment = 8 };
3131

3232
struct alignas(ConstraintAlignment) AtomicConstraint {
3333
const Expr *ConstraintExpr;
34-
NamedDecl *ConstraintDecl;
34+
const NamedDecl *ConstraintDecl;
3535
std::optional<ArrayRef<TemplateArgumentLoc>> ParameterMapping;
3636

37-
AtomicConstraint(const Expr *ConstraintExpr, NamedDecl *ConstraintDecl)
37+
AtomicConstraint(const Expr *ConstraintExpr, const NamedDecl *ConstraintDecl)
3838
: ConstraintExpr(ConstraintExpr), ConstraintDecl(ConstraintDecl) {};
3939

4040
bool hasMatchingParameterMapping(ASTContext &C,
@@ -114,9 +114,9 @@ struct NormalizedConstraint {
114114

115115
private:
116116
static std::optional<NormalizedConstraint>
117-
fromConstraintExprs(Sema &S, NamedDecl *D, ArrayRef<const Expr *> E);
117+
fromConstraintExprs(Sema &S, const NamedDecl *D, ArrayRef<const Expr *> E);
118118
static std::optional<NormalizedConstraint>
119-
fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E);
119+
fromConstraintExpr(Sema &S, const NamedDecl *D, const Expr *E);
120120
};
121121

122122
struct alignas(ConstraintAlignment) NormalizedConstraintPair {
@@ -137,7 +137,7 @@ struct alignas(ConstraintAlignment) FoldExpandedConstraint {
137137
};
138138

139139
const NormalizedConstraint *getNormalizedAssociatedConstraints(
140-
Sema &S, NamedDecl *ConstrainedDecl,
140+
Sema &S, const NamedDecl *ConstrainedDecl,
141141
ArrayRef<const Expr *> AssociatedConstraints);
142142

143143
/// \brief SubsumptionChecker establishes subsumption
@@ -149,8 +149,8 @@ class SubsumptionChecker {
149149

150150
SubsumptionChecker(Sema &SemaRef, SubsumptionCallable Callable = {});
151151

152-
std::optional<bool> Subsumes(NamedDecl *DP, ArrayRef<const Expr *> P,
153-
NamedDecl *DQ, ArrayRef<const Expr *> Q);
152+
std::optional<bool> Subsumes(const NamedDecl *DP, ArrayRef<const Expr *> P,
153+
const NamedDecl *DQ, ArrayRef<const Expr *> Q);
154154

155155
bool Subsumes(const NormalizedConstraint *P, const NormalizedConstraint *Q);
156156

clang/lib/AST/ASTContext.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14135,7 +14135,6 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X,
1413514135
CANONICAL_TYPE(IncompleteArray)
1413614136
CANONICAL_TYPE(HLSLAttributedResource)
1413714137
CANONICAL_TYPE(LValueReference)
14138-
CANONICAL_TYPE(MemberPointer)
1413914138
CANONICAL_TYPE(ObjCInterface)
1414014139
CANONICAL_TYPE(ObjCObject)
1414114140
CANONICAL_TYPE(ObjCObjectPointer)
@@ -14313,6 +14312,15 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X,
1431314312
return QualType();
1431414313
return Ctx.getUsingType(CD, Ctx.getQualifiedType(Underlying));
1431514314
}
14315+
case Type::MemberPointer: {
14316+
const auto *PX = cast<MemberPointerType>(X),
14317+
*PY = cast<MemberPointerType>(Y);
14318+
CXXRecordDecl *Cls = PX->getMostRecentCXXRecordDecl();
14319+
assert(Cls == PY->getMostRecentCXXRecordDecl());
14320+
return Ctx.getMemberPointerType(
14321+
::getCommonPointeeType(Ctx, PX, PY),
14322+
::getCommonQualifier(Ctx, PX, PY, /*IsSame=*/false), Cls);
14323+
}
1431614324
case Type::CountAttributed: {
1431714325
const auto *DX = cast<CountAttributedType>(X),
1431814326
*DY = cast<CountAttributedType>(Y);

clang/lib/Sema/SemaConcept.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ static ExprResult calculateConstraintSatisfaction(
453453
Sema::InstantiatingTemplate Inst(
454454
S, AtomicExpr->getBeginLoc(),
455455
Sema::InstantiatingTemplate::ConstraintSubstitution{},
456+
// FIXME: improve const-correctness of InstantiatingTemplate
456457
const_cast<NamedDecl *>(Template), Info,
457458
AtomicExpr->getSourceRange());
458459
if (Inst.isInvalid())
@@ -1435,9 +1436,9 @@ void Sema::DiagnoseUnsatisfiedConstraint(
14351436
}
14361437
}
14371438

1438-
const NormalizedConstraint *
1439-
Sema::getNormalizedAssociatedConstraints(
1440-
NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints) {
1439+
const NormalizedConstraint *Sema::getNormalizedAssociatedConstraints(
1440+
const NamedDecl *ConstrainedDecl,
1441+
ArrayRef<const Expr *> AssociatedConstraints) {
14411442
// In case the ConstrainedDecl comes from modules, it is necessary to use
14421443
// the canonical decl to avoid different atomic constraints with the 'same'
14431444
// declarations.
@@ -1461,7 +1462,7 @@ Sema::getNormalizedAssociatedConstraints(
14611462
}
14621463

14631464
const NormalizedConstraint *clang::getNormalizedAssociatedConstraints(
1464-
Sema &S, NamedDecl *ConstrainedDecl,
1465+
Sema &S, const NamedDecl *ConstrainedDecl,
14651466
ArrayRef<const Expr *> AssociatedConstraints) {
14661467
return S.getNormalizedAssociatedConstraints(ConstrainedDecl,
14671468
AssociatedConstraints);
@@ -1527,7 +1528,8 @@ substituteParameterMappings(Sema &S, NormalizedConstraint &N,
15271528
Sema::InstantiatingTemplate Inst(
15281529
S, InstLocBegin,
15291530
Sema::InstantiatingTemplate::ParameterMappingSubstitution{},
1530-
Atomic.ConstraintDecl, {InstLocBegin, InstLocEnd});
1531+
const_cast<NamedDecl *>(Atomic.ConstraintDecl),
1532+
{InstLocBegin, InstLocEnd});
15311533
if (Inst.isInvalid())
15321534
return true;
15331535
if (S.SubstTemplateArguments(*Atomic.ParameterMapping, MLTAL, SubstArgs))
@@ -1591,7 +1593,7 @@ NormalizedConstraint &NormalizedConstraint::getRHS() const {
15911593
}
15921594

15931595
std::optional<NormalizedConstraint>
1594-
NormalizedConstraint::fromConstraintExprs(Sema &S, NamedDecl *D,
1596+
NormalizedConstraint::fromConstraintExprs(Sema &S, const NamedDecl *D,
15951597
ArrayRef<const Expr *> E) {
15961598
assert(E.size() != 0);
15971599
auto Conjunction = fromConstraintExpr(S, D, E[0]);
@@ -1608,7 +1610,8 @@ NormalizedConstraint::fromConstraintExprs(Sema &S, NamedDecl *D,
16081610
}
16091611

16101612
std::optional<NormalizedConstraint>
1611-
NormalizedConstraint::fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E) {
1613+
NormalizedConstraint::fromConstraintExpr(Sema &S, const NamedDecl *D,
1614+
const Expr *E) {
16121615
assert(E != nullptr);
16131616

16141617
// C++ [temp.constr.normal]p1.1
@@ -1637,8 +1640,9 @@ NormalizedConstraint::fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E) {
16371640
{
16381641
Sema::InstantiatingTemplate Inst(
16391642
S, CSE->getExprLoc(),
1640-
Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
1641-
CSE->getSourceRange());
1643+
Sema::InstantiatingTemplate::ConstraintNormalization{},
1644+
// FIXME: improve const-correctness of InstantiatingTemplate
1645+
const_cast<NamedDecl *>(D), CSE->getSourceRange());
16421646
if (Inst.isInvalid())
16431647
return std::nullopt;
16441648
// C++ [temp.constr.normal]p1.1
@@ -1726,9 +1730,9 @@ bool FoldExpandedConstraint::AreCompatibleForSubsumption(
17261730
return false;
17271731
}
17281732

1729-
bool Sema::IsAtLeastAsConstrained(NamedDecl *D1,
1733+
bool Sema::IsAtLeastAsConstrained(const NamedDecl *D1,
17301734
MutableArrayRef<const Expr *> AC1,
1731-
NamedDecl *D2,
1735+
const NamedDecl *D2,
17321736
MutableArrayRef<const Expr *> AC2,
17331737
bool &Result) {
17341738
#ifndef NDEBUG
@@ -1755,7 +1759,7 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1,
17551759
return false;
17561760
}
17571761

1758-
std::pair<NamedDecl *, NamedDecl *> Key{D1, D2};
1762+
std::pair<const NamedDecl *, const NamedDecl *> Key{D1, D2};
17591763
auto CacheEntry = SubsumptionCache.find(Key);
17601764
if (CacheEntry != SubsumptionCache.end()) {
17611765
Result = CacheEntry->second;
@@ -1789,7 +1793,7 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1,
17891793
}
17901794

17911795
bool Sema::MaybeEmitAmbiguousAtomicConstraintsDiagnostic(
1792-
NamedDecl *D1, ArrayRef<const Expr *> AC1, NamedDecl *D2,
1796+
const NamedDecl *D1, ArrayRef<const Expr *> AC1, const NamedDecl *D2,
17931797
ArrayRef<const Expr *> AC2) {
17941798

17951799
if (isSFINAEContext())
@@ -2055,7 +2059,7 @@ FormulaType SubsumptionChecker::Normalize(const NormalizedConstraint &NC) {
20552059
FormulaType Res;
20562060

20572061
auto Add = [&, this](Clause C) {
2058-
// Sort each clause and remove duplicates for faster comparisons
2062+
// Sort each clause and remove duplicates for faster comparisons.
20592063
llvm::sort(C);
20602064
C.erase(llvm::unique(C), C.end());
20612065
AddUniqueClauseToFormula(Res, std::move(C));
@@ -2102,9 +2106,9 @@ void SubsumptionChecker::AddUniqueClauseToFormula(Formula &F, Clause C) {
21022106
F.push_back(C);
21032107
}
21042108

2105-
std::optional<bool> SubsumptionChecker::Subsumes(NamedDecl *DP,
2109+
std::optional<bool> SubsumptionChecker::Subsumes(const NamedDecl *DP,
21062110
ArrayRef<const Expr *> P,
2107-
NamedDecl *DQ,
2111+
const NamedDecl *DQ,
21082112
ArrayRef<const Expr *> Q) {
21092113
const NormalizedConstraint *PNormalized =
21102114
getNormalizedAssociatedConstraints(SemaRef, DP, P);

clang/test/SemaCXX/sugar-common-types.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,19 @@ namespace arrays {
186186
// expected-error@-1 {{lvalue of type 'const volatile volatile B1[1]' (aka 'const volatile volatile int[1]')}}
187187
} // namespace balanced_qualifiers
188188
} // namespace arrays
189+
190+
namespace member_pointers {
191+
template <class T> struct W {
192+
X1 a;
193+
Y1 b;
194+
};
195+
struct W1 : W<X2> {};
196+
struct W2 : W<Y2> {};
197+
198+
N t1 = 0 ? &W<X2>::a : &W<Y2>::b;
199+
// expected-error@-1 {{rvalue of type 'B1 W<B2>::*'}}
200+
201+
// FIXME: adjusted MemberPointer does not preserve qualifier
202+
N t3 = 0 ? &W1::a : &W2::b;
203+
// expected-error@-1 {{rvalue of type 'B1 W<void>::*'}}
204+
} // namespace member_pointers

libcxx/include/__config

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -363,25 +363,22 @@ typedef __char32_t char32_t;
363363
# endif
364364

365365
# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY))
366-
# define _LIBCPP_DLL_VIS
367366
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
368367
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
369368
# define _LIBCPP_OVERRIDABLE_FUNC_VIS
370369
# define _LIBCPP_EXPORTED_FROM_ABI
371370
# elif defined(_LIBCPP_BUILDING_LIBRARY)
372-
# define _LIBCPP_DLL_VIS __declspec(dllexport)
373371
# if defined(__MINGW32__)
374-
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
372+
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport)
375373
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
376374
# else
377375
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
378-
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
376+
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport)
379377
# endif
380-
# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
378+
# define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport)
381379
# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
382380
# else
383-
# define _LIBCPP_DLL_VIS __declspec(dllimport)
384-
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
381+
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport)
385382
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
386383
# define _LIBCPP_OVERRIDABLE_FUNC_VIS
387384
# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
@@ -1157,8 +1154,8 @@ typedef __char32_t char32_t;
11571154
# define _LIBCPP_USING_IF_EXISTS
11581155
# endif
11591156

1160-
# if __has_attribute(__no_destroy__)
1161-
# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
1157+
# if __has_cpp_attribute(_Clang::__no_destroy__)
1158+
# define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]]
11621159
# else
11631160
# define _LIBCPP_NO_DESTROY
11641161
# endif
@@ -1188,14 +1185,14 @@ typedef __char32_t char32_t;
11881185
# define _LIBCPP_NO_SPECIALIZATIONS
11891186
# endif
11901187

1191-
# if __has_attribute(__standalone_debug__)
1192-
# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__))
1188+
# if __has_cpp_attribute(_Clang::__standalone_debug__)
1189+
# define _LIBCPP_STANDALONE_DEBUG [[_Clang::__standalone_debug__]]
11931190
# else
11941191
# define _LIBCPP_STANDALONE_DEBUG
11951192
# endif
11961193

1197-
# if __has_attribute(__preferred_name__)
1198-
# define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
1194+
# if __has_cpp_attribute(_Clang::__preferred_name__)
1195+
# define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]
11991196
# else
12001197
# define _LIBCPP_PREFERRED_NAME(x)
12011198
# endif

0 commit comments

Comments
 (0)