Track separate entry-point names and mangled names...

... and use each in the correct way at consumption sites.
This completes issue #513.
This commit is contained in:
John Kessenich 2016-09-19 18:09:30 -06:00
parent 632f575ecc
commit eee9d536bc
8 changed files with 32 additions and 25 deletions

View file

@ -1051,19 +1051,24 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
currentFunctionType = new TType(EbtVoid);
functionReturnsValue = false;
//
// Raise error message if main function takes any parameters or returns anything other than void
//
if (function.getName() == intermediate.getEntryPoint().c_str()) {
if (function.getParamCount() > 0)
error(loc, "function cannot take any parameter(s)", function.getName().c_str(), "");
if (function.getType().getBasicType() != EbtVoid)
error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value");
// Check for entry point
if (function.getName().compare(intermediate.getEntryPointName().c_str()) == 0) {
intermediate.setEntryPointMangledName(function.getMangledName().c_str());
intermediate.incrementEntryPointCount();
inMain = true;
} else
inMain = false;
//
// Raise error message if main function takes any parameters or returns anything other than void
//
if (inMain) {
if (function.getParamCount() > 0)
error(loc, "function cannot take any parameter(s)", function.getName().c_str(), "");
if (function.getType().getBasicType() != EbtVoid)
error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value");
}
//
// New symbol table scope for body of function plus its arguments
//