summaryrefslogtreecommitdiff
path: root/include/clang/Frontend/ASTUnit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/ASTUnit.h')
-rw-r--r--include/clang/Frontend/ASTUnit.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index cc8d4e6e3e70d..b1cdb46d505bf 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -86,10 +86,10 @@ private:
IntrusiveRefCntPtr<SourceManager> SourceMgr;
std::unique_ptr<HeaderSearch> HeaderInfo;
IntrusiveRefCntPtr<TargetInfo> Target;
- IntrusiveRefCntPtr<Preprocessor> PP;
+ std::shared_ptr<Preprocessor> PP;
IntrusiveRefCntPtr<ASTContext> Ctx;
std::shared_ptr<TargetOptions> TargetOpts;
- IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts;
+ std::shared_ptr<HeaderSearchOptions> HSOpts;
IntrusiveRefCntPtr<ASTReader> Reader;
bool HadModuleLoaderFatalFailure;
@@ -108,8 +108,8 @@ private:
/// Optional owned invocation, just used to make the invocation used in
/// LoadFromCommandLine available.
- IntrusiveRefCntPtr<CompilerInvocation> Invocation;
-
+ std::shared_ptr<CompilerInvocation> Invocation;
+
// OnlyLocalDecls - when true, walking this AST should only visit declarations
// that come from the AST itself, not from included precompiled headers.
// FIXME: This is temporary; eventually, CIndex will always do this.
@@ -358,22 +358,21 @@ public:
}
/// \brief Retrieve the allocator used to cache global code completions.
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+ std::shared_ptr<GlobalCodeCompletionAllocator>
getCachedCompletionAllocator() {
return CachedCompletionAllocator;
}
CodeCompletionTUInfo &getCodeCompletionTUInfo() {
if (!CCTUInfo)
- CCTUInfo.reset(new CodeCompletionTUInfo(
- new GlobalCodeCompletionAllocator));
+ CCTUInfo = llvm::make_unique<CodeCompletionTUInfo>(
+ std::make_shared<GlobalCodeCompletionAllocator>());
return *CCTUInfo;
}
private:
/// \brief Allocator used to store cached code completions.
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
- CachedCompletionAllocator;
+ std::shared_ptr<GlobalCodeCompletionAllocator> CachedCompletionAllocator;
std::unique_ptr<CodeCompletionTUInfo> CCTUInfo;
@@ -496,12 +495,13 @@ public:
const Preprocessor &getPreprocessor() const { return *PP; }
Preprocessor &getPreprocessor() { return *PP; }
+ std::shared_ptr<Preprocessor> getPreprocessorPtr() const { return PP; }
const ASTContext &getASTContext() const { return *Ctx; }
ASTContext &getASTContext() { return *Ctx; }
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
- void setPreprocessor(Preprocessor *pp);
+ void setPreprocessor(std::shared_ptr<Preprocessor> pp);
bool hasSema() const { return (bool)TheSema; }
Sema &getSema() const {
@@ -701,11 +701,11 @@ public:
/// remapped contents of that file.
typedef std::pair<std::string, llvm::MemoryBuffer *> RemappedFile;
- /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
- static ASTUnit *create(CompilerInvocation *CI,
- IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
- bool CaptureDiagnostics,
- bool UserFilesAreVolatile);
+ /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
+ static std::unique_ptr<ASTUnit>
+ create(std::shared_ptr<CompilerInvocation> CI,
+ IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool CaptureDiagnostics,
+ bool UserFilesAreVolatile);
/// \brief Create a ASTUnit from an AST file.
///
@@ -770,7 +770,7 @@ public:
/// created ASTUnit was passed in \p Unit then the caller can check that.
///
static ASTUnit *LoadFromCompilerInvocationAction(
- CompilerInvocation *CI,
+ std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
FrontendAction *Action = nullptr, ASTUnit *Unit = nullptr,
@@ -797,7 +797,7 @@ public:
// FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
// shouldn't need to specify them at construction time.
static std::unique_ptr<ASTUnit> LoadFromCompilerInvocation(
- CompilerInvocation *CI,
+ std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FileManager *FileMgr,
bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,