Commit df977aaf by Shahbaz Youssefi Committed by Angle LUCI CQ

Translator: Validate global qualifier declaration's symbol

Global qualifier declarations (invariant, precise) apply to already-declared variables. This is now validated. Bug: angleproject:4889 Change-Id: I9889f2d68dcd6a2fc0de2b20a1291899397982d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2946114Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 1b2000f5
...@@ -489,6 +489,20 @@ bool ValidateAST::visitGlobalQualifierDeclaration(Visit visit, ...@@ -489,6 +489,20 @@ bool ValidateAST::visitGlobalQualifierDeclaration(Visit visit,
TIntermGlobalQualifierDeclaration *node) TIntermGlobalQualifierDeclaration *node)
{ {
visitNode(visit, node); visitNode(visit, node);
const TVariable *variable = &node->getSymbol()->variable();
if (mOptions.validateVariableReferences && variableNeedsDeclaration(variable))
{
if (!isVariableDeclared(variable))
{
mDiagnostics->error(node->getLine(),
"Found reference to undeclared or inconsistently redeclared "
"variable <validateVariableReferences>",
variable->name().data());
mVariableReferencesFailed = true;
}
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment