Kaydet (Commit) 43a61b3d authored tarafından I-Jui (Ray) Sung's avatar I-Jui (Ray) Sung Kaydeden (comit) Kohei Yoshida

Include a message for unhandled-token in OCL group interpreter.

Also added sanity checks for unhandled cases; i.e. mixed string/numeric
in SingleVectorRefs

Change-Id: I448536f45ec6cf9bc870671646c5ed4ee83ac9f8
üst b3aadaa5
......@@ -807,14 +807,19 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
const formula::SingleVectorRefToken* pSVR =
dynamic_cast< const formula::SingleVectorRefToken* >(pChild);
assert(pSVR);
if (pSVR->GetArray().mpNumericArray)
if (pSVR->GetArray().mpNumericArray &&
!pSVR->GetArray().mpStringArray)
mvSubArguments.push_back(
SubArgument(new DynamicKernelArgument(ts,
ft->Children[i])));
else
else if (!pSVR->GetArray().mpNumericArray &&
pSVR->GetArray().mpStringArray)
mvSubArguments.push_back(
SubArgument(new DynamicKernelStringArgument(
ts, ft->Children[i])));
else
throw UnhandledToken(pChild,
"Got both numeric and string vector");
} else if (pChild->GetType() == formula::svDouble) {
mvSubArguments.push_back(
SubArgument(new DynamicKernelConstantArgument(ts,
......@@ -824,7 +829,7 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
SubArgument(new ConstStringArgument(ts,
ft->Children[i])));
} else {
throw UnhandledToken(pChild);
throw UnhandledToken(pChild, "unknown operand for ocPush");
}
break;
case ocDiv:
......@@ -1095,7 +1100,7 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
}
break;
default:
throw UnhandledToken(pChild);
throw UnhandledToken(pChild, "unhandled opcode");
};
}
}
......@@ -1414,8 +1419,9 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
return true;
}
#undef NO_FALLBACK_TO_SWINTERP /* undef this for non-TDD runs */
catch (const UnhandledToken&) {
std::cerr << "Dynamic formual compiler: unhandled token\n";
catch (const UnhandledToken &ut) {
std::cerr << "\nDynamic formual compiler: unhandled token: ";
std::cerr << ut.mMessage << "\n";
#ifdef NO_FALLBACK_TO_SWINTERP
assert(false);
#else
......
......@@ -25,8 +25,10 @@ namespace sc { namespace opencl {
class UnhandledToken
{
public:
UnhandledToken(formula::FormulaToken *t): mToken(t) {}
UnhandledToken(formula::FormulaToken *t,
const char *const m): mToken(t), mMessage(m) {}
formula::FormulaToken *mToken;
std::string mMessage;
};
/// Failed in marshaling
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment