[arc-codemotion] Do not call virtual methods in constructors.

Moved the setting to the run section of arc-code motion.

In this case I think it is safe to do this, but calling a virtual function is
generally a code smell, so no reason to keep it in the code base unless we need
to.

Caught by the clang static analyzer.
This commit is contained in:
Michael Gottesman
2018-06-10 22:12:13 -07:00
parent 8f6028d215
commit f1533db0e3

View File

@@ -242,6 +242,8 @@ public:
};
bool CodeMotionContext::run() {
MultiIteration = requireIteration();
// Initialize the data flow.
initializeCodeMotionDataFlow();
@@ -332,9 +334,7 @@ public:
RetainCodeMotionContext(llvm::SpecificBumpPtrAllocator<BlockState> &BPA,
SILFunction *F, PostOrderFunctionInfo *PO,
AliasAnalysis *AA, RCIdentityFunctionInfo *RCFI)
: CodeMotionContext(BPA, F, PO, AA, RCFI) {
MultiIteration = requireIteration();
}
: CodeMotionContext(BPA, F, PO, AA, RCFI) {}
/// virtual destructor.
~RetainCodeMotionContext() override {}
@@ -684,10 +684,8 @@ public:
AliasAnalysis *AA, RCIdentityFunctionInfo *RCFI,
bool FreezeEpilogueReleases,
ConsumedArgToEpilogueReleaseMatcher &ERM)
: CodeMotionContext(BPA, F, PO, AA, RCFI),
FreezeEpilogueReleases(FreezeEpilogueReleases), ERM(ERM) {
MultiIteration = requireIteration();
}
: CodeMotionContext(BPA, F, PO, AA, RCFI),
FreezeEpilogueReleases(FreezeEpilogueReleases), ERM(ERM) {}
/// virtual destructor.
~ReleaseCodeMotionContext() override {}