HLSL: Fix #747: accept 'struct' in front of previously user-defined type name.

This commit is contained in:
John Kessenich
2017-03-02 14:30:59 -07:00
parent 0479437a5c
commit 854fe24786
8 changed files with 143 additions and 21 deletions

View File

@@ -6098,6 +6098,19 @@ void HlslParseContext::declareStruct(const TSourceLoc& loc, TString& structName,
ioTypeMap[type.getStruct()] = newLists;
}
// Lookup a user-type by name.
// If found, fill in the type and return the defining symbol.
// If not found, return nullptr.
TSymbol* HlslParseContext::lookupUserType(const TString& typeName, TType& type)
{
TSymbol* symbol = symbolTable.find(typeName);
if (symbol && symbol->getAsVariable() && symbol->getAsVariable()->isUserType()) {
type.shallowCopy(symbol->getType());
return symbol;
} else
return nullptr;
}
//
// Do everything necessary to handle a variable (non-block) declaration.
// Either redeclaring a variable, or making a new one, updating the symbol