mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-06 09:44:39 +00:00
IR: Canonicalize GenericDwarfNode empty headers to null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c10ef2df5c
commit
62475afaf2
@ -753,6 +753,10 @@ GenericDwarfNode *GenericDwarfNode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
ArrayRef<Metadata *> DwarfOps,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
// Canonicalize empty string to a nullptr.
|
||||
if (Header && Header->getString().empty())
|
||||
Header = nullptr;
|
||||
|
||||
unsigned Hash = 0;
|
||||
if (Storage == Uniqued) {
|
||||
GenericDwarfNodeInfo::KeyTy Key(Tag, Header, DwarfOps);
|
||||
|
@ -596,6 +596,14 @@ TEST_F(GenericDwarfNodeTest, get) {
|
||||
EXPECT_EQ(N, GenericDwarfNode::get(Context, 15, Header, Ops1));
|
||||
}
|
||||
|
||||
TEST_F(GenericDwarfNodeTest, getEmptyHeader) {
|
||||
// Canonicalize !"" to null.
|
||||
auto *Header = MDString::get(Context, "");
|
||||
EXPECT_NE(nullptr, Header);
|
||||
auto *N = GenericDwarfNode::get(Context, 15, Header, None);
|
||||
EXPECT_EQ(nullptr, N->getHeader());
|
||||
}
|
||||
|
||||
typedef MetadataTest MetadataAsValueTest;
|
||||
|
||||
TEST_F(MetadataAsValueTest, MDNode) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user