@@ -738,13 +738,20 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
738738 const char * const argDirection = functionnode->Attribute (" direction" );
739739 if (argDirection) {
740740 const size_t argDirLen = strlen (argDirection);
741+ ArgumentChecks::Direction dir = ArgumentChecks::Direction::DIR_UNKNOWN;
741742 if (!strncmp (argDirection, " in" , argDirLen)) {
742- ac. direction = ArgumentChecks::Direction::DIR_IN;
743+ dir = ArgumentChecks::Direction::DIR_IN;
743744 } else if (!strncmp (argDirection, " out" , argDirLen)) {
744- ac. direction = ArgumentChecks::Direction::DIR_OUT;
745+ dir = ArgumentChecks::Direction::DIR_OUT;
745746 } else if (!strncmp (argDirection, " inout" , argDirLen)) {
746- ac. direction = ArgumentChecks::Direction::DIR_INOUT;
747+ dir = ArgumentChecks::Direction::DIR_INOUT;
747748 }
749+ if (const char * const argIndirect = functionnode->Attribute (" indirect" )) {
750+ const int indirect = strToInt<int >(argIndirect);
751+ ac.direction [indirect] = dir; // TODO: handle multiple directions/indirect levels
752+ }
753+ else
754+ ac.direction .fill (dir);
748755 }
749756 for (const tinyxml2::XMLElement *argnode = functionnode->FirstChildElement (); argnode; argnode = argnode->NextSiblingElement ()) {
750757 const std::string argnodename = argnode->Name ();
@@ -1500,11 +1507,14 @@ bool Library::hasminsize(const Token *ftok) const
15001507 });
15011508}
15021509
1503- Library::ArgumentChecks::Direction Library::getArgDirection (const Token* ftok, int argnr) const
1510+ Library::ArgumentChecks::Direction Library::getArgDirection (const Token* ftok, int argnr, int indirect ) const
15041511{
15051512 const ArgumentChecks* arg = getarg (ftok, argnr);
1506- if (arg)
1507- return arg->direction ;
1513+ if (arg) {
1514+ if (indirect < 0 || indirect >= arg->direction .size ())
1515+ throw InternalError (ftok, " Bad indirect value: " + std::to_string (indirect));
1516+ return arg->direction [indirect];
1517+ }
15081518 if (formatstr_function (ftok)) {
15091519 const int fs_argno = formatstr_argno (ftok);
15101520 if (fs_argno >= 0 && argnr >= fs_argno) {
0 commit comments