diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/Frontend/ASTUnit.h | 27 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInvocation.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/Utils.h | 6 | ||||
-rw-r--r-- | clang/include/clang/Sema/CodeCompleteConsumer.h | 17 | ||||
-rw-r--r-- | clang/include/clang/Tooling/Tooling.h | 8 |
6 files changed, 34 insertions, 30 deletions
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index b1cdb46d505..65841d70821 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -108,8 +108,8 @@ private: /// Optional owned invocation, just used to make the invocation used in /// LoadFromCommandLine available. - std::shared_ptr<CompilerInvocation> Invocation; - + IntrusiveRefCntPtr<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,21 +358,22 @@ public: } /// \brief Retrieve the allocator used to cache global code completions. - std::shared_ptr<GlobalCodeCompletionAllocator> + IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> getCachedCompletionAllocator() { return CachedCompletionAllocator; } CodeCompletionTUInfo &getCodeCompletionTUInfo() { if (!CCTUInfo) - CCTUInfo = llvm::make_unique<CodeCompletionTUInfo>( - std::make_shared<GlobalCodeCompletionAllocator>()); + CCTUInfo.reset(new CodeCompletionTUInfo( + new GlobalCodeCompletionAllocator)); return *CCTUInfo; } private: /// \brief Allocator used to store cached code completions. - std::shared_ptr<GlobalCodeCompletionAllocator> CachedCompletionAllocator; + IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> + CachedCompletionAllocator; std::unique_ptr<CodeCompletionTUInfo> CCTUInfo; @@ -701,11 +702,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 std::unique_ptr<ASTUnit> - create(std::shared_ptr<CompilerInvocation> CI, - IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool CaptureDiagnostics, - bool UserFilesAreVolatile); + /// \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 from an AST file. /// @@ -770,7 +771,7 @@ public: /// created ASTUnit was passed in \p Unit then the caller can check that. /// static ASTUnit *LoadFromCompilerInvocationAction( - std::shared_ptr<CompilerInvocation> CI, + CompilerInvocation *CI, std::shared_ptr<PCHContainerOperations> PCHContainerOps, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FrontendAction *Action = nullptr, ASTUnit *Unit = nullptr, @@ -797,7 +798,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( - std::shared_ptr<CompilerInvocation> CI, + CompilerInvocation *CI, std::shared_ptr<PCHContainerOperations> PCHContainerOps, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FileManager *FileMgr, bool OnlyLocalDecls = false, bool CaptureDiagnostics = false, diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 3ebbc61515c..b8fd6cc1259 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -70,7 +70,7 @@ class TargetInfo; /// and a long form that takes explicit instances of any required objects. class CompilerInstance : public ModuleLoader { /// The options used in this compiler instance. - std::shared_ptr<CompilerInvocation> Invocation; + IntrusiveRefCntPtr<CompilerInvocation> Invocation; /// The diagnostics engine instance. IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; @@ -228,7 +228,7 @@ public: } /// setInvocation - Replace the current invocation. - void setInvocation(std::shared_ptr<CompilerInvocation> Value); + void setInvocation(CompilerInvocation *Value); /// \brief Indicates whether we should (re)build the global module index. bool shouldBuildGlobalModuleIndex() const; diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index cef7f73ecaa..939ff3cc9f0 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -51,7 +51,7 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, bool DefaultDiagColor = true, bool DefaultShowOpt = true); -class CompilerInvocationBase { +class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> { void operator=(const CompilerInvocationBase &) = delete; public: diff --git a/clang/include/clang/Frontend/Utils.h b/clang/include/clang/Frontend/Utils.h index 0ee46846c80..60419ff9b41 100644 --- a/clang/include/clang/Frontend/Utils.h +++ b/clang/include/clang/Frontend/Utils.h @@ -184,10 +184,10 @@ createChainedIncludesSource(CompilerInstance &CI, /// /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. -std::unique_ptr<CompilerInvocation> +CompilerInvocation * createInvocationFromCommandLine(ArrayRef<const char *> Args, - IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - IntrusiveRefCntPtr<DiagnosticsEngine>()); + IntrusiveRefCntPtr<DiagnosticsEngine> Diags = + IntrusiveRefCntPtr<DiagnosticsEngine>()); /// Return the value of the last argument as an integer, or a default. If Diags /// is non-null, emits an error if the argument is given, but non-integral. diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index dee53dc14a8..b80924ea11f 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -509,18 +509,23 @@ public: }; /// \brief Allocator for a cached set of global code completions. -class GlobalCodeCompletionAllocator : public CodeCompletionAllocator {}; +class GlobalCodeCompletionAllocator + : public CodeCompletionAllocator, + public RefCountedBase<GlobalCodeCompletionAllocator> +{ + +}; class CodeCompletionTUInfo { llvm::DenseMap<const DeclContext *, StringRef> ParentNames; - std::shared_ptr<GlobalCodeCompletionAllocator> AllocatorRef; + IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> AllocatorRef; public: explicit CodeCompletionTUInfo( - std::shared_ptr<GlobalCodeCompletionAllocator> Allocator) + IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> Allocator) : AllocatorRef(std::move(Allocator)) {} - std::shared_ptr<GlobalCodeCompletionAllocator> getAllocatorRef() const { + IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> getAllocatorRef() const { return AllocatorRef; } CodeCompletionAllocator &getAllocator() const { @@ -960,8 +965,8 @@ public: /// results to the given raw output stream. PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts, raw_ostream &OS) - : CodeCompleteConsumer(CodeCompleteOpts, false), OS(OS), - CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()) {} + : CodeCompleteConsumer(CodeCompleteOpts, false), OS(OS), + CCTUInfo(new GlobalCodeCompletionAllocator) {} /// \brief Prints the finalized code-completion results. void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h index 10e26ac25d1..ca232f40983 100644 --- a/clang/include/clang/Tooling/Tooling.h +++ b/clang/include/clang/Tooling/Tooling.h @@ -69,8 +69,7 @@ public: /// \brief Perform an action for an invocation. virtual bool - runInvocation(std::shared_ptr<clang::CompilerInvocation> Invocation, - FileManager *Files, + runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files, std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagConsumer) = 0; }; @@ -86,8 +85,7 @@ public: ~FrontendActionFactory() override; /// \brief Invokes the compiler with a FrontendAction created by create(). - bool runInvocation(std::shared_ptr<clang::CompilerInvocation> Invocation, - FileManager *Files, + bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files, std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagConsumer) override; @@ -263,7 +261,7 @@ public: bool runInvocation(const char *BinaryName, clang::driver::Compilation *Compilation, - std::shared_ptr<clang::CompilerInvocation> Invocation, + clang::CompilerInvocation *Invocation, std::shared_ptr<PCHContainerOperations> PCHContainerOps); std::vector<std::string> CommandLine; |