diff options
author | Alp Toker <alp@nuanti.com> | 2014-07-06 05:26:07 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-07-06 05:26:07 +0000 |
commit | 269d840e40cdff7ff677fe11361af91e759ac1f1 (patch) | |
tree | 7c90447afa508ee63a7495861ed33deaef4d8d9f | |
parent | 74437975c410b5a1ed1ae8302b9bf4c44b8fac44 (diff) | |
download | bcm5719-llvm-269d840e40cdff7ff677fe11361af91e759ac1f1.tar.gz bcm5719-llvm-269d840e40cdff7ff677fe11361af91e759ac1f1.zip |
Use non-intrusive refcounting for LangOptions
This type is only refcounted in a couple of places so making ownership explicit
improves clarity.
llvm-svn: 212387
-rw-r--r-- | clang/include/clang/Basic/LangOptions.h | 3 | ||||
-rw-r--r-- | clang/include/clang/Frontend/ASTUnit.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInvocation.h | 5 | ||||
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 4 |
4 files changed, 6 insertions, 8 deletions
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index e969161b8ff..9bffc7cb18c 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -19,7 +19,6 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Visibility.h" -#include "llvm/ADT/IntrusiveRefCntPtr.h" #include <string> namespace clang { @@ -53,7 +52,7 @@ protected: /// \brief Keeps track of the various options that can be /// enabled, which controls the dialect of C or C++ that is accepted. -class LangOptions : public RefCountedBase<LangOptions>, public LangOptionsBase { +class LangOptions : public LangOptionsBase { public: typedef clang::Visibility Visibility; diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index d5d6d49bdee..c9ba6d238da 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -83,7 +83,7 @@ public: }; private: - IntrusiveRefCntPtr<LangOptions> LangOpts; + std::shared_ptr<LangOptions> LangOpts; IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; IntrusiveRefCntPtr<FileManager> FileMgr; IntrusiveRefCntPtr<SourceManager> SourceMgr; diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index 4b3b9be55f5..0305d8a9afb 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -52,9 +52,9 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> { void operator=(const CompilerInvocationBase &) LLVM_DELETED_FUNCTION; -protected: +public: /// Options controlling the language variant. - IntrusiveRefCntPtr<LangOptions> LangOpts; + std::shared_ptr<LangOptions> LangOpts; /// Options controlling the target. IntrusiveRefCntPtr<TargetOptions> TargetOpts; @@ -68,7 +68,6 @@ protected: /// Options controlling the preprocessor (aside from \#include handling). IntrusiveRefCntPtr<PreprocessorOptions> PreprocessorOpts; -public: CompilerInvocationBase(); ~CompilerInvocationBase(); diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index be35e31a0b6..15f4ca4b0e8 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -1087,7 +1087,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { "IR inputs not support here!"); // Configure the various subsystems. - LangOpts = &Clang->getLangOpts(); + LangOpts = Clang->getInvocation().LangOpts; FileSystemOpts = Clang->getFileSystemOpts(); IntrusiveRefCntPtr<vfs::FileSystem> VFS = createVFSFromCompilerInvocation(Clang->getInvocation(), getDiagnostics()); @@ -1709,7 +1709,7 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) { // Steal the created target, context, and preprocessor if they have been // created. assert(CI.hasInvocation() && "missing invocation"); - LangOpts = CI.getInvocation().getLangOpts(); + LangOpts = CI.getInvocation().LangOpts; TheSema.reset(CI.takeSema()); Consumer.reset(CI.takeASTConsumer()); if (CI.hasASTContext()) |