Skip to content

Commit

Permalink
Added support for warningcall
Browse files Browse the repository at this point in the history
  • Loading branch information
kalibera committed Nov 4, 2015
1 parent a01e888 commit 423bee9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/dofunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ DoFunctionInfo analyzeDoFunction(Function *fun, bool resolveListAccesses, bool r
res.computesArgsLength = false;
res.primvalCalled = false;
res.errorcallCalled = false;
res.warningcallCalled = false;
res.check1argCalled = false;

res.complexUseOfOp = false;
Expand Down Expand Up @@ -842,6 +843,18 @@ DoFunctionInfo analyzeDoFunction(Function *fun, bool resolveListAccesses, bool r
continue;
}
}
if (tgt && (tgt->getName() == "Rf_warningcall")) {

assert(cs.arg_size() > 1);

ValueState vsCall = getVS(vmap, cs.getArgument(0));

if (vsCall.kind == VSK_CALL) {
res.warningcallCalled = true;
if (DEBUG) errs() << " adf: -> warningcallCalled " << *in << "\n";
continue;
}
}
if (tgt && (tgt->getName() == "Rf_check1arg" || tgt->getName() == "check1arg2")) {

assert(cs.arg_size() > 2);
Expand Down Expand Up @@ -1286,6 +1299,9 @@ std::string DoFunctionInfo::str() {
if (errorcallCalled) {
res += " +errorcall";
}
if (warningcallCalled) {
res += " +warningCall";
}
}
if (!complexUseOfCall && !complexUseOfArgs && !usesTags && check1argCalled) {
res += " +check1arg";
Expand Down
3 changes: 2 additions & 1 deletion src/dofunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct DoFunctionInfo {
bool computesArgsLength; // uses length on args (or some suffix of it)
bool primvalCalled; // uses "op" with PRIMVAL(op)
bool errorcallCalled; // uses "call" with errorcall
bool warningcallCalled; // uses "call" with errorcall
bool check1argCalled; // uses "call" and "args" with check1arg or check1arg2

bool complexUseOfArgs; // anything except loading arg value, arg tag, calling checkArity
Expand All @@ -85,7 +86,7 @@ struct DoFunctionInfo {

// FIXME: the defaults are not really used/needed
DoFunctionInfo(Function *fun): fun(fun), checkArityCalled(false), effectiveArity(-1), usesTags(true), computesArgsLength(true),
primvalCalled(true), errorcallCalled(true), check1argCalled(true),
primvalCalled(true), errorcallCalled(true), warningcallCalled(true), check1argCalled(true),
complexUseOfArgs(true), complexUseOfCall(true), complexUseOfEnv(true), confused(true), listAccesses() {}; // conservative defaults

std::string str();
Expand Down

0 comments on commit 423bee9

Please sign in to comment.