// FrontendAction.
CI.clearOutputFiles(/*EraseFiles=*/shouldEraseOutputFiles());
- // FIXME: Only do this if DisableFree is set.
if (isCurrentFileAST()) {
- CI.resetAndLeakSema();
- CI.resetAndLeakASTContext();
- CI.resetAndLeakPreprocessor();
- CI.resetAndLeakSourceManager();
- CI.resetAndLeakFileManager();
+ if (DisableFree) {
+ CI.resetAndLeakSema();
+ CI.resetAndLeakASTContext();
+ CI.resetAndLeakPreprocessor();
+ CI.resetAndLeakSourceManager();
+ CI.resetAndLeakFileManager();
+ } else {
+ CI.setSema(nullptr);
+ CI.setASTContext(nullptr);
+ CI.setPreprocessor(nullptr);
+ CI.setSourceManager(nullptr);
+ CI.setFileManager(nullptr);
+ }
}
setCompilerInstance(nullptr);