[Lldb-commits] [lldb] r291200 - Fixes for Clang API changes to use std::shared_ptr

David Blaikie via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 5 16:38:13 PST 2017


Author: dblaikie
Date: Thu Jan  5 18:38:12 2017
New Revision: 291200

URL: http://llvm.org/viewvc/llvm-project?rev=291200&view=rev
Log:
Fixes for Clang API changes to use std::shared_ptr

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=291200&r1=291199&r2=291200&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Thu Jan  5 18:38:12 2017
@@ -64,10 +64,10 @@ private:
 class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
 public:
   ClangModulesDeclVendorImpl(
-      llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
-      llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
-      std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
-      std::unique_ptr<clang::Parser> &&parser);
+      llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+      std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+      std::unique_ptr<clang::CompilerInstance> compiler_instance,
+      std::unique_ptr<clang::Parser> parser);
 
   ~ClangModulesDeclVendorImpl() override = default;
 
@@ -96,7 +96,7 @@ private:
   bool m_enabled = false;
 
   llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine;
-  llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> m_compiler_invocation;
+  std::shared_ptr<clang::CompilerInvocation> m_compiler_invocation;
   std::unique_ptr<clang::CompilerInstance> m_compiler_instance;
   std::unique_ptr<clang::Parser> m_parser;
   size_t m_source_location_index =
@@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDecl
 ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
 
 ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
-    llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
-    llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
-    std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
-    std::unique_ptr<clang::Parser> &&parser)
-    : ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine),
-      m_compiler_invocation(compiler_invocation),
+    llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+    std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+    std::unique_ptr<clang::CompilerInstance> compiler_instance,
+    std::unique_ptr<clang::Parser> parser)
+    : m_diagnostics_engine(std::move(diagnostics_engine)),
+      m_compiler_invocation(std::move(compiler_invocation)),
       m_compiler_instance(std::move(compiler_instance)),
-      m_parser(std::move(parser)), m_imported_modules() {}
+      m_parser(std::move(parser)) {}
 
 void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
     std::set<ClangModulesDeclVendor::ModuleID> &exports,
@@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &t
     compiler_invocation_argument_cstrs.push_back(arg.c_str());
   }
 
-  llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> invocation(
+  std::shared_ptr<clang::CompilerInvocation> invocation =
       clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs,
-                                             diagnostics_engine));
+                                             diagnostics_engine);
 
   if (!invocation)
     return nullptr;
@@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &t
       new clang::CompilerInstance);
 
   instance->setDiagnostics(diagnostics_engine.get());
-  instance->setInvocation(invocation.get());
+  instance->setInvocation(invocation);
 
   std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
 
@@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &t
   while (!parser->ParseTopLevelDecl(parsed))
     ;
 
-  return new ClangModulesDeclVendorImpl(diagnostics_engine, invocation,
+  return new ClangModulesDeclVendorImpl(std::move(diagnostics_engine),
+                                        std::move(invocation),
                                         std::move(instance), std::move(parser));
 }




More information about the lldb-commits mailing list