aboutsummaryrefslogtreecommitdiff
path: root/glslang/MachineIndependent/SymbolTable.h
diff options
context:
space:
mode:
authorJohn Kessenich <cepheus@frii.com>2013-10-30 23:17:34 +0000
committerJohn Kessenich <cepheus@frii.com>2013-10-30 23:17:34 +0000
commit0d22e31c7576e0f80bea07b9bd265b633ff3c066 (patch)
tree25a3328a15c5cf966b9dfa4b2c3c7e965bd4d283 /glslang/MachineIndependent/SymbolTable.h
parent8cbd18ecaae3b421f57816567bb391c987948d6f (diff)
downloadglslang-0d22e31c7576e0f80bea07b9bd265b633ff3c066.tar.gz
Implement 1.20 style function signature matching under implicit conversion. This was the last key unimplemented feature of versions 120 through 330.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23798 e7fa87d3-cd2b-0410-9028-fcbf551c1848
Diffstat (limited to 'glslang/MachineIndependent/SymbolTable.h')
-rw-r--r--glslang/MachineIndependent/SymbolTable.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h
index b71d62cd..e51f9cee 100644
--- a/glslang/MachineIndependent/SymbolTable.h
+++ b/glslang/MachineIndependent/SymbolTable.h
@@ -322,6 +322,19 @@ public:
return (*it).second;
}
+ void findFunctionNameList(const TString& name, TVector<TFunction*>& list)
+ {
+ size_t parenAt = name.find_first_of('(');
+ TString base(name, 0, parenAt + 1);
+
+ tLevel::const_iterator begin = level.lower_bound(base);
+ base[parenAt] = ')'; // assume ')' is lexically after '('
+ tLevel::const_iterator end = level.upper_bound(base);
+ for (tLevel::const_iterator it = begin; it != end; ++it)
+ list.push_back(it->second->getAsFunction());
+ }
+
+ // See if there is already a function in the table having the given non-function-style name.
bool hasFunctionName(const TString& name) const
{
tLevel::const_iterator candidate = level.lower_bound(name);
@@ -397,7 +410,7 @@ public:
while (table.size() > adoptedLevels)
pop(0);
}
-
+
void adoptLevels(TSymbolTable& symTable)
{
for (unsigned int level = 0; level < symTable.table.size(); ++level) {
@@ -511,6 +524,27 @@ public:
return symbol;
}
+ void findFunctionNameList(const TString& name, TVector<TFunction*>& list, bool& builtIn)
+ {
+ // For user levels, return the set found in the first scope with a match
+ builtIn = false;
+ int level = currentLevel();
+ do {
+ table[level]->findFunctionNameList(name, list);
+ --level;
+ } while (list.empty() && level >= globalLevel);
+
+ if (! list.empty())
+ return;
+
+ // Gather across all built-in levels; they don't hide each other
+ builtIn = true;
+ do {
+ table[level]->findFunctionNameList(name, list);
+ --level;
+ } while (level >= 0);
+ }
+
void relateToOperator(const char* name, TOperator op)
{
for (unsigned int level = 0; level < table.size(); ++level)