Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/PNaClTranslator.cpp

Issue 1359993002: Fix code checking arguments to an intrinsic call. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceIntrinsics.cpp ('k') | tests_lit/parse_errs/Inputs/bad-intrinsic-arg.tbc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 812537ec9e876f5c779649c896cead07ae090211..d7928659619a9fe6e8d6cf5f2f7395d9f9e73f57 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -2666,8 +2666,10 @@ void FunctionParser::ProcessRecord() {
const Ice::FuncSigType *Signature = nullptr;
Ice::Type ReturnType = Ice::IceType_void;
const Ice::Intrinsics::FullIntrinsicInfo *IntrinsicInfo = nullptr;
+ // Name of function if a direct call/intrinsic. Null otherwise.
+ Ice::FunctionDeclaration *Fcn = nullptr;
if (Record.GetCode() == naclbitc::FUNC_CODE_INST_CALL) {
- Ice::FunctionDeclaration *Fcn = Context->getFunctionByID(CalleeIndex);
+ Fcn = Context->getFunctionByID(CalleeIndex);
Signature = &Fcn->getSignature();
ReturnType = Signature->getReturnType();
@@ -2800,7 +2802,7 @@ void FunctionParser::ProcessRecord() {
case Ice::Intrinsics::BadReturnType: {
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
- StrBuf << "Intrinsic call expects return type "
+ StrBuf << "Intrinsic " << Fcn->getName() << " expects return type"
<< IntrinsicInfo->getReturnType()
<< ". Found: " << Inst->getReturnType();
Error(StrBuf.str());
@@ -2809,7 +2811,8 @@ void FunctionParser::ProcessRecord() {
case Ice::Intrinsics::WrongNumOfArgs: {
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
- StrBuf << "Intrinsic call expects " << IntrinsicInfo->getNumArgs()
+ StrBuf << "Intrinsic " << Fcn->getName() << " expects "
+ << IntrinsicInfo->getNumArgs()
<< ". Found: " << Inst->getNumArgs();
Error(StrBuf.str());
break;
@@ -2817,8 +2820,9 @@ void FunctionParser::ProcessRecord() {
case Ice::Intrinsics::WrongCallArgType: {
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
- StrBuf << "Intrinsic call argument " << ArgIndex << " expects type "
- << IntrinsicInfo->getArgType(ArgIndex)
+ StrBuf << "Intrinsic " << Fcn->getName() << " expects "
+ << IntrinsicInfo->getArgType(ArgIndex) << " for argument "
+ << (ArgIndex + 1)
<< ". Found: " << Inst->getArg(ArgIndex)->getType();
Error(StrBuf.str());
break;
« no previous file with comments | « src/IceIntrinsics.cpp ('k') | tests_lit/parse_errs/Inputs/bad-intrinsic-arg.tbc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698