2
// Copyright (c) 2002-2011 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.
7
#ifndef COMPILER_DETECT_RECURSION_H_
8
#define COMPILER_DETECT_RECURSION_H_
10
#include "GLSLANG/ShaderLang.h"
12
#include "compiler/intermediate.h"
13
#include "compiler/VariableInfo.h"
15
// Traverses intermediate tree to detect function recursion.
16
class DetectRecursion : public TIntermTraverser {
27
virtual bool visitAggregate(Visit, TIntermAggregate*);
29
ErrorCode detectRecursion();
34
FunctionNode(const TString& fname);
36
const TString& getName() const;
38
// If a function is already in the callee list, this becomes a no-op.
39
void addCallee(FunctionNode* callee);
41
// Return true if recursive function calls are detected.
42
bool detectRecursion();
45
// mangled function name is unique.
48
// functions that are directly called by this function.
49
TVector<FunctionNode*> callees;
54
FunctionNode* findFunctionByName(const TString& name);
56
TVector<FunctionNode*> functions;
57
FunctionNode* currentFunction;
60
#endif // COMPILER_DETECT_RECURSION_H_