| 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 | #include "compiler/translator/Symbol.h" |
| 12 | |
| 13 | namespace sh |
| 14 | { |
| 15 | |
| 16 | bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters) |
| 17 | { |
| 18 | for (TIntermNode *node : *root->getSequence()) |
| 19 | { |
| 20 | TIntermFunctionDefinition *definition = node->getAsFunctionDefinition(); |
| 21 | if (definition != nullptr && |
| 22 | definition->getFunctionPrototype()->getFunction()->getParamCount() > maxParameters) |
| 23 | { |
| 24 | return false; |
| 25 | } |
| 26 | } |
| 27 | return true; |
| 28 | } |
| 29 | |
| 30 | } // namespace sh |
| 31 |