Refactor the code that erases sil functions into a new method, eraseFunction, and remember to clean the function table.

Swift SVN r11999
This commit is contained in:
Nadav Rotem
2014-01-07 18:18:10 +00:00
parent 301b9a6aa4
commit c391e8162e
2 changed files with 8 additions and 2 deletions

View File

@@ -157,6 +157,12 @@ public:
return Types.getTypeLowering(t);
}
/// Erase a function from the module.
void eraseFunction(SILFunction *F) {
getFunctionList().erase(F);
FunctionTable.erase(F->getName());
}
/// Construct a SIL module from an AST module.
///
/// The module will be constructed in the Raw stage. The provided AST module

View File

@@ -786,7 +786,7 @@ bool tryToRemoveFunction(SILFunction *F) {
return false;
DEBUG(llvm::dbgs() << "SC: Erasing:" << F->getName() << "\n");
F->getModule().getFunctionList().erase(F);
F->getModule().eraseFunction(F);
NumDeadFunc++;
return true;
}