-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[unittests] Use {} instead of std::nullopt to initialize empty ArrayRef #109388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-pgo @llvm/pr-subscribers-llvm-support Author: Jay Foad (jayfoad) ChangesFollow up to #109133. Patch is 56.96 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/109388.diff 16 Files Affected:
diff --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
index 79e27c7ced61fc..3df72ec8115b6a 100644
--- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
+++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
@@ -709,7 +709,7 @@ TEST_F(AArch64SelectionDAGTest, ReplaceAllUsesWith) {
EXPECT_FALSE(DAG->getHeapAllocSite(N2.getNode()));
EXPECT_FALSE(DAG->getNoMergeSiteInfo(N2.getNode()));
EXPECT_FALSE(DAG->getPCSections(N2.getNode()));
- MDNode *MD = MDNode::get(Context, std::nullopt);
+ MDNode *MD = MDNode::get(Context, {});
DAG->addHeapAllocSite(N2.getNode(), MD);
DAG->addNoMergeSiteInfo(N2.getNode(), true);
DAG->addPCSections(N2.getNode(), MD);
diff --git a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
index d5365d9c794925..8f22d097681b1f 100644
--- a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
+++ b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp
@@ -102,8 +102,7 @@ class InstrRefLDVTest : public testing::Test {
OurFile = DIB.createFile("xyzzy.c", "/cave");
OurCU =
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
- auto OurSubT =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
OurFunc =
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
DINode::FlagZero, DISubprogram::SPFlagDefinition);
diff --git a/llvm/unittests/CodeGen/LexicalScopesTest.cpp b/llvm/unittests/CodeGen/LexicalScopesTest.cpp
index 2374ea8a0c1228..03eca7a06faec1 100644
--- a/llvm/unittests/CodeGen/LexicalScopesTest.cpp
+++ b/llvm/unittests/CodeGen/LexicalScopesTest.cpp
@@ -103,8 +103,7 @@ class LexicalScopesTest : public testing::Test {
OurFile = DIB.createFile("xyzzy.c", "/cave");
OurCU =
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
- auto OurSubT =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
OurFunc =
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
DINode::FlagZero, DISubprogram::SPFlagDefinition);
diff --git a/llvm/unittests/CodeGen/MFCommon.inc b/llvm/unittests/CodeGen/MFCommon.inc
index d464a16f636cf5..5d5720c3162da9 100644
--- a/llvm/unittests/CodeGen/MFCommon.inc
+++ b/llvm/unittests/CodeGen/MFCommon.inc
@@ -33,8 +33,8 @@ public:
getCalleeSavedRegs(const MachineFunction *MF) const override {
return nullptr;
}
- ArrayRef<const uint32_t *> getRegMasks() const override { return std::nullopt; }
- ArrayRef<const char *> getRegMaskNames() const override { return std::nullopt; }
+ ArrayRef<const uint32_t *> getRegMasks() const override { return {}; }
+ ArrayRef<const char *> getRegMaskNames() const override { return {}; }
BitVector getReservedRegs(const MachineFunction &MF) const override {
return BitVector();
}
diff --git a/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp b/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp
index 6dece931072960..25d54e8c80eec8 100644
--- a/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp
+++ b/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp
@@ -42,8 +42,7 @@ TEST(FindDebugLocTest, DifferentIterators) {
DIFile *OurFile = DIB.createFile("foo.c", "/bar");
DICompileUnit *OurCU =
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "", false, "", 0);
- auto OurSubT =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
DISubprogram *OurFunc =
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
DINode::FlagZero, DISubprogram::SPFlagDefinition);
diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index d1546cf96f8d76..a3856f4bf9270a 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -276,8 +276,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) {
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
- MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *HAM = MDNode::getDistinct(Ctx, {});
+ MDNode *PCS = MDNode::getDistinct(Ctx, {});
MDNode *MMRA = MMRAMetadata::getTagMD(Ctx, "foo", "bar");
ASSERT_TRUE(MI->memoperands_empty());
@@ -357,8 +357,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) {
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
- MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *HAM = MDNode::getDistinct(Ctx, {});
+ MDNode *PCS = MDNode::getDistinct(Ctx, {});
MDNode *MMRA1 = MMRAMetadata::getTagMD(Ctx, "foo", "bar");
MDNode *MMRA2 = MMRAMetadata::getTagMD(Ctx, "bar", "bux");
@@ -413,8 +413,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
- MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *HAM = MDNode::getDistinct(Ctx, {});
+ MDNode *PCS = MDNode::getDistinct(Ctx, {});
MDNode *MMRA = MDTuple::get(Ctx, {});
@@ -506,8 +506,8 @@ MATCHER_P(HasMIMetadata, MIMD, "") {
TEST(MachineInstrBuilder, BuildMI) {
LLVMContext Ctx;
- MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
- MDNode *DI = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *PCS = MDNode::getDistinct(Ctx, {});
+ MDNode *DI = MDNode::getDistinct(Ctx, {});
DebugLoc DL(DI);
MIMetadata MIMD(DL, PCS);
EXPECT_EQ(MIMD.getDL(), DL);
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index c92a3ff2e7ba6c..5a7fb548e4c231 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -175,8 +175,7 @@ class OpenMPIRBuilderTest : public testing::Test {
std::optional<StringRef>("/src/test.dbg"));
auto CU =
DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
- auto Type =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
auto SP = DIB.createFunction(
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index 9a4d0afbb2d1bc..64e3b9c44cf8bb 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -438,7 +438,7 @@ TEST_F(IRBuilderTest, ConstrainedFPFunctionCall) {
// Now call the empty constrained FP function.
Builder.setIsFPConstrained(true);
Builder.setConstrainedFPFunctionAttr();
- CallInst *FCall = Builder.CreateCall(Callee, std::nullopt);
+ CallInst *FCall = Builder.CreateCall(Callee, {});
// Check the attributes to verify the strictfp attribute is on the call.
EXPECT_TRUE(
@@ -697,24 +697,24 @@ TEST_F(IRBuilderTest, FastMathFlags) {
auto Callee =
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
- FCall = Builder.CreateCall(Callee, std::nullopt);
+ FCall = Builder.CreateCall(Callee, {});
EXPECT_FALSE(FCall->hasNoNaNs());
Function *V =
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
- FCall = Builder.CreateCall(V, std::nullopt);
+ FCall = Builder.CreateCall(V, {});
EXPECT_FALSE(FCall->hasNoNaNs());
FMF.clear();
FMF.setNoNaNs();
Builder.setFastMathFlags(FMF);
- FCall = Builder.CreateCall(Callee, std::nullopt);
+ FCall = Builder.CreateCall(Callee, {});
EXPECT_TRUE(Builder.getFastMathFlags().any());
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
EXPECT_TRUE(FCall->hasNoNaNs());
- FCall = Builder.CreateCall(V, std::nullopt);
+ FCall = Builder.CreateCall(V, {});
EXPECT_TRUE(Builder.getFastMathFlags().any());
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
EXPECT_TRUE(FCall->hasNoNaNs());
@@ -856,7 +856,7 @@ TEST_F(IRBuilderTest, createFunction) {
auto File = DIB.createFile("error.swift", "/");
auto CU =
DIB.createCompileUnit(dwarf::DW_LANG_Swift, File, "swiftc", true, "", 0);
- auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
auto NoErr = DIB.createFunction(
CU, "noerr", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
@@ -896,8 +896,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
DIB.createFile("F.CBL", "/"),
"llvm-cobol74", true, "", 0);
- auto Type =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
auto SP = DIB.createFunction(
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
@@ -1014,7 +1013,7 @@ TEST_F(IRBuilderTest, createArtificialSubprogram) {
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C, File, "clang",
/*isOptimized=*/true, /*Flags=*/"",
/*Runtime Version=*/0);
- auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
auto SP = DIB.createFunction(
CU, "foo", /*LinkageName=*/"", File,
/*LineNo=*/1, Type, /*ScopeLine=*/2, DINode::FlagZero,
@@ -1168,8 +1167,7 @@ TEST_F(IRBuilderTest, DebugLoc) {
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11,
DIB.createFile("tmp.cpp", "/"), "", true, "",
0);
- auto SPType =
- DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
+ auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray({}));
auto SP =
DIB.createFunction(CU, "foo", "foo", File, 1, SPType, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition);
@@ -1183,13 +1181,13 @@ TEST_F(IRBuilderTest, DebugLoc) {
IRBuilder<> Builder(Ctx);
Builder.SetInsertPoint(Br);
EXPECT_EQ(DL1, Builder.getCurrentDebugLocation());
- auto Call1 = Builder.CreateCall(Callee, std::nullopt);
+ auto Call1 = Builder.CreateCall(Callee, {});
EXPECT_EQ(DL1, Call1->getDebugLoc());
Call1->setDebugLoc(DL2);
Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
- auto Call2 = Builder.CreateCall(Callee, std::nullopt);
+ auto Call2 = Builder.CreateCall(Callee, {});
EXPECT_EQ(DL2, Call2->getDebugLoc());
DIB.finalize();
@@ -1202,7 +1200,7 @@ TEST_F(IRBuilderTest, DIImportedEntity) {
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
F, "llvm-cobol74",
true, "", 0);
- MDTuple *Elements = MDTuple::getDistinct(Ctx, std::nullopt);
+ MDTuple *Elements = MDTuple::getDistinct(Ctx, {});
DIB.createImportedDeclaration(CU, nullptr, F, 1);
DIB.createImportedDeclaration(CU, nullptr, F, 1);
diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index 97a5c0a39800b8..481fe96607e48e 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -756,7 +756,7 @@ TEST(InstructionsTest, AlterCallBundles) {
AttrBuilder AB(C);
AB.addAttribute(Attribute::Cold);
Call->setAttributes(AttributeList::get(C, AttributeList::FunctionIndex, AB));
- Call->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
+ Call->setDebugLoc(DebugLoc(MDNode::get(C, {})));
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
std::unique_ptr<CallInst> Clone(CallInst::Create(Call.get(), NewBundle));
@@ -786,7 +786,7 @@ TEST(InstructionsTest, AlterInvokeBundles) {
AB.addAttribute(Attribute::Cold);
Invoke->setAttributes(
AttributeList::get(C, AttributeList::FunctionIndex, AB));
- Invoke->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
+ Invoke->setDebugLoc(DebugLoc(MDNode::get(C, {})));
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
std::unique_ptr<InvokeInst> Clone(
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index e99893498dde58..354e464438762d 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -73,14 +73,14 @@ class MetadataTest : public testing::Test {
Module M;
int Counter;
- MDNode *getNode() { return MDNode::get(Context, std::nullopt); }
+ MDNode *getNode() { return MDNode::get(Context, {}); }
MDNode *getNode(Metadata *MD) { return MDNode::get(Context, MD); }
MDNode *getNode(Metadata *MD1, Metadata *MD2) {
Metadata *MDs[] = {MD1, MD2};
return MDNode::get(Context, MDs);
}
- MDTuple *getTuple() { return MDTuple::getDistinct(Context, std::nullopt); }
+ MDTuple *getTuple() { return MDTuple::getDistinct(Context, {}); }
DISubroutineType *getSubroutineType() {
return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
getNode(nullptr));
@@ -121,7 +121,7 @@ class MetadataTest : public testing::Test {
}
Function *getFunction(StringRef Name) {
return Function::Create(
- FunctionType::get(Type::getVoidTy(Context), std::nullopt, false),
+ FunctionType::get(Type::getVoidTy(Context), {}, false),
Function::ExternalLinkage, Name, M);
}
};
@@ -227,7 +227,7 @@ TEST_F(MDNodeTest, SelfReference) {
// !0 = !{!0}
// !1 = !{!0}
{
- auto Temp = MDNode::getTemporary(Context, std::nullopt);
+ auto Temp = MDNode::getTemporary(Context, {});
Metadata *Args[] = {Temp.get()};
MDNode *Self = MDNode::get(Context, Args);
Self->replaceOperandWith(0, Self);
@@ -245,8 +245,8 @@ TEST_F(MDNodeTest, SelfReference) {
// !0 = !{!0, !{}}
// !1 = !{!0, !{}}
{
- auto Temp = MDNode::getTemporary(Context, std::nullopt);
- Metadata *Args[] = {Temp.get(), MDNode::get(Context, std::nullopt)};
+ auto Temp = MDNode::getTemporary(Context, {});
+ Metadata *Args[] = {Temp.get(), MDNode::get(Context, {})};
MDNode *Self = MDNode::get(Context, Args);
Self->replaceOperandWith(0, Self);
ASSERT_EQ(Self, Self->getOperand(0));
@@ -354,8 +354,8 @@ TEST_F(MDNodeTest, PrintFromFunction) {
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
auto *R0 = ReturnInst::Create(Context, BB0);
auto *R1 = ReturnInst::Create(Context, BB1);
- auto *N0 = MDNode::getDistinct(Context, std::nullopt);
- auto *N1 = MDNode::getDistinct(Context, std::nullopt);
+ auto *N0 = MDNode::getDistinct(Context, {});
+ auto *N1 = MDNode::getDistinct(Context, {});
R0->setMetadata("md", N0);
R1->setMetadata("md", N1);
@@ -380,8 +380,8 @@ TEST_F(MDNodeTest, PrintFromMetadataAsValue) {
auto *F1 = Function::Create(FTy, GlobalValue::ExternalLinkage, "F1", &M);
auto *BB0 = BasicBlock::Create(Context, "entry", F0);
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
- auto *N0 = MDNode::getDistinct(Context, std::nullopt);
- auto *N1 = MDNode::getDistinct(Context, std::nullopt);
+ auto *N0 = MDNode::getDistinct(Context, {});
+ auto *N1 = MDNode::getDistinct(Context, {});
auto *MAV0 = MetadataAsValue::get(Context, N0);
auto *MAV1 = MetadataAsValue::get(Context, N1);
CallInst::Create(Intrinsic, MAV0, "", BB0);
@@ -415,7 +415,7 @@ TEST_F(MDNodeTest, PrintWithDroppedCallOperand) {
CI0->dropAllReferences();
auto *R0 = ReturnInst::Create(Context, BB0);
- auto *N0 = MDNode::getDistinct(Context, std::nullopt);
+ auto *N0 = MDNode::getDistinct(Context, {});
R0->setMetadata("md", N0);
// Printing the metadata node would previously result in a failed assertion
@@ -488,7 +488,7 @@ TEST_F(MDNodeTest, PrintTree) {
TEST_F(MDNodeTest, NullOperand) {
// metadata !{}
- MDNode *Empty = MDNode::get(Context, std::nullopt);
+ MDNode *Empty = MDNode::get(Context, {});
// metadata !{metadata !{}}
Metadata *Ops[] = {Empty};
@@ -508,7 +508,7 @@ TEST_F(MDNodeTest, NullOperand) {
TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
// !{}
- MDNode *Empty = MDNode::get(Context, std::nullopt);
+ MDNode *Empty = MDNode::get(Context, {});
ASSERT_TRUE(Empty->isResolved());
EXPECT_FALSE(Empty->isDistinct());
@@ -535,7 +535,7 @@ TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
TEST_F(MDNodeTest, UniquedOnDeletedOperand) {
// temp !{}
- TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
+ TempMDTuple T = MDTuple::getTemporary(Context, {});
// !{temp !{}}
Metadata *Ops[] = {T.get()};
@@ -569,14 +569,14 @@ TEST_F(MDNodeTest, DistinctOnDeletedValueOperand) {
TEST_F(MDNodeTest, getDistinct) {
// !{}
- MDNode *Empty = MDNode::get(Context, std::nullopt);
+ MDNode *Empty = MDNode::get(Context, {});
ASSERT_TRUE(Empty->isResolved());
ASSERT_FALSE(Empty->isDistinct());
- ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
+ ASSERT_EQ(Empty, MDNode::get(Context, {}));
// distinct !{}
- MDNode *Distinct1 = MDNode::getDistinct(Context, std::nullopt);
- MDNode *Distinct2 = MDNode::getDistinct(Context, std::nullopt);
+ MDNode *Distinct1 = MDNode::getDistinct(Context, {});
+ MDNode *Distinct2 = MDNode::getDistinct(Context, {});
EXPECT_TRUE(Distinct1->isResolved());
EXPECT_TRUE(Distinct2->isDistinct());
EXPECT_NE(Empty, Distinct1);
@@ -584,31 +584,31 @@ TEST_F(MDNodeTest, getDistinct) {
EXPECT_NE(Distinct1, Distinct2);
// !{}
- ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
+ ASSERT_EQ(Empty, MDNode::get(Context, {}));
}
TEST_F(MDNodeTest, isUniqued) {
- MDNode *U = MDTuple::get(Context, std::nullopt);
- MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
- auto T = MDTuple::getTemporary(Context, std::nullopt);
+ MDNode *U = MDTuple::get(Context, {});
+ MDNode *D = MDTuple::getDistinct(Context, {});
+ auto T = MDTuple::getTemporary(Context, {});
EXPECT_TRUE(U->isUniqued());
EXPECT_FALSE(D->isUniqued());
EXPECT_FALSE(T->isUniqued());
}
TEST_F(MDNodeTest, isDistinct) {
- MDNode *U = MDTuple::get(Context, std::nullopt);
- MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
- auto T = MDTuple::getTemporary(Context, std::nullopt);
+ MDNode *U = MDTuple::get(Context, {});
+ MDNode *D = MDTuple::getDistinct(Context, {});
+ auto T = MDTuple::getTemporary(Context, {});
EXPECT_FALSE(U->isDistinct());
EXPECT_TRUE(D->isDistinct());
EXPECT_FALSE(T->isDistinct());
}
TEST_F(MDNodeTest, isTemporary) {
- MDNode *U = MDTuple::get(Context, std::nullopt);
- MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
- auto T = MDTuple::getTemporary(Context, std::nullopt);
+ MDNode *U = MDTuple::get(Context, {});
+ MDNode *D = MDTuple::getDistinct(Context, {});
+ auto T = MDTuple::getTemporary(Context, {});
EXPECT_FALSE(U->isTemporary());
EXPECT_FALSE(D->isTemporary());
EXPECT_TRUE(T->isTemporary());
@@ -616,7 +616,7 @@ TEST_F(MDNodeTest, isTemporary) {
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
// temporary !{}
- auto Temp = MDTuple::getTemporary(Context, std::nullopt);
+ auto Temp = MDTuple::getTemporary(Context, {});
ASSERT_FALSE(Temp->isResolved());
// distinct !{temporary !{}}
@@ -626,17 +626,17 @@ TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
EXPECT_EQ(Temp.get(), Distinct->getOperand(0));
// temporary !{} => !{}
- MDNode *Empty = MDNode::get(Context, std::nullopt);
+ MDNode *Empty = MDNode::get(Context, {});
Temp->replaceAllUsesWith(Empty);
EXPECT_EQ(Empty, Distinc...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/5338 Here is the relevant piece of the build log for the reference
|
Follow up to #109133.