diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/Frontend/ASTUnit.h | 5 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 9 | ||||
-rw-r--r-- | clang/include/clang/Lex/Preprocessor.h | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index cc8d4e6e3e7..2dff8455a0c 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -86,7 +86,7 @@ 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; @@ -496,12 +496,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 { diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index c77dc621b0b..1ed6b52b9a7 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -91,7 +91,7 @@ class CompilerInstance : public ModuleLoader { IntrusiveRefCntPtr<SourceManager> SourceMgr; /// The preprocessor. - IntrusiveRefCntPtr<Preprocessor> PP; + std::shared_ptr<Preprocessor> PP; /// The AST context. IntrusiveRefCntPtr<ASTContext> Context; @@ -433,13 +433,14 @@ public: return *PP; } + std::shared_ptr<Preprocessor> getPreprocessorPtr() { return PP; } + void resetAndLeakPreprocessor() { - BuryPointer(PP.get()); - PP.resetWithoutRelease(); + BuryPointer(new std::shared_ptr<Preprocessor>(PP)); } /// Replace the current preprocessor. - void setPreprocessor(Preprocessor *Value); + void setPreprocessor(std::shared_ptr<Preprocessor> Value); /// } /// @name ASTContext diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index c6c4c52be65..7ce1aad36d1 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -94,7 +94,7 @@ enum MacroUse { /// Lexers know only about tokens within a single source file, and don't /// know anything about preprocessor-level issues like the \#include stack, /// token expansion, etc. -class Preprocessor : public RefCountedBase<Preprocessor> { +class Preprocessor { std::shared_ptr<PreprocessorOptions> PPOpts; DiagnosticsEngine *Diags; LangOptions &LangOpts; |