summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionParser.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-02-15 21:59:32 +0000
committerGreg Clayton <gclayton@apple.com>2011-02-15 21:59:32 +0000
commit514487e80609921f8451a80965f65c3defbce725 (patch)
tree424c18a67cc664a7d276846b6d84a575f23c99f2 /lldb/source/Expression/ClangExpressionParser.cpp
parent41febc658b62f15983301ebff759c99909f2ecbf (diff)
downloadbcm5719-llvm-514487e80609921f8451a80965f65c3defbce725.tar.gz
bcm5719-llvm-514487e80609921f8451a80965f65c3defbce725.zip
Made lldb_private::ArchSpec contain much more than just an architecture. It
now, in addition to cpu type/subtype and architecture flavor, contains: - byte order (big endian, little endian) - address size in bytes - llvm::Triple for true target triple support and for more powerful plug-in selection. llvm-svn: 125602
Diffstat (limited to 'lldb/source/Expression/ClangExpressionParser.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionParser.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index 29d3c3e8441..8f27c5982c5 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -178,11 +178,9 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
// Implementation of ClangExpressionParser
//===----------------------------------------------------------------------===//
-ClangExpressionParser::ClangExpressionParser(const char *target_triple,
- Process *process,
- ClangExpression &expr) :
- m_expr(expr),
- m_target_triple (),
+ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
+ ClangExpression &expr) :
+ m_expr (expr),
m_compiler (),
m_code_generator (NULL),
m_execution_engine (),
@@ -195,12 +193,7 @@ ClangExpressionParser::ClangExpressionParser(const char *target_triple,
llvm::InitializeAllAsmPrinters();
}
} InitializeLLVM;
-
- if (target_triple && target_triple[0])
- m_target_triple = target_triple;
- else
- m_target_triple = llvm::sys::getHostTriple();
-
+
// 1. Create a new compiler instance.
m_compiler.reset(new CompilerInstance());
m_compiler->setLLVMContext(new LLVMContext());
@@ -215,6 +208,10 @@ ClangExpressionParser::ClangExpressionParser(const char *target_triple,
m_compiler->getLangOpts().ObjC1 = true;
m_compiler->getLangOpts().ObjC2 = true;
+ Process *process = NULL;
+ if (exe_scope)
+ process = exe_scope->CalculateProcess();
+
if (process)
{
if (process->GetObjCLanguageRuntime())
@@ -239,7 +236,19 @@ ClangExpressionParser::ClangExpressionParser(const char *target_triple,
m_compiler->getDiagnosticOpts().Warnings.push_back("no-unused-value");
// Set the target triple.
- m_compiler->getTargetOpts().Triple = m_target_triple;
+ Target *target = NULL;
+ if (exe_scope)
+ target = exe_scope->CalculateTarget();
+
+ // TODO: figure out what to really do when we don't have a valid target.
+ // Sometimes this will be ok to just use the host target triple (when we
+ // evaluate say "2+3", but other expressions like breakpoint conditions
+ // and other things that _are_ target specific really shouldn't just be
+ // using the host triple. This needs to be fixed in a better way.
+ if (target && target->GetArchitecture().IsValid())
+ m_compiler->getTargetOpts().Triple = target->GetArchitecture().GetTriple().str();
+ else
+ m_compiler->getTargetOpts().Triple = llvm::sys::getHostTriple();
// 3. Set up various important bits of infrastructure.
m_compiler->createDiagnostics(0, 0);
OpenPOWER on IntegriCloud