IR: Add missing null operand to MDSubroutineType

Add missing `nullptr` from `MDSubroutineType`'s operands for
`MDCompositeTypeBase::getIdentifier()` (and add tests for all the other
unused fields).  This highlights just how crazy it is that
`MDSubroutineType` inherits from `MDCompositeTypeBase`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229926 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-02-19 23:25:21 +00:00
parent 953c5c9458
commit aeb422f527
2 changed files with 10 additions and 1 deletions

View File

@ -200,7 +200,7 @@ MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context,
bool ShouldCreate) {
DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray));
Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
TypeArray, nullptr, nullptr};
TypeArray, nullptr, nullptr, nullptr};
DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops);
}

View File

@ -964,6 +964,15 @@ TEST_F(MDSubroutineTypeTest, get) {
TempMDSubroutineType Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
// Test always-empty operands.
EXPECT_EQ(nullptr, N->getScope());
EXPECT_EQ(nullptr, N->getFile());
EXPECT_EQ("", N->getName());
EXPECT_EQ(nullptr, N->getBaseType());
EXPECT_EQ(nullptr, N->getVTableHolder());
EXPECT_EQ(nullptr, N->getTemplateParams());
EXPECT_EQ("", N->getIdentifier());
}
typedef MetadataTest MDFileTest;