diff options
| -rw-r--r-- | lldb/include/lldb/Symbol/ClangASTContext.h | 3 | ||||
| -rw-r--r-- | lldb/source/Expression/ClangExpressionParser.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 9 |
3 files changed, 7 insertions, 11 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index d2712e5f06d..6797ba23db8 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -71,8 +71,7 @@ public: clang::DiagnosticConsumer * getDiagnosticConsumer(); - clang::TargetOptions * - getTargetOptions(); + std::shared_ptr<clang::TargetOptions> &getTargetOptions(); clang::TargetInfo * getTargetInfo(); diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index e5046a7d6bb..0b6d952b76b 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -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. diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 07accbf54d3..19835a3b575 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -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; } |

