Skip to content

Commit 86512f1

Browse files
authored
Merge branch 'main' into api-notes-swift-returns-retained
2 parents ae72a86 + 83cb3db commit 86512f1

File tree

7 files changed

+33
-36
lines changed

7 files changed

+33
-36
lines changed

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,7 +4616,7 @@ void ASTDeclReader::UpdateDecl(
46164616
.dyn_cast<FunctionTemplateSpecializationInfo *>())
46174617
FTSInfo->setPointOfInstantiation(POI);
46184618
else
4619-
FD->TemplateOrSpecialization.get<MemberSpecializationInfo *>()
4619+
cast<MemberSpecializationInfo *>(FD->TemplateOrSpecialization)
46204620
->setPointOfInstantiation(POI);
46214621
}
46224622
break;
@@ -4715,8 +4715,8 @@ void ASTDeclReader::UpdateDecl(
47154715

47164716
// FIXME: If we already have a partial specialization set,
47174717
// check that it matches.
4718-
if (!Spec->getSpecializedTemplateOrPartial()
4719-
.is<ClassTemplatePartialSpecializationDecl *>())
4718+
if (!isa<ClassTemplatePartialSpecializationDecl *>(
4719+
Spec->getSpecializedTemplateOrPartial()))
47204720
Spec->setInstantiationOf(PartialSpec, TemplArgList);
47214721
}
47224722
}

