Misc semantics fixes:

- don't allow pre-array object versions to return a struct containing an array 
 - special case -2147483648 / -1
 - include "~" in the full integer functionality checks
 - handle multiple function parameters having the same name



git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24010 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-11-12 01:02:51 +00:00
parent 09709c1521
commit 67c9f3a720
9 changed files with 118 additions and 22 deletions

View file

@ -758,6 +758,8 @@ TFunction* TParseContext::handleFunctionDeclarator(TSourceLoc loc, TFunction& fu
}
}
arrayObjectCheck(loc, function.getType(), "array in function return type");
// All built-in functions are defined, even though they don't have a body.
if (symbolTable.atBuiltInLevel())
function.setDefined();
@ -831,26 +833,22 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(TSourceLoc loc, TFunct
TParameter& param = function[i];
if (param.name != 0) {
TVariable *variable = new TVariable(param.name, *param.type);
//
// Insert the parameters with name in the symbol table.
//
if (! symbolTable.insert(*variable)) {
error(loc, "redefinition", variable->getName().c_str(), "");
delete variable;
}
//
// Transfer ownership of name pointer to symbol table.
//
param.name = 0;
} else {
// Transfer ownership of name pointer to symbol table.
param.name = 0;
//
// Add the parameter to the HIL
//
paramNodes = intermediate.growAggregate(paramNodes,
intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(), loc),
loc);
// Add the parameter to the HIL
paramNodes = intermediate.growAggregate(paramNodes,
intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(), loc),
loc);
}
} else
paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(0, "", *param.type, loc), loc);
}