Skip to content

Commit bddc946

Browse files
committed
[Test] Ensourced is-lexical.
Moved the test next to the code it calls.
1 parent ad9fee2 commit bddc946

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

lib/SIL/IR/SILValue.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "swift/SIL/SILInstruction.h"
1818
#include "swift/SIL/SILModule.h"
1919
#include "swift/SIL/SILVisitor.h"
20+
#include "swift/SIL/Test.h"
2021
#include "llvm/ADT/StringSwitch.h"
2122

2223
using namespace swift;
@@ -154,6 +155,23 @@ bool ValueBase::isLexical() const {
154155
return false;
155156
}
156157

158+
namespace swift::test {
159+
// Arguments:
160+
// - value
161+
// Dumps:
162+
// - value
163+
// - whether it's lexical
164+
static FunctionTest IsLexicalTest("is-lexical", [](auto &function,
165+
auto &arguments,
166+
auto &test) {
167+
auto value = arguments.takeValue();
168+
auto isLexical = value->isLexical();
169+
value->dump();
170+
auto *boolString = isLexical ? "true" : "false";
171+
llvm::errs() << boolString << "\n";
172+
});
173+
} // end namespace swift::test
174+
157175
bool ValueBase::isGuaranteedForwarding() const {
158176
if (getOwnershipKind() != OwnershipKind::Guaranteed) {
159177
return false;

lib/SILOptimizer/UtilityPasses/TestRunner.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -311,21 +311,6 @@ static FunctionTest FieldSensitiveMultiDefUseLiveRangeTest(
311311
boundary.print(llvm::errs());
312312
});
313313

314-
// Arguments:
315-
// - value
316-
// Dumps:
317-
// - value
318-
// - whether it's lexical
319-
static FunctionTest IsLexicalTest("is-lexical", [](auto &function,
320-
auto &arguments,
321-
auto &test) {
322-
auto value = arguments.takeValue();
323-
auto isLexical = value->isLexical();
324-
value->dump();
325-
auto *boolString = isLexical ? "true" : "false";
326-
llvm::errs() << boolString << "\n";
327-
});
328-
329314
// Arguments:
330315
// - SILValue: phi
331316
// Dumps:

0 commit comments

Comments
 (0)