MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / declareNonArray

Method declareNonArray

glslang/MachineIndependent/ParseHelper.cpp:9533–9549  ·  view source on GitHub ↗

Declare a non-array variable, the main point being there is no redeclaration for resizing allowed. Return the successfully declared variable.

Source from the content-addressed store, hash-verified

9531// Return the successfully declared variable.
9532//
9533TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type)
9534{
9535 // make a new variable
9536 TVariable* variable = new TVariable(&identifier, type);
9537
9538 ioArrayCheck(loc, type, identifier);
9539
9540 // add variable to symbol table
9541 if (symbolTable.insert(*variable)) {
9542 if (symbolTable.atGlobalLevel())
9543 trackLinkage(*variable);
9544 return variable;
9545 }
9546
9547 error(loc, "redefinition", variable->getName().c_str(), "");
9548 return nullptr;
9549}
9550
9551//
9552// Handle all types of initializers from the grammar.

Callers

nothing calls this directly

Calls 4

errorFunction · 0.85
atGlobalLevelMethod · 0.80
c_strMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected