mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user