Add function recursion testing to the link-time validation.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23309 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-01 21:58:43 +00:00
parent f2ee3dd46a
commit 2ecdd14288
10 changed files with 469 additions and 25 deletions

View file

@ -99,6 +99,7 @@ public:
void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&);
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TVariable&);
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
void merge(TInfoSink&, TIntermediate&);
void errorCheck(TInfoSink&);
@ -110,6 +111,7 @@ protected:
void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects);
void error(TInfoSink& infoSink, const char*);
void linkErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, bool crossStage);
void checkCallGraphCycles(TInfoSink&);
protected:
EShLanguage language;
@ -119,6 +121,18 @@ protected:
int numMains;
int numErrors;
// for detecting recursion: pair is <caller, callee>
struct TCall {
TCall(const TString& pCaller, const TString& pCallee) : caller(pCaller), callee(pCallee) { }
TString caller;
TString callee;
bool visited;
bool subGraph;
bool errorGiven;
};
typedef std::list<TCall> TGraph;
TGraph callGraph;
private:
void operator=(TIntermediate&); // prevent assignments
};