summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-01-08 09:02:55 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-01-08 09:35:46 +0100
commit0a4daff6e26f276dd92e777b597e94e093ae018d (patch)
tree1bfdd8443d335c57d0682217d07dbfd0bd4f6451 /lldb/source
parenta1857e2ce35e749e16d092305f53c0f2bf2e9c7b (diff)
downloadbcm5719-llvm-0a4daff6e26f276dd92e777b597e94e093ae018d.tar.gz
bcm5719-llvm-0a4daff6e26f276dd92e777b597e94e093ae018d.zip
[lldb][NFC] Remove redundant ClangASTContext constructor that takes ArchSpec
ArchSpec has a superset of the information of llvm::Triple but the ClangASTContext just uses the Triple part of it. This deletes the ArchSpec constructor and all the code creating ArchSpecs and instead just uses the llvm::Triple constructor for ClangASTContext.
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 314aaa83d4e..c846e410acf 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -507,13 +507,6 @@ ClangASTContext::ClangASTContext(llvm::Triple target_triple) {
CreateASTContext();
}
-ClangASTContext::ClangASTContext(ArchSpec arch) {
- SetTargetTriple(arch.GetTriple().str());
- // The caller didn't pass an ASTContext so create a new one for this
- // ClangASTContext.
- CreateASTContext();
-}
-
ClangASTContext::ClangASTContext(ASTContext &existing_ctxt) {
SetTargetTriple(existing_ctxt.getTargetInfo().getTriple().str());
@@ -548,29 +541,25 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
if (!arch.IsValid())
return lldb::TypeSystemSP();
- ArchSpec fixed_arch = arch;
+ llvm::Triple triple = arch.GetTriple();
// LLVM wants this to be set to iOS or MacOSX; if we're working on
// a bare-boards type image, change the triple for llvm's benefit.
- if (fixed_arch.GetTriple().getVendor() == llvm::Triple::Apple &&
- fixed_arch.GetTriple().getOS() == llvm::Triple::UnknownOS) {
- if (fixed_arch.GetTriple().getArch() == llvm::Triple::arm ||
- fixed_arch.GetTriple().getArch() == llvm::Triple::aarch64 ||
- fixed_arch.GetTriple().getArch() == llvm::Triple::aarch64_32 ||
- fixed_arch.GetTriple().getArch() == llvm::Triple::thumb) {
- fixed_arch.GetTriple().setOS(llvm::Triple::IOS);
+ if (triple.getVendor() == llvm::Triple::Apple &&
+ triple.getOS() == llvm::Triple::UnknownOS) {
+ if (triple.getArch() == llvm::Triple::arm ||
+ triple.getArch() == llvm::Triple::aarch64 ||
+ triple.getArch() == llvm::Triple::aarch64_32 ||
+ triple.getArch() == llvm::Triple::thumb) {
+ triple.setOS(llvm::Triple::IOS);
} else {
- fixed_arch.GetTriple().setOS(llvm::Triple::MacOSX);
+ triple.setOS(llvm::Triple::MacOSX);
}
}
- if (module) {
- std::shared_ptr<ClangASTContext> ast_sp(new ClangASTContext(fixed_arch));
- return ast_sp;
- } else if (target && target->IsValid()) {
- std::shared_ptr<ClangASTContextForExpressions> ast_sp(
- new ClangASTContextForExpressions(*target, fixed_arch));
- return ast_sp;
- }
+ if (module)
+ return std::make_shared<ClangASTContext>(triple);
+ else if (target && target->IsValid())
+ return std::make_shared<ClangASTContextForExpressions>(*target, triple);
return lldb::TypeSystemSP();
}
@@ -9255,9 +9244,9 @@ ClangASTContext::DeclContextGetClangASTContext(const CompilerDeclContext &dc) {
return nullptr;
}
-ClangASTContextForExpressions::ClangASTContextForExpressions(Target &target,
- ArchSpec arch)
- : ClangASTContext(arch), m_target_wp(target.shared_from_this()),
+ClangASTContextForExpressions::ClangASTContextForExpressions(
+ Target &target, llvm::Triple triple)
+ : ClangASTContext(triple), m_target_wp(target.shared_from_this()),
m_persistent_variables(new ClangPersistentVariables) {
m_scratch_ast_source_up.reset(new ClangASTSource(
target.shared_from_this(), target.GetClangASTImporter()));
OpenPOWER on IntegriCloud