summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-01-07 10:37:57 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-01-07 10:50:59 +0100
commitd364815351a887cbcd4579bc41995f8b2eb185ff (patch)
tree1c471d6fe5f49a5ef2bd702a15992c29e1a5c14a /lldb/source
parentab1bcda851d95aeec03ffc1218bf9cae261a9280 (diff)
downloadbcm5719-llvm-d364815351a887cbcd4579bc41995f8b2eb185ff.tar.gz
bcm5719-llvm-d364815351a887cbcd4579bc41995f8b2eb185ff.zip
[lldb][NFC] Take a llvm::Triple in ClangASTContext constructor
This constructor is supposed to take a string representing an llvm::Triple. We might as well take a llvm::Triple here which saves us all the string conversions in the call sites and we make this more type safe.
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp6
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp4
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp6
4 files changed, 8 insertions, 12 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 0b24188d339..8f263e90d90 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -48,7 +48,7 @@ struct HostInfoBaseFields {
}
llvm::once_flag m_host_triple_once;
- std::string m_host_triple;
+ llvm::Triple m_host_triple;
llvm::once_flag m_host_arch_once;
ArchSpec m_host_arch_32;
@@ -82,10 +82,10 @@ void HostInfoBase::Terminate() {
g_fields = nullptr;
}
-llvm::StringRef HostInfoBase::GetTargetTriple() {
+llvm::Triple HostInfoBase::GetTargetTriple() {
llvm::call_once(g_fields->m_host_triple_once, []() {
g_fields->m_host_triple =
- HostInfo::GetArchitecture().GetTriple().getTriple();
+ HostInfo::GetArchitecture().GetTriple();
});
return g_fields->m_host_triple;
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 29930c303b0..73843063606 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -146,9 +146,7 @@ AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime)
m_ast_ctx(runtime.GetProcess()
->GetTarget()
.GetArchitecture()
- .GetTriple()
- .getTriple()
- .c_str()),
+ .GetTriple()),
m_type_realizer_sp(m_runtime.GetEncodingToType()) {
m_external_source = new AppleObjCExternalASTSource(*this);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> external_source_owning_ptr(
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index d92f782c72e..66f04bef6cb 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -26,9 +26,7 @@ AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
m_scratch_ast_ctx_up.reset(new ClangASTContext(runtime.GetProcess()
->GetTarget()
.GetArchitecture()
- .GetTriple()
- .str()
- .c_str()));
+ .GetTriple()));
}
std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 99299c3c6c4..314aaa83d4e 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -499,9 +499,9 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
Opts.NoInlineDefine = !Opt;
}
-ClangASTContext::ClangASTContext(llvm::StringRef target_triple) {
- if (!target_triple.empty())
- SetTargetTriple(target_triple);
+ClangASTContext::ClangASTContext(llvm::Triple target_triple) {
+ if (!target_triple.str().empty())
+ SetTargetTriple(target_triple.str());
// The caller didn't pass an ASTContext so create a new one for this
// ClangASTContext.
CreateASTContext();
OpenPOWER on IntegriCloud