HLSL: don't do a deepCopy() for typedef, as we still want to share the type graph.

This enables the IO type mapping to work transparently for typedefs.
This commit is contained in:
John Kessenich
2017-02-08 13:59:30 -07:00
parent 65ee230f1c
commit dd40260b63
4 changed files with 43 additions and 69 deletions

View File

@@ -5336,12 +5336,9 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// 'parseType' is the type part of the declaration (to the left)
// 'arraySizes' is the arrayness tagged on the identifier (to the right)
//
void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType, TArraySizes* /*arraySizes*/)
void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType)
{
TType type;
type.deepCopy(parseType);
TVariable* typeSymbol = new TVariable(&identifier, type, true);
TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
if (! symbolTable.insert(*typeSymbol))
error(loc, "name already defined", "typedef", identifier.c_str());
}

View File

@@ -130,7 +130,7 @@ public:
void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args);
void declareTypedef(const TSourceLoc&, TString& identifier, const TType&, TArraySizes* typeArray = 0);
void declareTypedef(const TSourceLoc&, TString& identifier, const TType&);
void declareStruct(const TSourceLoc&, TString& structName, TType&);
TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0);
void lengthenList(const TSourceLoc&, TIntermSequence& list, int size);