diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-19 16:51:52 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2017-12-19 16:51:52 +0000 |
commit | fcfc7b225ff87f7a479be3ae5714fe828d4159a0 (patch) | |
tree | f3ebdd062a2c72d38d11eb2ea6ed160ec5243e07 /unittests | |
parent | 0dbbce28f92a7a420bcb6861d0778593fcfe0801 (diff) |
[CodeGen] Move printing MO_CFIIndex operands to MachineOperand::print
Work towards the unification of MIR and debug output by refactoring the
interfaces.
Before this patch we printed "<call frame instruction>" in the debug
output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/CodeGen/MachineOperandTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unittests/CodeGen/MachineOperandTest.cpp b/unittests/CodeGen/MachineOperandTest.cpp index e51207b9571..fb43e10742b 100644 --- a/unittests/CodeGen/MachineOperandTest.cpp +++ b/unittests/CodeGen/MachineOperandTest.cpp @@ -336,4 +336,21 @@ TEST(MachineOperandTest, PrintMCSymbol) { ASSERT_TRUE(OS.str() == "<mcsymbol foo>"); } +TEST(MachineOperandTest, PrintCFI) { + // Create a MachineOperand with a CFI index but no function and print it. + MachineOperand MO = MachineOperand::CreateCFIIndex(8); + + // Checking some preconditions on the newly created + // MachineOperand. + ASSERT_TRUE(MO.isCFIIndex()); + ASSERT_TRUE(MO.getCFIIndex() == 8); + + std::string str; + // Print a MachineOperand containing a CFI Index node but no machine function + // attached to it. + raw_string_ostream OS(str); + MO.print(OS, /*TRI=*/nullptr, /*IntrinsicInfo=*/nullptr); + ASSERT_TRUE(OS.str() == "<cfi directive>"); +} + } // end namespace |