llvm.org GIT mirror llvm / 62475af
IR: Canonicalize GenericDwarfNode empty headers to null git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226532 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
2 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
752752 ArrayRef DwarfOps,
753753 StorageType Storage,
754754 bool ShouldCreate) {
755 // Canonicalize empty string to a nullptr.
756 if (Header && Header->getString().empty())
757 Header = nullptr;
758
755759 unsigned Hash = 0;
756760 if (Storage == Uniqued) {
757761 GenericDwarfNodeInfo::KeyTy Key(Tag, Header, DwarfOps);
595595 EXPECT_EQ(N, GenericDwarfNode::get(Context, 15, Header, Ops1));
596596 }
597597
598 TEST_F(GenericDwarfNodeTest, getEmptyHeader) {
599 // Canonicalize !"" to null.
600 auto *Header = MDString::get(Context, "");
601 EXPECT_NE(nullptr, Header);
602 auto *N = GenericDwarfNode::get(Context, 15, Header, None);
603 EXPECT_EQ(nullptr, N->getHeader());
604 }
605
598606 typedef MetadataTest MetadataAsValueTest;
599607
600608 TEST_F(MetadataAsValueTest, MDNode) {