mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
AsmWriter: Handle broken metadata nodes
Print out temporary `MDNode`s so we don't crash in the verifier (or during `dump()` output). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -251,6 +251,22 @@ TEST_F(MDNodeTest, Print) {
|
||||
EXPECT_EQ(Expected_, Actual_); \
|
||||
} while (false)
|
||||
|
||||
TEST_F(MDNodeTest, PrintTemporary) {
|
||||
MDNode *Arg = getNode();
|
||||
TempMDNode Temp = MDNode::getTemporary(Context, Arg);
|
||||
MDNode *N = getNode(Temp.get());
|
||||
Module M("test", Context);
|
||||
NamedMDNode *NMD = M.getOrInsertNamedMetadata("named");
|
||||
NMD->addOperand(N);
|
||||
|
||||
EXPECT_PRINTER_EQ("!0 = !{!1}", N->print(OS, &M));
|
||||
EXPECT_PRINTER_EQ("!1 = <temporary!> !{!2}", Temp->print(OS, &M));
|
||||
EXPECT_PRINTER_EQ("!2 = !{}", Arg->print(OS, &M));
|
||||
|
||||
// Cleanup.
|
||||
Temp->replaceAllUsesWith(Arg);
|
||||
}
|
||||
|
||||
TEST_F(MDNodeTest, PrintFromModule) {
|
||||
Constant *C = ConstantInt::get(Type::getInt32Ty(Context), 7);
|
||||
MDString *S = MDString::get(Context, "foo");
|
||||
|
Reference in New Issue
Block a user