Non-functional: Round of adding 'const', related to more efficient getFullNamespaceName().
This commit is contained in:
@@ -344,7 +344,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
|
||||
while (acceptIdentifier(idToken)) {
|
||||
if (peekTokenClass(EHTokLeftParen)) {
|
||||
// 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.
|
||||
parseContext.renameShaderFunction(fnName);
|
||||
@@ -2090,7 +2090,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T
|
||||
{
|
||||
bool accepted = false;
|
||||
|
||||
TString* functionName = parseContext.getFullNamespaceName(memberName);
|
||||
const TString* functionName = &memberName;
|
||||
parseContext.getFullNamespaceName(functionName);
|
||||
declarator.function = new TFunction(functionName, type);
|
||||
if (type.getQualifier().storage == EvqTemporary)
|
||||
declarator.function->setImplicitThis();
|
||||
|
||||
@@ -162,7 +162,7 @@ bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const
|
||||
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;
|
||||
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
|
||||
// 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) {
|
||||
bool currentScope;
|
||||
@@ -4857,7 +4857,7 @@ void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNod
|
||||
//
|
||||
// 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.
|
||||
@@ -5846,7 +5846,7 @@ 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)
|
||||
void HlslParseContext::declareTypedef(const TSourceLoc& loc, const TString& identifier, const TType& parseType)
|
||||
{
|
||||
TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
|
||||
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)
|
||||
// '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()))
|
||||
return nullptr;
|
||||
@@ -6079,7 +6079,7 @@ TVariable* HlslParseContext::makeInternalVariable(const char* name, const TType&
|
||||
//
|
||||
// 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
|
||||
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
|
||||
// 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)
|
||||
name->append(currentTypePrefix.back());
|
||||
name->append(scopeMangler);
|
||||
name->append(localName);
|
||||
if (currentTypePrefix.size() == 0)
|
||||
return;
|
||||
|
||||
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.
|
||||
@@ -7150,7 +7150,7 @@ void HlslParseContext::addScopeMangler(TString& name)
|
||||
}
|
||||
|
||||
// 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,
|
||||
// if there is a substitution.
|
||||
|
||||
@@ -136,10 +136,10 @@ 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&);
|
||||
void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&);
|
||||
void declareStruct(const TSourceLoc&, TString& structName, 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);
|
||||
TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
|
||||
TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
|
||||
@@ -173,13 +173,13 @@ public:
|
||||
|
||||
void pushNamespace(const TString& name);
|
||||
void popNamespace();
|
||||
TString* getFullNamespaceName(const TString& localName) const;
|
||||
void getFullNamespaceName(const TString*&) const;
|
||||
void addScopeMangler(TString&);
|
||||
|
||||
void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
|
||||
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.
|
||||
TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node);
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
|
||||
|
||||
// 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
|
||||
void initFlattening() { flattenLevel.push_back(0); flattenOffset.push_back(0); }
|
||||
@@ -210,14 +210,14 @@ protected:
|
||||
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;
|
||||
TVariable* makeInternalVariable(const char* name, const TType&) const;
|
||||
TVariable* makeInternalVariable(const TString& name, const TType& type) const {
|
||||
return makeInternalVariable(name.c_str(), type);
|
||||
}
|
||||
TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool track);
|
||||
void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool track);
|
||||
TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track);
|
||||
void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track);
|
||||
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
|
||||
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
|
||||
bool isZeroConstructor(const TIntermNode*);
|
||||
|
||||
Reference in New Issue
Block a user