Non-functional: Round of adding 'const', related to more efficient getFullNamespaceName().
This commit is contained in:
		
							parent
							
								
									714e58b2fc
								
							
						
					
					
						commit
						4dc835c369
					
				| @ -2,5 +2,5 @@ | |||||||
| // For the version, it uses the latest git tag followed by the number of commits.
 | // For the version, it uses the latest git tag followed by the number of commits.
 | ||||||
| // For the date, it uses the current date (when then script is run).
 | // For the date, it uses the current date (when then script is run).
 | ||||||
| 
 | 
 | ||||||
| #define GLSLANG_REVISION "Overload400-PrecQual.1937" | #define GLSLANG_REVISION "Overload400-PrecQual.1939" | ||||||
| #define GLSLANG_DATE "28-Mar-2017" | #define GLSLANG_DATE "28-Mar-2017" | ||||||
|  | |||||||
| @ -531,7 +531,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin | |||||||
| // Make the passed-in variable information become a member of the
 | // Make the passed-in variable information become a member of the
 | ||||||
| // global uniform block.  If this doesn't exist yet, make it.
 | // global uniform block.  If this doesn't exist yet, make it.
 | ||||||
| //
 | //
 | ||||||
| void TParseContextBase::growGlobalUniformBlock(TSourceLoc& loc, TType& memberType, TString& memberName, TTypeList* typeList) | void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList) | ||||||
| { | { | ||||||
|     // Make the global block, if not yet made.
 |     // Make the global block, if not yet made.
 | ||||||
|     if (globalUniformBlock == nullptr) { |     if (globalUniformBlock == nullptr) { | ||||||
|  | |||||||
| @ -2990,7 +2990,7 @@ void TParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) | |||||||
| // Do all the semantic checking for declaring or redeclaring an array, with and
 | // Do all the semantic checking for declaring or redeclaring an array, with and
 | ||||||
| // without a size, and make the right changes to the symbol table.
 | // without a size, and make the right changes to the symbol table.
 | ||||||
| //
 | //
 | ||||||
| void TParseContext::declareArray(const TSourceLoc& loc, TString& identifier, const TType& type, TSymbol*& symbol) | void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol) | ||||||
| { | { | ||||||
|     if (symbol == nullptr) { |     if (symbol == nullptr) { | ||||||
|         bool currentScope; |         bool currentScope; | ||||||
| @ -5053,7 +5053,7 @@ TVariable* TParseContext::makeInternalVariable(const char* name, const TType& ty | |||||||
| //
 | //
 | ||||||
| // Return the successfully declared variable.
 | // Return the successfully declared variable.
 | ||||||
| //
 | //
 | ||||||
| TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, TString& identifier, TType& type) | TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type) | ||||||
| { | { | ||||||
|     // make a new variable
 |     // make a new variable
 | ||||||
|     TVariable* variable = new TVariable(&identifier, type); |     TVariable* variable = new TVariable(&identifier, type); | ||||||
|  | |||||||
| @ -136,7 +136,7 @@ public: | |||||||
|     TSymbolTable& symbolTable;   // symbol table that goes with the current language, version, and profile
 |     TSymbolTable& symbolTable;   // symbol table that goes with the current language, version, and profile
 | ||||||
| 
 | 
 | ||||||
|     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
 |     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
 | ||||||
|     virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName, TTypeList* typeList = nullptr); |     virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); | ||||||
| 
 | 
 | ||||||
|     virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); |     virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); | ||||||
|     virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); |     virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); | ||||||
| @ -371,8 +371,8 @@ protected: | |||||||
|     void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); |     void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); | ||||||
|     void inheritGlobalDefaults(TQualifier& dst) const; |     void inheritGlobalDefaults(TQualifier& dst) const; | ||||||
|     TVariable* makeInternalVariable(const char* name, const TType&) const; |     TVariable* makeInternalVariable(const char* name, const TType&) const; | ||||||
|     TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&); |     TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&); | ||||||
|     void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&); |     void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&); | ||||||
|     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); |     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); | ||||||
|     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); |     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); | ||||||
|     void finish() override; |     void finish() override; | ||||||
|  | |||||||
| @ -344,7 +344,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) | |||||||
|     while (acceptIdentifier(idToken)) { |     while (acceptIdentifier(idToken)) { | ||||||
|         if (peekTokenClass(EHTokLeftParen)) { |         if (peekTokenClass(EHTokLeftParen)) { | ||||||
|             // looks like function parameters
 |             // looks like function parameters
 | ||||||
|             TString* fnName = idToken.string; |             const TString* fnName = idToken.string; | ||||||
| 
 | 
 | ||||||
|             // Potentially rename shader entry point function.  No-op most of the time.
 |             // Potentially rename shader entry point function.  No-op most of the time.
 | ||||||
|             parseContext.renameShaderFunction(fnName); |             parseContext.renameShaderFunction(fnName); | ||||||
| @ -2090,7 +2090,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T | |||||||
| { | { | ||||||
|     bool accepted = false; |     bool accepted = false; | ||||||
| 
 | 
 | ||||||
|     TString* functionName = parseContext.getFullNamespaceName(memberName); |     const TString* functionName = &memberName; | ||||||
|  |     parseContext.getFullNamespaceName(functionName); | ||||||
|     declarator.function = new TFunction(functionName, type); |     declarator.function = new TFunction(functionName, type); | ||||||
|     if (type.getQualifier().storage == EvqTemporary) |     if (type.getQualifier().storage == EvqTemporary) | ||||||
|         declarator.function->setImplicitThis(); |         declarator.function->setImplicitThis(); | ||||||
|  | |||||||
| @ -162,7 +162,7 @@ bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const | |||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HlslParseContext::growGlobalUniformBlock(TSourceLoc& loc, TType& memberType, TString& memberName, TTypeList* newTypeList) | void HlslParseContext::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* newTypeList) | ||||||
| { | { | ||||||
|     newTypeList = nullptr; |     newTypeList = nullptr; | ||||||
|     correctUniform(memberType.getQualifier()); |     correctUniform(memberType.getQualifier()); | ||||||
| @ -4759,7 +4759,7 @@ void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) | |||||||
| // Do all the semantic checking for declaring or redeclaring an array, with and
 | // Do all the semantic checking for declaring or redeclaring an array, with and
 | ||||||
| // without a size, and make the right changes to the symbol table.
 | // without a size, and make the right changes to the symbol table.
 | ||||||
| //
 | //
 | ||||||
| void HlslParseContext::declareArray(const TSourceLoc& loc, TString& identifier, const TType& type, TSymbol*& symbol, bool track) | void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol, bool track) | ||||||
| { | { | ||||||
|     if (! symbol) { |     if (! symbol) { | ||||||
|         bool currentScope; |         bool currentScope; | ||||||
| @ -4857,7 +4857,7 @@ void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNod | |||||||
| //
 | //
 | ||||||
| // Enforce non-initializer type/qualifier rules.
 | // Enforce non-initializer type/qualifier rules.
 | ||||||
| //
 | //
 | ||||||
| void HlslParseContext::fixConstInit(const TSourceLoc& loc, TString& identifier, TType& type, TIntermTyped*& initializer) | void HlslParseContext::fixConstInit(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped*& initializer) | ||||||
| { | { | ||||||
|     //
 |     //
 | ||||||
|     // Make the qualifier make sense, given that there is an initializer.
 |     // Make the qualifier make sense, given that there is an initializer.
 | ||||||
| @ -5846,7 +5846,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction | |||||||
| // 'parseType' is the type part of the declaration (to the left)
 | // 'parseType' is the type part of the declaration (to the left)
 | ||||||
| // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 | // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 | ||||||
| //
 | //
 | ||||||
| void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType) | void HlslParseContext::declareTypedef(const TSourceLoc& loc, const TString& identifier, const TType& parseType) | ||||||
| { | { | ||||||
|     TVariable* typeSymbol = new TVariable(&identifier, parseType, true); |     TVariable* typeSymbol = new TVariable(&identifier, parseType, true); | ||||||
|     if (! symbolTable.insert(*typeSymbol)) |     if (! symbolTable.insert(*typeSymbol)) | ||||||
| @ -5977,7 +5977,7 @@ TSymbol* HlslParseContext::lookupUserType(const TString& typeName, TType& type) | |||||||
| // 'parseType' is the type part of the declaration (to the left)
 | // 'parseType' is the type part of the declaration (to the left)
 | ||||||
| // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 | // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 | ||||||
| //
 | //
 | ||||||
| TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, TType& type, TIntermTyped* initializer) | TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped* initializer) | ||||||
| { | { | ||||||
|     if (voidErrorCheck(loc, identifier, type.getBasicType())) |     if (voidErrorCheck(loc, identifier, type.getBasicType())) | ||||||
|         return nullptr; |         return nullptr; | ||||||
| @ -6079,7 +6079,7 @@ TVariable* HlslParseContext::makeInternalVariable(const char* name, const TType& | |||||||
| //
 | //
 | ||||||
| // Return the successfully declared variable.
 | // Return the successfully declared variable.
 | ||||||
| //
 | //
 | ||||||
| TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, TString& identifier, TType& type, bool track) | TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type, bool track) | ||||||
| { | { | ||||||
|     // make a new variable
 |     // make a new variable
 | ||||||
|     TVariable* variable = new TVariable(&identifier, type); |     TVariable* variable = new TVariable(&identifier, type); | ||||||
| @ -7132,15 +7132,15 @@ void HlslParseContext::popNamespace() | |||||||
| 
 | 
 | ||||||
| // Use the class/struct nesting string to create a global name for
 | // Use the class/struct nesting string to create a global name for
 | ||||||
| // a member of a class/struct.
 | // a member of a class/struct.
 | ||||||
| TString* HlslParseContext::getFullNamespaceName(const TString& localName) const | void HlslParseContext::getFullNamespaceName(const TString*& name) const | ||||||
| { | { | ||||||
|     TString* name = NewPoolTString(""); |     if (currentTypePrefix.size() == 0) | ||||||
|     if (currentTypePrefix.size() > 0) |         return; | ||||||
|         name->append(currentTypePrefix.back()); |  | ||||||
|     name->append(scopeMangler); |  | ||||||
|     name->append(localName); |  | ||||||
| 
 | 
 | ||||||
|     return name; |     TString* fullName = NewPoolTString(currentTypePrefix.back().c_str()); | ||||||
|  |     fullName->append(scopeMangler); | ||||||
|  |     fullName->append(*name); | ||||||
|  |     name = fullName; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Helper function to add the namespace scope mangling syntax to a string.
 | // Helper function to add the namespace scope mangling syntax to a string.
 | ||||||
| @ -7150,7 +7150,7 @@ void HlslParseContext::addScopeMangler(TString& name) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Potentially rename shader entry point function
 | // Potentially rename shader entry point function
 | ||||||
| void HlslParseContext::renameShaderFunction(TString*& name) const | void HlslParseContext::renameShaderFunction(const TString*& name) const | ||||||
| { | { | ||||||
|     // Replace the entry point name given in the shader with the real entry point name,
 |     // Replace the entry point name given in the shader with the real entry point name,
 | ||||||
|     // if there is a substitution.
 |     // if there is a substitution.
 | ||||||
|  | |||||||
| @ -136,10 +136,10 @@ public: | |||||||
|     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); |     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); | ||||||
| 
 | 
 | ||||||
|     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args); |     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args); | ||||||
|     void declareTypedef(const TSourceLoc&, TString& identifier, const TType&); |     void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&); | ||||||
|     void declareStruct(const TSourceLoc&, TString& structName, TType&); |     void declareStruct(const TSourceLoc&, TString& structName, TType&); | ||||||
|     TSymbol* lookupUserType(const TString&, TType&); |     TSymbol* lookupUserType(const TString&, TType&); | ||||||
|     TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0); |     TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = 0); | ||||||
|     void lengthenList(const TSourceLoc&, TIntermSequence& list, int size); |     void lengthenList(const TSourceLoc&, TIntermSequence& list, int size); | ||||||
|     TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); |     TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); | ||||||
|     TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); |     TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); | ||||||
| @ -173,13 +173,13 @@ public: | |||||||
| 
 | 
 | ||||||
|     void pushNamespace(const TString& name); |     void pushNamespace(const TString& name); | ||||||
|     void popNamespace(); |     void popNamespace(); | ||||||
|     TString* getFullNamespaceName(const TString& localName) const; |     void getFullNamespaceName(const TString*&) const; | ||||||
|     void addScopeMangler(TString&); |     void addScopeMangler(TString&); | ||||||
| 
 | 
 | ||||||
|     void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); } |     void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); } | ||||||
|     void popSwitchSequence() { switchSequenceStack.pop_back(); } |     void popSwitchSequence() { switchSequenceStack.pop_back(); } | ||||||
| 
 | 
 | ||||||
|     virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName, TTypeList* typeList = nullptr) override; |     virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override; | ||||||
| 
 | 
 | ||||||
|     // Apply L-value conversions.  E.g, turning a write to a RWTexture into an ImageStore.
 |     // Apply L-value conversions.  E.g, turning a write to a RWTexture into an ImageStore.
 | ||||||
|     TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node); |     TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node); | ||||||
| @ -191,7 +191,7 @@ public: | |||||||
|     bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry); |     bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry); | ||||||
| 
 | 
 | ||||||
