1 // 2 // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // ValidateMaxParameters checks if function definitions have more than a set number of parameters. 7 8 #include "compiler/translator/ValidateMaxParameters.h" 9 10 #include "compiler/translator/IntermNode.h" 11 12 namespace sh 13 { 14 ValidateMaxParameters(TIntermBlock * root,unsigned int maxParameters)15bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters) 16 { 17 for (TIntermNode *node : *root->getSequence()) 18 { 19 TIntermFunctionDefinition *definition = node->getAsFunctionDefinition(); 20 if (definition != nullptr && 21 definition->getFunctionPrototype()->getSequence()->size() > maxParameters) 22 { 23 return false; 24 } 25 } 26 return true; 27 } 28 29 } // namespace sh 30