|
@@ -245,12 +245,12 @@ public:
|
|
|
explicit TFunction(TOperator o) :
|
|
|
TSymbol(nullptr),
|
|
|
op(o),
|
|
|
- defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { }
|
|
|
+ defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), variadic(false), defaultParamCount(0) { }
|
|
|
TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) :
|
|
|
TSymbol(name),
|
|
|
mangledName(*name + '('),
|
|
|
op(tOp),
|
|
|
- defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0),
|
|
|
+ defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), variadic(false), defaultParamCount(0),
|
|
|
linkType(ELinkNone)
|
|
|
{
|
|
|
returnType.shallowCopy(retType);
|
|
@@ -268,6 +268,7 @@ public:
|
|
|
virtual void addParameter(TParameter& p)
|
|
|
{
|
|
|
assert(writable);
|
|
|
+ assert(!variadic && "cannot add more parameters if function is marked variadic");
|
|
|
parameters.push_back(p);
|
|
|
p.type->appendMangledName(mangledName);
|
|
|
|
|
@@ -310,6 +311,13 @@ public:
|
|
|
virtual bool hasImplicitThis() const { return implicitThis; }
|
|
|
virtual void setIllegalImplicitThis() { assert(writable); illegalImplicitThis = true; }
|
|
|
virtual bool hasIllegalImplicitThis() const { return illegalImplicitThis; }
|
|
|
+ virtual void setVariadic() {
|
|
|
+ assert(writable);
|
|
|
+ assert(!variadic && "function was already marked variadic");
|
|
|
+ variadic = true;
|
|
|
+ mangledName += 'z';
|
|
|
+ }
|
|
|
+ virtual bool isVariadic() const { return variadic; }
|
|
|
|
|
|
// Return total number of parameters
|
|
|
virtual int getParamCount() const { return static_cast<int>(parameters.size()); }
|
|
@@ -352,6 +360,7 @@ protected:
|
|
|
// even if it finds member variables in the symbol table.
|
|
|
// This is important for a static member function that has member variables in scope,
|
|
|
// but is not allowed to use them, or see hidden symbols instead.
|
|
|
+ bool variadic;
|
|
|
int defaultParamCount;
|
|
|
|
|
|
TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers
|