Skip to content

Commit 9c43261

Browse files
committed
LLVMLoopAnalyzer: Fix null variable test case for variableTypeChanges()
1 parent 5b0c770 commit 9c43261

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/llvm/loop_analyzer/variabletypechanges_test.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ TEST(LLVMLoopAnalyzer_VariableTypeChanges, NullParams)
1717
TEST(LLVMLoopAnalyzer_VariableTypeChanges, NullVariable)
1818
{
1919
LLVMLoopAnalyzer analyzer;
20+
LLVMInstructionList list;
2021

21-
LLVMInstruction funcCall(LLVMInstruction::Type::FunctionCall, nullptr, false);
22-
LLVMInstruction end(LLVMInstruction::Type::EndLoop, nullptr, false);
23-
funcCall.next = &end;
24-
end.previous = &funcCall;
22+
auto start = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginRepeatLoop, nullptr, false);
23+
list.addInstruction(start);
24+
25+
auto funcCall = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::FunctionCall, nullptr, false);
26+
list.addInstruction(funcCall);
27+
28+
auto end = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::EndLoop, nullptr, false);
29+
list.addInstruction(end);
2530

26-
ASSERT_FALSE(analyzer.variableTypeChanges(nullptr, &funcCall, Compiler::StaticType::Number));
31+
ASSERT_FALSE(analyzer.variableTypeChanges(nullptr, start.get(), Compiler::StaticType::Number));
2732
}
2833

2934
TEST(LLVMLoopAnalyzer_VariableTypeChanges, NullLoopBody)

0 commit comments

Comments
 (0)