Adding unsized arrays to the glsl parser Unsized arrays declare with an empty [] without a specified size are now supported properly in the glsl parser. Also moved the construction code from the parser into TParseContext. Change-Id: Ic7b3efeee51da1a264e26af4d7908e7d2fccebd9 Reviewed-on: https://swiftshader-review.googlesource.com/3520 Tested-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.h b/src/OpenGL/compiler/ParseHelper.h index fbbfdd0..ece1d8e 100644 --- a/src/OpenGL/compiler/ParseHelper.h +++ b/src/OpenGL/compiler/ParseHelper.h
@@ -106,7 +106,6 @@ bool arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped* expr, int& size); bool arrayQualifierErrorCheck(const TSourceLoc &line, TPublicType type); bool arrayTypeErrorCheck(const TSourceLoc &line, TPublicType type); - bool arrayErrorCheck(const TSourceLoc &line, TString& identifier, TPublicType type, TVariable*& variable); bool voidErrorCheck(const TSourceLoc&, const TString&, const TBasicType&); bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*); bool boolErrorCheck(const TSourceLoc&, const TPublicType&); @@ -132,8 +131,8 @@ bool containsSampler(TType& type); bool areAllChildConst(TIntermAggregate* aggrNode); const TFunction* findFunction(const TSourceLoc &line, TFunction* pfnCall, bool *builtIn = 0); - bool executeInitializer(const TSourceLoc &line, const TString& identifier, const TPublicType& pType, - TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0); + bool executeInitializer(const TSourceLoc &line, const TString &identifier, const TPublicType &pType, + TIntermTyped *initializer, TIntermNode **intermNode); TPublicType addFullySpecifiedType(TQualifier qualifier, bool invariant, TLayoutQualifier layoutQualifier, const TPublicType &typeSpecifier); bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, const TSourceLoc&); @@ -166,6 +165,7 @@ const TSourceLoc &initLocation, TIntermTyped *initializer); void parseGlobalLayoutQualifier(const TPublicType &typeQualifier); + TFunction *addConstructorFunc(const TPublicType &publicType); TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&); TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type); TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&); @@ -203,6 +203,8 @@ TIntermTyped *addBinaryMath(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); TIntermTyped *addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); + TIntermTyped *addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); + TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc); TIntermBranch *addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc); @@ -210,6 +212,7 @@ bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable); TIntermTyped *addBinaryMathInternal(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); + TIntermTyped *createAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); // The funcReturnType parameter is expected to be non-null when the operation is a built-in function. // It is expected to be null for other unary operators.