/** * Returns the statement containing the function call. * * @return the ancestor statement of the function call. */ public Statement getStatement() { Statement ret = fcall.getStatement(); // initial statement in a for statement should return the for statement. if (ret.getParent() instanceof ForLoop) { ret = (Statement) ret.getParent(); } return ret; }
// Builds parameter mapping. private void buildArgumentList() { arguments = new ArrayList<Expression>(4); for (int i = 0; i < fcall.getNumArguments(); i++) { arguments.add(fcall.getArgument(i)); } // Catches exceptional cases. Symbol s = SymbolTools.getSymbolOf(fcall.getName()); if (s instanceof NestedDeclarator && ((NestedDeclarator) s).isProcedure()) { PrintTools.printlnStatus(0, "[WARNING] function pointer in ", fcall); exception |= FUNCTION_POINTER; } else if (callee == null) { exception |= LIBRARY_CALL; } else if (callee.containsVarArg()) { exception |= VARIABLE_ARG_LIST; PrintTools.printlnStatus(0, "[WARNING] variable argument list ", fcall); } }
/** * Returns the string dump of this call site. * * @return string dump. */ public String toString() { StringBuilder sb = new StringBuilder(80); sb.append(id).append(" ").append(caller.getName()).append("-->"); sb.append(fcall.getName()); if (PrintTools.getVerbosity() >= 3) { sb.append(" (").append(System.identityHashCode(fcall)).append(")"); } if (callee == null) { sb.append(" <lib>"); } else if (temp_assignments != null) { // normalized arguments String args = temp_assignments.toString().replaceAll("\n", " "); sb.append(" ").append(args); } if (PrintTools.getVerbosity() >= 3) { sb.append("\n parent = ").append(fcall.getParent()); sb.append("\n fcall = ").append(fcall); sb.append("\n args = ").append(arguments); sb.append("\n params = ").append(getParameters()); sb.append("\n nargs = ").append(norm_arguments); sb.append("\n exception = ").append(exception); } return sb.toString(); }
/** Returns the string name of the function name. */ public String getName() { return fcall.getName().toString(); }