|     // Potentially rename shader entry point function
 |     // Potentially rename shader entry point function
 | ||||||
|     void renameShaderFunction(TString*& name) const; |     void renameShaderFunction(const TString*& name) const; | ||||||
| 
 | 
 | ||||||
|     // Reset data for incrementally built referencing of flattened composite structures
 |     // Reset data for incrementally built referencing of flattened composite structures
 | ||||||
|     void initFlattening() { flattenLevel.push_back(0); flattenOffset.push_back(0); } |     void initFlattening() { flattenLevel.push_back(0); flattenOffset.push_back(0); } | ||||||
| @ -210,14 +210,14 @@ protected: | |||||||
|         int                 nextBinding; // next binding to use.
 |         int                 nextBinding; // next binding to use.
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     void fixConstInit(const TSourceLoc&, TString& identifier, TType& type, TIntermTyped*& initializer); |     void fixConstInit(const TSourceLoc&, const TString& identifier, TType& type, TIntermTyped*& initializer); | ||||||
|     void inheritGlobalDefaults(TQualifier& dst) const; |     void inheritGlobalDefaults(TQualifier& dst) const; | ||||||
|     TVariable* makeInternalVariable(const char* name, const TType&) const; |     TVariable* makeInternalVariable(const char* name, const TType&) const; | ||||||
|     TVariable* makeInternalVariable(const TString& name, const TType& type) const { |     TVariable* makeInternalVariable(const TString& name, const TType& type) const { | ||||||
|         return makeInternalVariable(name.c_str(), type); |         return makeInternalVariable(name.c_str(), type); | ||||||
|     } |     } | ||||||
|     TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool track); |     TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track); | ||||||
|     void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool track); |     void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track); | ||||||
|     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); |     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); | ||||||
|     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); |     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); | ||||||
|     bool isZeroConstructor(const TIntermNode*); |     bool isZeroConstructor(const TIntermNode*); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 John Kessenich
						John Kessenich