mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Test] Ensourced ossa-lifetime-completion.
Moved the test next to the code it calls.
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "swift/SIL/OSSALifetimeCompletion.h"
|
||||
#include "swift/SIL/SILBuilder.h"
|
||||
#include "swift/SIL/SILInstruction.h"
|
||||
#include "swift/SIL/Test.h"
|
||||
|
||||
using namespace swift;
|
||||
|
||||
@@ -166,6 +167,22 @@ bool OSSALifetimeCompletion::analyzeAndUpdateLifetime(
|
||||
return changed;
|
||||
}
|
||||
|
||||
namespace swift::test {
|
||||
// Arguments:
|
||||
// - SILValue: value
|
||||
// Dumps:
|
||||
// - function
|
||||
static FunctionTest OSSALifetimeCompletionTest(
|
||||
"ossa-lifetime-completion",
|
||||
[](auto &function, auto &arguments, auto &test) {
|
||||
SILValue value = arguments.takeValue();
|
||||
llvm::dbgs() << "OSSA lifetime completion: " << value;
|
||||
OSSALifetimeCompletion completion(&function, /*domInfo*/ nullptr);
|
||||
completion.completeOSSALifetime(value);
|
||||
function.dump();
|
||||
});
|
||||
} // end namespace swift::test
|
||||
|
||||
// TODO: create a fast check for 'mayEndLifetime(SILInstruction *)'. Verify that
|
||||
// it returns true for every instruction that has a lifetime-ending operand.
|
||||
void UnreachableLifetimeCompletion::visitUnreachableInst(
|
||||
|
||||
Reference in New Issue
Block a user