Track changes from clang r212388
authorAlp Toker <alp@nuanti.com>
Sun, 6 Jul 2014 05:36:57 +0000 (05:36 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 6 Jul 2014 05:36:57 +0000 (05:36 +0000)
llvm-svn: 212391

lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Expression/ClangExpressionParser.cpp
lldb/source/Symbol/ClangASTContext.cpp

index d2712e5..6797ba2 100644 (file)
@@ -71,8 +71,7 @@ public:
     clang::DiagnosticConsumer *
     getDiagnosticConsumer();
 
-    clang::TargetOptions *
-    getTargetOptions();
+    std::shared_ptr<clang::TargetOptions> &getTargetOptions();
 
     clang::TargetInfo *
     getTargetInfo();
index e5046a7..0b6d952 100644 (file)
@@ -154,9 +154,9 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
     m_compiler->createDiagnostics();
 
     // Create the target instance.
-    m_compiler->setTarget(TargetInfo::CreateTargetInfo(m_compiler->getDiagnostics(),
-                                                       &m_compiler->getTargetOpts()));
-    
+    m_compiler->setTarget(TargetInfo::CreateTargetInfo(
+        m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts));
+
     assert (m_compiler->hasTarget());
     
     // 3. Set options.
index 07accbf..19835a3 100644 (file)
@@ -499,17 +499,14 @@ ClangASTContext::getDiagnosticConsumer()
     return m_diagnostic_consumer_ap.get();
 }
 
-TargetOptions *
-ClangASTContext::getTargetOptions()
-{
+std::shared_ptr<TargetOptions> &ClangASTContext::getTargetOptions() {
     if (m_target_options_rp.get() == nullptr && !m_target_triple.empty())
     {
-        m_target_options_rp.reset ();
-        m_target_options_rp = new TargetOptions();
+        m_target_options_rp = std::make_shared<TargetOptions>();
         if (m_target_options_rp.get() != nullptr)
             m_target_options_rp->Triple = m_target_triple;
     }
-    return m_target_options_rp.get();
+    return m_target_options_rp;
 }