Generalize and fix compiler resource freeing before LLVM

Centralize part of the routine that selects which resources to free. Then, add an additional condition for -dump-api-path.

Before, if this option were specified along with -emit-llvm or -c, the compiler would try to rebuild the torn-down ModuleDecl and crash trying to access the torn-down ASTContext.
This commit is contained in:
Robert Widmann
2020-02-27 16:06:47 -08:00
parent 7dd000bdb5
commit a6651a920d
2 changed files with 52 additions and 15 deletions

View File

@@ -625,8 +625,7 @@ public:
/// \param silModule The SIL module that was generated during SILGen.
/// \param stats A stats reporter that will report optimization statistics.
/// \returns true if any errors occurred.
bool performSILProcessing(SILModule *silModule,
UnifiedStatsReporter *stats = nullptr);
bool performSILProcessing(SILModule *silModule);
private:
SourceFile *