Moved the target specific ClangASTContext initialization over into ClangASTContext::CreateInstance.
This involved changing the TypeSystem::CreateInstance to take a module or a target. This allows type systems to create an AST for modules (no expression support needed) or targets (expression support is needed) and return the correct class instance for both cases.
llvm-svn: 249747
diff --git a/lldb/source/Symbol/GoASTContext.cpp b/lldb/source/Symbol/GoASTContext.cpp
index 6568b12..8946aaa 100644
--- a/lldb/source/Symbol/GoASTContext.cpp
+++ b/lldb/source/Symbol/GoASTContext.cpp
@@ -22,6 +22,7 @@
#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserGo.h"
@@ -321,10 +322,16 @@
}
lldb::TypeSystemSP
-GoASTContext::CreateInstance (lldb::LanguageType language, const lldb_private::ArchSpec &arch)
+GoASTContext::CreateInstance (lldb::LanguageType language, Module *module, Target *target)
{
if (language == eLanguageTypeGo)
{
+ ArchSpec arch;
+ if (module)
+ arch = module->GetArchitecture();
+ else if (target)
+ arch = target->GetArchitecture();
+
if (arch.IsValid())
{
std::shared_ptr<GoASTContext> go_ast_sp(new GoASTContext);