Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/source/Expression/ClangExpressionParser.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope, | ||||
// TODO: figure out what to really do when we don't have a valid target. | // 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 | // Sometimes this will be ok to just use the host target triple (when we | ||||
// evaluate say "2+3", but other expressions like breakpoint conditions | // evaluate say "2+3", but other expressions like breakpoint conditions | ||||
// and other things that _are_ target specific really shouldn't just be | // 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. | // using the host triple. This needs to be fixed in a better way. | ||||
if (target_sp && target_sp->GetArchitecture().IsValid()) | if (target_sp && target_sp->GetArchitecture().IsValid()) | ||||
{ | { | ||||
std::string triple = target_sp->GetArchitecture().GetTriple().str(); | std::string triple = target_sp->GetArchitecture().GetTriple().str(); | ||||
int dash_count = 0; | |||||
for (size_t i = 0; i < triple.size(); ++i) | |||||
{ | |||||
if (triple[i] == '-') | |||||
dash_count++; | |||||
if (dash_count == 3) | |||||
{ | |||||
triple.resize(i); | |||||
break; | |||||
} | |||||
} | |||||
m_compiler->getTargetOpts().Triple = triple; | m_compiler->getTargetOpts().Triple = triple; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); | m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); | ||||
} | } | ||||
if (target_sp->GetArchitecture().GetMachine() == llvm::Triple::x86 || | if (target_sp->GetArchitecture().GetMachine() == llvm::Triple::x86 || | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |