[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source
I-Jui Sung (Ray)
ray at multicorewareinc.com
Wed Oct 30 01:25:56 CET 2013
sc/source/core/opencl/formulagroupcl.cxx | 18 ++++++++++++------
sc/source/core/opencl/opbase.hxx | 4 +++-
2 files changed, 15 insertions(+), 7 deletions(-)
New commits:
commit 5ebecfc110f2c31e7bcef1c6e0a8fb2f6f1d56d5
Author: I-Jui (Ray) Sung <ray at multicorewareinc.com>
Date: Tue Oct 29 17:06:53 2013 -0500
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
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 229b639..c83715e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -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
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 93f6820..a858ede 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -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
More information about the Libreoffice-commits
mailing list