mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Convert the diagnostic methods into passes.
Swift SVN r13503
This commit is contained in:
@@ -17,11 +17,14 @@
|
||||
#include "swift/AST/DiagnosticsSIL.h"
|
||||
#include "swift/SIL/SILBuilder.h"
|
||||
#include "swift/SILPasses/Utils/Local.h"
|
||||
#include "swift/SILPasses/Transforms.h"
|
||||
#include "swift/SILPasses/PassManager.h"
|
||||
#include "swift/Basic/Fallthrough.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/ADT/SmallBitVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
||||
using namespace swift;
|
||||
|
||||
STATISTIC(NumAssignRewritten, "Number of assigns rewritten");
|
||||
@@ -1565,3 +1568,27 @@ void swift::performSILDefiniteInitialization(SILModule *M) {
|
||||
DEBUG(Fn.verify());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DefiniteInitialization : public SILFunctionTrans {
|
||||
virtual ~DefiniteInitialization() {}
|
||||
|
||||
/// The entry point to the transformation.
|
||||
virtual void runOnFunction(SILFunction &F, SILPassManager *PM) {
|
||||
|
||||
// Walk through and promote all of the alloc_box's that we can.
|
||||
checkDefiniteInitialization(F);
|
||||
DEBUG(F.verify());
|
||||
|
||||
// Lower raw-sil only instructions used by this pass, like "assign".
|
||||
lowerRawSILOperations(F);
|
||||
DEBUG(F.verify());
|
||||
|
||||
PM->invalidateAllAnalysis(SILAnalysis::IK_All);
|
||||
}
|
||||
};
|
||||
|
||||
SILTransform *swift::createDefiniteInitialization() {
|
||||
return new DefiniteInitialization();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user