clang/lib/Serialization/ASTReaderStmt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,9 @@ void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) {
911911
std::move(*Req), Status, SubstitutedConstraintExpr);
912912
else
913913
R = new (Record.getContext()) concepts::ExprRequirement(
914-
E.get<concepts::Requirement::SubstitutionDiagnostic *>(),
915-
RK == concepts::Requirement::RK_Simple, NoexceptLoc,
916-
std::move(*Req));
914+
cast<concepts::Requirement::SubstitutionDiagnostic *>(E),
915+
RK == concepts::Requirement::RK_Simple, NoexceptLoc,
916+
std::move(*Req));
917917
} break;
918918
case concepts::Requirement::RK_Nested: {
919919
ASTContext &C = Record.getContext();

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4941,7 +4941,7 @@ ASTWriter::WriteAST(llvm::PointerUnion<Sema *, Preprocessor *> Subject,
49414941

49424942
Sema *SemaPtr = Subject.dyn_cast<Sema *>();
49434943
Preprocessor &PPRef =
4944-
SemaPtr ? SemaPtr->getPreprocessor() : *Subject.get<Preprocessor *>();
4944+
SemaPtr ? SemaPtr->getPreprocessor() : *cast<Preprocessor *>(Subject);
49454945

49464946
ASTHasCompilerErrors = PPRef.getDiagnostics().hasUncompilableErrorOccurred();
49474947

clang/lib/Serialization/ASTWriterDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
16561656
// so as to simplify memory allocation during deserialization.
16571657
Record.push_back(D->NumTPLists);
16581658
VisitDecl(D);
1659-
bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1659+
bool hasFriendDecl = isa<NamedDecl *>(D->Friend);
16601660
Record.push_back(hasFriendDecl);
16611661
if (hasFriendDecl)
16621662
Record.AddDeclRef(D->getFriendDecl());
@@ -1757,7 +1757,7 @@ void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
17571757
if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
17581758
Record.AddDeclRef(InstFromD);
17591759
} else {
1760-
Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1760+
Record.AddDeclRef(cast<ClassTemplatePartialSpecializationDecl *>(InstFrom));
17611761
Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
17621762
}
17631763

@@ -1835,7 +1835,7 @@ void ASTDeclWriter::VisitVarTemplateSpecializationDecl(
18351835
if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
18361836
Record.AddDeclRef(InstFromD);
18371837
} else {
1838-
Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1838+
Record.AddDeclRef(cast<VarTemplatePartialSpecializationDecl *>(InstFrom));
18391839
Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
18401840
}
18411841

clang/lib/Serialization/ASTWriterStmt.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ addConstraintSatisfaction(ASTRecordWriter &Record,
480480
if (E)
481481
Record.AddStmt(E);
482482
else {
483-
auto *Diag = DetailRecord.get<std::pair<SourceLocation, StringRef> *>();
483+
auto *Diag = cast<std::pair<SourceLocation, StringRef> *>(DetailRecord);
484484
Record.AddSourceLocation(Diag->first);
485485
Record.AddString(Diag->second);
486486
}
@@ -532,10 +532,11 @@ void ASTStmtWriter::VisitRequiresExpr(RequiresExpr *E) {
532532
Record.push_back(ExprReq->getKind());
533533
Record.push_back(ExprReq->Status);
534534
if (ExprReq->isExprSubstitutionFailure()) {
535-
addSubstitutionDiagnostic(Record,
536-
ExprReq->Value.get<concepts::Requirement::SubstitutionDiagnostic *>());
535+
addSubstitutionDiagnostic(
536+
Record, cast<concepts::Requirement::SubstitutionDiagnostic *>(
537+
ExprReq->Value));
537538
} else
538-
Record.AddStmt(ExprReq->Value.get<Expr *>());
539+
Record.AddStmt(cast<Expr *>(ExprReq->Value));
539540
if (ExprReq->getKind() == concepts::Requirement::RK_Compound) {
540541
Record.AddSourceLocation(ExprReq->NoexceptLoc);
541542
const auto &RetReq = ExprReq->getReturnTypeRequirement();
@@ -1166,7 +1167,7 @@ void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
11661167
Record.AddStmt(E->getSyntacticForm());
11671168
Record.AddSourceLocation(E->getLBraceLoc());
11681169
Record.AddSourceLocation(E->getRBraceLoc());
1169-
bool isArrayFiller = E->ArrayFillerOrUnionFieldInit.is<Expr*>();
1170+
bool isArrayFiller = isa<Expr *>(E->ArrayFillerOrUnionFieldInit);
11701171
Record.push_back(isArrayFiller);
11711172
if (isArrayFiller)
11721173
Record.AddStmt(E->getArrayFiller());

llvm/unittests/ProfileData/MemProfTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ MATCHER_P4(FrameContains, FunctionName, LineOffset, Column, Inline, "") {
123123
}
124124

125125
TEST(MemProf, FillsValue) {
126-
std::unique_ptr<MockSymbolizer> Symbolizer(new MockSymbolizer());
126+
auto Symbolizer = std::make_unique<MockSymbolizer>();
127127

128128
EXPECT_CALL(*Symbolizer, symbolizeInlinedCode(SectionedAddress{0x1000},
129129
specifier(), false))
@@ -341,7 +341,7 @@ TEST(MemProf, RecordSerializationRoundTripVersion2HotColdSchema) {
341341
}
342342

343343
TEST(MemProf, SymbolizationFilter) {
344-
std::unique_ptr<MockSymbolizer> Symbolizer(new MockSymbolizer());
344+
auto Symbolizer = std::make_unique<MockSymbolizer>();
345345

346346
EXPECT_CALL(*Symbolizer, symbolizeInlinedCode(SectionedAddress{0x1000},
347347
specifier(), false))

llvm/unittests/Transforms/Instrumentation/MemProfUseTest.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include "gmock/gmock.h"
2222
#include "gtest/gtest.h"
2323

24+
namespace llvm {
25+
namespace memprof {
2426
namespace {
25-
using namespace llvm;
26-
using namespace llvm::memprof;
2727
using testing::Contains;
2828
using testing::ElementsAre;
2929
using testing::Pair;
@@ -315,15 +315,12 @@ MemInfoBlock makePartialMIB() {
315315
}
316316

317317
IndexedMemProfRecord
318-
makeRecordV2(std::initializer_list<::llvm::memprof::CallStackId> AllocFrames,
319-
std::initializer_list<::llvm::memprof::CallStackId> CallSiteFrames,
320-
const MemInfoBlock &Block, const memprof::MemProfSchema &Schema) {
321-
llvm::memprof::IndexedMemProfRecord MR;
322-
for (const auto &CSId : AllocFrames) {
323-
// We don't populate IndexedAllocationInfo::CallStack because we use it only
324-
// in Version1.
318+
makeRecordV2(std::initializer_list<CallStackId> AllocFrames,
319+
std::initializer_list<CallStackId> CallSiteFrames,
320+
const MemInfoBlock &Block, const MemProfSchema &Schema) {
321+
IndexedMemProfRecord MR;
322+
for (const auto &CSId : AllocFrames)
325323
MR.AllocSites.emplace_back(CSId, Block, Schema);
326-
}
327324
for (const auto &CSId : CallSiteFrames)
328325
MR.CallSiteIds.push_back(CSId);
329326
return MR;
@@ -427,17 +424,17 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
427424

428425
const MemInfoBlock MIB = makePartialMIB();
429426

430-
Writer.setMemProfVersionRequested(memprof::Version3);
427+
Writer.setMemProfVersionRequested(Version3);
431428
Writer.setMemProfFullSchema(false);
432429

433430
ASSERT_THAT_ERROR(Writer.mergeProfileKind(InstrProfKind::MemProf),
434431
Succeeded());
435432

436433
const IndexedMemProfRecord IndexedMR = makeRecordV2(
437434
/*AllocFrames=*/{0x111, 0x222, 0x333},
438-
/*CallSiteFrames=*/{}, MIB, memprof::getHotColdSchema());
435+
/*CallSiteFrames=*/{}, MIB, getHotColdSchema());
439436

440-
memprof::IndexedMemProfData MemProfData;
437+
IndexedMemProfData MemProfData;
441438
// The call sites within foo.
442439
MemProfData.Frames.try_emplace(0, GUIDFoo, 1, 8, false);
443440
MemProfData.Frames.try_emplace(1, GUIDFoo, 2, 3, false);
@@ -447,14 +444,11 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
447444
MemProfData.Frames.try_emplace(4, GUIDZzz, 9, 9, false);
448445
MemProfData.Frames.try_emplace(5, GUIDBaz, 9, 9, false);
449446
MemProfData.CallStacks.try_emplace(
450-
0x111,
451-
std::initializer_list<memprof::FrameId>{3, 0}); // bar called by foo
447+
0x111, std::initializer_list<FrameId>{3, 0}); // bar called by foo
452448
MemProfData.CallStacks.try_emplace(
453-
0x222,
454-
std::initializer_list<memprof::FrameId>{4, 1}); // zzz called by foo
449+
0x222, std::initializer_list<FrameId>{4, 1}); // zzz called by foo
455450
MemProfData.CallStacks.try_emplace(
456-
0x333,
457-
std::initializer_list<memprof::FrameId>{5, 2}); // baz called by foo
451+
0x333, std::initializer_list<FrameId>{5, 2}); // baz called by foo
458452
MemProfData.Records.try_emplace(0x9999, IndexedMR);
459453
Writer.addMemProfData(MemProfData, Err);
460454

@@ -488,3 +482,5 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
488482
Pair(LineLocation(3, 3), LineLocation(2, 8))))));
489483
}
490484
} // namespace
485+
} // namespace memprof
486+
} // namespace llvm

0 commit comments

Comments
 (0)