Skip to content

Commit dc97261

Browse files
committed
Merge remote-tracking branch 'origin/main' into jroelofs/lower-matrix-select
2 parents 48bed98 + 766b301 commit dc97261

File tree

36 files changed

+2142
-298
lines changed

36 files changed

+2142
-298
lines changed

bolt/include/bolt/Core/BinaryBasicBlock.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ class BinaryBasicBlock {
5252
uint64_t MispredictedCount; /// number of branches mispredicted
5353

5454
bool operator<(const BinaryBranchInfo &Other) const {
55-
return (Count < Other.Count) ||
56-
(Count == Other.Count &&
57-
MispredictedCount < Other.MispredictedCount);
55+
return std::tie(Count, MispredictedCount) <
56+
std::tie(Other.Count, Other.MispredictedCount);
5857
}
5958
};
6059

bolt/include/bolt/Passes/PAuthGadgetScanner.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ struct MCInstInBFReference {
7777
return BF == RHS.BF && Offset == RHS.Offset;
7878
}
7979
bool operator<(const MCInstInBFReference &RHS) const {
80-
if (BF != RHS.BF)
81-
return BF < RHS.BF;
82-
return Offset < RHS.Offset;
80+
return std::tie(BF, Offset) < std::tie(RHS.BF, RHS.Offset);
8381
}
8482
operator MCInst &() const {
8583
assert(BF != nullptr);

bolt/lib/Profile/YAMLProfileWriter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,8 @@ YAMLProfileWriter::convert(const BinaryFunction &BF, bool UseDFS,
303303
}
304304
// Sort targets in a similar way to getBranchData, see Location::operator<
305305
llvm::sort(CSTargets, [](const auto &RHS, const auto &LHS) {
306-
if (RHS.first != LHS.first)
307-
return RHS.first < LHS.first;
308-
return RHS.second.Offset < LHS.second.Offset;
306+
return std::tie(RHS.first, RHS.second.Offset) <
307+
std::tie(LHS.first, LHS.second.Offset);
309308
});
310309
for (auto &KV : CSTargets)
311310
YamlBB.CallSites.push_back(KV.second);

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ Bug Fixes to C++ Support
840840
- Fixed a pack substitution bug in deducing class template partial specializations. (#GH53609)
841841
- Fixed a crash when constant evaluating some explicit object member assignment operators. (#GH142835)
842842
- Fixed an access checking bug when substituting into concepts (#GH115838)
843+
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
843844

844845
Bug Fixes to AST Handling
845846
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ class IdentifierTable {
731731
/// introduce or modify an identifier. If they called get(), they would
732732
/// likely end up in a recursion.
733733
IdentifierInfo &getOwn(StringRef Name) {
734-
auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first;
734+
auto &Entry = *HashTable.try_emplace(Name).first;
735735

736736
IdentifierInfo *&II = Entry.second;
737737
if (II)

clang/include/clang/ExtractAPI/API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ APISet::createRecord(StringRef USR, StringRef Name,
14991499
CtorArgsContTy &&...CtorArgs) {
15001500
// Ensure USR refers to a String stored in the allocator.
15011501
auto USRString = copyString(USR);
1502-
auto Result = USRBasedLookupTable.insert({USRString, nullptr});
1502+
auto Result = USRBasedLookupTable.try_emplace(USRString);
15031503
RecordTy *Record;
15041504

15051505
// Create the record if it does not already exist

clang/lib/CodeGen/CodeGenTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
726726
auto *MPTy = cast<MemberPointerType>(Ty);
727727
if (!getCXXABI().isMemberPointerConvertible(MPTy)) {
728728
auto *C = MPTy->getMostRecentCXXRecordDecl()->getTypeForDecl();
729-
auto Insertion = RecordsWithOpaqueMemberPointers.insert({C, nullptr});
729+
auto Insertion = RecordsWithOpaqueMemberPointers.try_emplace(C);
730730
if (Insertion.second)
731731
Insertion.first->second = llvm::StructType::create(getLLVMContext());
732732
ResultType = Insertion.first->second;

clang/lib/Sema/SemaOverload.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16981,6 +16981,9 @@ ExprResult Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
1698116981
}
1698216982

1698316983
if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
16984+
if (Found.getAccess() == AS_none) {
16985+
CheckUnresolvedLookupAccess(ULE, Found);
16986+
}
1698416987
// FIXME: avoid copy.
1698516988
TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = nullptr;
1698616989
if (ULE->hasExplicitTemplateArgs()) {

clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ DependencyScanningFilesystemSharedCache::CacheShard::getOrEmplaceEntryForUID(
173173
llvm::sys::fs::UniqueID UID, llvm::vfs::Status Stat,
174174
std::unique_ptr<llvm::MemoryBuffer> Contents) {
175175
std::lock_guard<std::mutex> LockGuard(CacheLock);
176-
auto [It, Inserted] = EntriesByUID.insert({UID, nullptr});
176+
auto [It, Inserted] = EntriesByUID.try_emplace(UID);
177177
auto &CachedEntry = It->getSecond();
178178
if (Inserted) {
179179
CachedFileContents *StoredContents = nullptr;

clang/test/CXX/class.access/p4.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ namespace test0 {
2121
public:
2222
void foo(Public&);
2323
protected:
24-
void foo(Protected&); // expected-note 2 {{declared protected here}}
24+
void foo(Protected&); // expected-note 4 {{declared protected here}}
2525
private:
26-
void foo(Private&); // expected-note 2 {{declared private here}}
26+
void foo(Private&); // expected-note 4 {{declared private here}}
2727
};
2828

29+
class B : public A {};
30+
2931
void test(A *op) {
3032
op->foo(PublicInst);
3133
op->foo(ProtectedInst); // expected-error {{'foo' is a protected member}}
@@ -35,6 +37,16 @@ namespace test0 {
3537
void (A::*b)(Protected&) = &A::foo; // expected-error {{'foo' is a protected member}}
3638
void (A::*c)(Private&) = &A::foo; // expected-error {{'foo' is a private member}}
3739
}
40+
41+
void test(B *op) {
42+
op->foo(PublicInst);
43+
op->foo(ProtectedInst); // expected-error {{'foo' is a protected member}}
44+
op->foo(PrivateInst); // expected-error {{'foo' is a private member}}
45+
46+
void (B::*a)(Public&) = &B::foo;
47+
void (B::*b)(Protected&) = &B::foo; // expected-error {{'foo' is a protected member}}
48+
void (B::*c)(Private&) = &B::foo; // expected-error {{'foo' is a private member}}
49+
}
3850
}
3951

4052
// Member operators.

0 commit comments

Comments
 (0)