diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 34f14a68a..c9bbf176a 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -85,6 +85,7 @@ public: void checkIndex(TSourceLoc, const TType&, int& index); void handleIndexLimits(TSourceLoc, TIntermTyped* base, TIntermTyped* index); + void makeEditable(TSymbol*&); bool isIoResizeArray(const TType&) const; void fixIoArraySize(TSourceLoc, TType&); void ioArrayCheck(TSourceLoc, const TType&, const TString& identifier); @@ -279,21 +280,17 @@ protected: // - built-in block redeclarations interact with this // // Design: - // - use a per-context "resize-list", a list of entities whose array sizes - // can be fixed; this is logically one list, but physically two: - // * a list for nodes in the AST - // * a list for symbols in the symbol table - // this could be done a bit more simply, but this allows better error messages. + // - use a per-context "resize-list", a list of symbols whose array sizes + // can be fixed // // - the resize-list starts empty at beginning of user-shader compilation, it does // not have built-ins in it // - // - on built-in array use: copy-up symbol and add both the symbol and - // its use to resize-list + // - on built-in array use: copyUp() symbol and add it to the resize-list // // - on user array declaration: add it to the resize-list // - // - on block redeclaration: copy-up symbol and add it to the resize-list + // - on block redeclaration: copyUp() symbol and add it to the resize-list // * note, that appropriately gives an error if redeclaring a block that // was already used and hence already copied-up // @@ -303,7 +300,6 @@ protected: // - on seeing an array size declaration, give errors on mismatch between it and previous // array-sizing declarations // - TVector ioArrayNodeResizeList; TVector ioArraySymbolResizeList; }; diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index 7d9afaf4a..afc8a2c70 100644 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/glslang/MachineIndependent/SymbolTable.h @@ -126,7 +126,7 @@ protected: const char** extensions; // an array of pointers to existing constant char strings // - // N.B.: Non-const functions that will be generally used should assert an this, + // N.B.: Non-const functions that will be generally used should assert on this, // to avoid overwriting shared symbol-table information. // bool writable; @@ -254,14 +254,14 @@ public: virtual const TType& getType() const { - TTypeList& types = *anonContainer.getType().getStruct(); + const TTypeList& types = *anonContainer.getType().getStruct(); return *types[memberNumber].type; } virtual TType& getWritableType() { assert(writable); - TTypeList& types = *anonContainer.getType().getStruct(); + const TTypeList& types = *anonContainer.getType().getStruct(); return *types[memberNumber].type; } @@ -294,7 +294,7 @@ public: // An empty name means an anonymous container, exposing its members to the external scope. // Give it a name and insert its members in the symbol table, pointing to the container. char buf[20]; - snprintf(buf, 20, "__anon__%d", anonId); + snprintf(buf, 20, "%s%d", AnonymousPrefix, anonId); symbol.changeName(NewPoolTString(buf)); bool isOkay = true; @@ -541,9 +541,9 @@ public: } // - // Copy a variable or anonymous member's structure from a shared level up - // to the current level, so it can be modified without impacting other users - // of the shared table. + // Copy a variable or anonymous member's structure from a shared level so that + // it can be added (soon after return) to the symbol table where it can be + // modified without impacting other users of the shared table. // TSymbol* copyUpDeferredInsert(TSymbol* shared) { @@ -568,10 +568,8 @@ public: if (shared->getAsVariable()) return copy; else { - // get copy of an anonymous member's container - table[currentLevel()]->insert(*copy, separateNameSpaces); // return the copy of the anonymous member - return table[currentLevel()]->find(shared->getName()); + return table[globalLevel]->find(shared->getName()); } }