diff options
Diffstat (limited to 'glslang/MachineIndependent/ParseHelper.h')
-rw-r--r-- | glslang/MachineIndependent/ParseHelper.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 0f60ff7f..165601d2 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -73,13 +73,16 @@ typedef std::set<int> TIdSetType; // class TParseContextBase : public TParseVersions { public: - TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, int version, + TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) : TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages), symbolTable(symbolTable), - linkage(nullptr), scanContext(nullptr), ppContext(nullptr), - globalUniformBlock(nullptr) { } + parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr), + globalUniformBlock(nullptr) + { + linkage = new TIntermAggregate; + } virtual ~TParseContextBase() { } virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, @@ -94,7 +97,6 @@ public: virtual void setLimits(const TBuiltInResource&) = 0; EShLanguage getLanguage() const { return language; } - TIntermAggregate*& getLinkage() { return linkage; } void setScanContext(TScanContext* c) { scanContext = c; } TScanContext* getScanContext() const { return scanContext; } void setPpContext(TPpContext* c) { ppContext = c; } @@ -150,7 +152,8 @@ protected: TParseContextBase(TParseContextBase&); TParseContextBase& operator=(TParseContextBase&); - TIntermAggregate* linkage; // aggregate node of objects the linker may need, if not referenced by the rest of the AST + const bool parsingBuiltins; // true if parsing built-in symbols/functions + TVector<TSymbol*> linkageSymbols; // these need to be transferred to 'linkage', after all editing is done TScanContext* scanContext; TPpContext* ppContext; @@ -177,8 +180,14 @@ protected: virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, TPrefixType prefix, va_list args); + virtual void trackLinkage(TSymbol& symbol); + virtual void trackLinkageDeferred(TSymbol& symbol); virtual void makeEditable(TSymbol*&); virtual TVariable* getEditableVariable(const char* name); + virtual void finish(); + +private: + TIntermAggregate* linkage; }; // @@ -314,7 +323,7 @@ public: void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&); void parameterTypeCheck(const TSourceLoc&, TStorageQualifier qualifier, const TType& type); bool containsFieldWithBasicType(const TType& type ,TBasicType basicType); - TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&, bool& newDeclaration); + TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&); void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); void paramCheckFix(const TSourceLoc&, const TStorageQualifier&, TType& type); void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); @@ -368,11 +377,11 @@ protected: void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); void inheritGlobalDefaults(TQualifier& dst) const; TVariable* makeInternalVariable(const char* name, const TType&) const; - TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool& newDeclaration); - void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool& newDeclaration); + TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&); + void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&); TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); - void finalErrorCheck(); + void finish() override; public: // @@ -401,7 +410,6 @@ protected: TParseContext(TParseContext&); TParseContext& operator=(TParseContext&); - const bool parsingBuiltins; // true if parsing built-in symbols/functions static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex() TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; TPrecisionManager precisionManager; |