aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-21 18:40:17 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-21 18:40:17 +0000
commit4f32786ac45210143654390177105eb749b614e9 (patch)
tree289b0c67da849bf045e5c03605f9fbfc80c23d01 /lib/Frontend/CompilerInstance.cpp
parentcd1eecfe4f43a542c8f9a6e7d12fa69b28c23a67 (diff)
Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index b47da312a1..26d40e4f80 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -47,7 +47,7 @@ CompilerInstance::~CompilerInstance() {
}
void CompilerInstance::setInvocation(CompilerInvocation *Value) {
- Invocation.reset(Value);
+ Invocation = Value;
}
void CompilerInstance::setDiagnostics(Diagnostic *Value) {
@@ -55,24 +55,20 @@ void CompilerInstance::setDiagnostics(Diagnostic *Value) {
}
void CompilerInstance::setTarget(TargetInfo *Value) {
- Target.reset(Value);
+ Target = Value;
}
void CompilerInstance::setFileManager(FileManager *Value) {
- FileMgr.reset(Value);
+ FileMgr = Value;
}
-void CompilerInstance::setSourceManager(SourceManager *Value) {
- SourceMgr.reset(Value);
+void CompilerInstance::setSourceManager(SourceManager *Value) {
+ SourceMgr = Value;
}
-void CompilerInstance::setPreprocessor(Preprocessor *Value) {
- PP.reset(Value);
-}
+void CompilerInstance::setPreprocessor(Preprocessor *Value) { PP = Value; }
-void CompilerInstance::setASTContext(ASTContext *Value) {
- Context.reset(Value);
-}
+void CompilerInstance::setASTContext(ASTContext *Value) { Context = Value; }
void CompilerInstance::setSema(Sema *S) {
TheSema.reset(S);
@@ -145,23 +141,23 @@ CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
// File Manager
void CompilerInstance::createFileManager() {
- FileMgr.reset(new FileManager(getFileSystemOpts()));
+ FileMgr = new FileManager(getFileSystemOpts());
}
// Source Manager
void CompilerInstance::createSourceManager(FileManager &FileMgr) {
- SourceMgr.reset(new SourceManager(getDiagnostics(), FileMgr));
+ SourceMgr = new SourceManager(getDiagnostics(), FileMgr);
}
// Preprocessor
void CompilerInstance::createPreprocessor() {
- PP.reset(createPreprocessor(getDiagnostics(), getLangOpts(),
- getPreprocessorOpts(), getHeaderSearchOpts(),
- getDependencyOutputOpts(), getTarget(),
- getFrontendOpts(), getSourceManager(),
- getFileManager()));
+ PP = createPreprocessor(getDiagnostics(), getLangOpts(),
+ getPreprocessorOpts(), getHeaderSearchOpts(),
+ getDependencyOutputOpts(), getTarget(),
+ getFrontendOpts(), getSourceManager(),
+ getFileManager());
}
Preprocessor *
@@ -219,10 +215,10 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
void CompilerInstance::createASTContext() {
Preprocessor &PP = getPreprocessor();
- Context.reset(new ASTContext(getLangOpts(), PP.getSourceManager(),
- getTarget(), PP.getIdentifierTable(),
- PP.getSelectorTable(), PP.getBuiltinInfo(),
- /*size_reserve=*/ 0));
+ Context = new ASTContext(getLangOpts(), PP.getSourceManager(),
+ getTarget(), PP.getIdentifierTable(),
+ PP.getSelectorTable(), PP.getBuiltinInfo(),
+ /*size_reserve=*/ 0);
}
// ExternalASTSource