aboutsummaryrefslogtreecommitdiff
path: root/backend/unittests/CodeGen/MachineFrameInfoTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/unittests/CodeGen/MachineFrameInfoTest.cpp')
-rw-r--r--backend/unittests/CodeGen/MachineFrameInfoTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/unittests/CodeGen/MachineFrameInfoTest.cpp b/backend/unittests/CodeGen/MachineFrameInfoTest.cpp
index 7368815..c9289c7 100644
--- a/backend/unittests/CodeGen/MachineFrameInfoTest.cpp
+++ b/backend/unittests/CodeGen/MachineFrameInfoTest.cpp
@@ -2,8 +2,11 @@
#include "rcc/CodeGen/MachineFrameInfo.h"
+#include "rcc/CodeGen/MachineDebugInfo.h"
+
#include <cstdint>
#include <iostream>
+#include <optional>
#include <string_view>
namespace {
@@ -130,6 +133,22 @@ void testInvalidDescriptions(TestContext &Context) {
Context.expect(!Frame.createObject(InvalidLifetime),
"stack object lifetime must reject equal boundaries");
+ auto InvalidDebugInfo = fixedObject(8, 8);
+ InvalidDebugInfo.DebugInfo.emplace();
+ Context.expect(!Frame.createObject(InvalidDebugInfo),
+ "stack object debug information must not be structurally empty");
+
+ auto DebugObject = fixedObject(8, 8);
+ DebugObject.DebugInfo = rcc::MachineVariableDebugInfo{
+ .Variable = rcc::MachineMetadataReference::embeddedIR(1),
+ .Expression = rcc::MachineMetadataValue::expression(rcc::MachineDIExpression{}),
+ .Location = std::nullopt,
+ };
+ auto DebugIndex = Frame.createObject(DebugObject);
+ Context.expect(DebugIndex.has_value() &&
+ Frame.object(*DebugIndex)->description()->DebugInfo == DebugObject.DebugInfo,
+ "stack object debug information must remain structured");
+
Context.expect(!rcc::StackID::targetStack(4), "target stack IDs must not overlap built-in IDs");
auto TargetStack = rcc::StackID::targetStack(256);
auto Target = fixedObject(8, 8);