Commit 3f286cd1 by Jamie Madill Committed by Commit Bot

Clean up the TType class.

Move more methods into the cpp file, and rename member variables to start with the "m" prefix. Also move most of the TPublicType methods into the cpp. Bug: angleproject:1432 Change-Id: Ib11a3c8c6ace654fd52077a317814665f81a7261 Reviewed-on: https://chromium-review.googlesource.com/776276Reviewed-by: 's avatarKai Ninomiya <kainino@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3d70ca9c
...@@ -113,6 +113,52 @@ const char *getBasicString(TBasicType t) ...@@ -113,6 +113,52 @@ const char *getBasicString(TBasicType t)
} }
} }
// TType implementation.
TType::TType()
: type(EbtVoid),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(0),
secondarySize(0),
mInterfaceBlock(nullptr),
mStructure(nullptr),
mIsStructSpecifier(false)
{
}
TType::TType(TBasicType t, unsigned char ps, unsigned char ss)
: type(t),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
mInterfaceBlock(0),
mStructure(0),
mIsStructSpecifier(false)
{
}
TType::TType(TBasicType t, TPrecision p, TQualifier q, unsigned char ps, unsigned char ss)
: type(t),
precision(p),
qualifier(q),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
mInterfaceBlock(0),
mStructure(0),
mIsStructSpecifier(false)
{
}
TType::TType(const TPublicType &p) TType::TType(const TPublicType &p)
: type(p.getBasicType()), : type(p.getBasicType()),
precision(p.precision), precision(p.precision),
...@@ -122,8 +168,8 @@ TType::TType(const TPublicType &p) ...@@ -122,8 +168,8 @@ TType::TType(const TPublicType &p)
layoutQualifier(p.layoutQualifier), layoutQualifier(p.layoutQualifier),
primarySize(p.getPrimarySize()), primarySize(p.getPrimarySize()),
secondarySize(p.getSecondarySize()), secondarySize(p.getSecondarySize()),
interfaceBlock(0), mInterfaceBlock(nullptr),
structure(0), mStructure(nullptr),
mIsStructSpecifier(false) mIsStructSpecifier(false)
{ {
ASSERT(primarySize <= 4); ASSERT(primarySize <= 4);
...@@ -134,14 +180,41 @@ TType::TType(const TPublicType &p) ...@@ -134,14 +180,41 @@ TType::TType(const TPublicType &p)
} }
if (p.getUserDef()) if (p.getUserDef())
{ {
structure = p.getUserDef(); mStructure = p.getUserDef();
mIsStructSpecifier = p.isStructSpecifier(); mIsStructSpecifier = p.isStructSpecifier();
} }
} }
bool TStructure::equals(const TStructure &other) const TType::TType(TStructure *userDef)
: type(EbtStruct),
precision(EbpUndefined),
qualifier(EvqTemporary),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(1),
secondarySize(1),
mInterfaceBlock(nullptr),
mStructure(userDef),
mIsStructSpecifier(false)
{
}
TType::TType(TInterfaceBlock *interfaceBlockIn,
TQualifier qualifierIn,
TLayoutQualifier layoutQualifierIn)
: type(EbtInterfaceBlock),
precision(EbpUndefined),
qualifier(qualifierIn),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(layoutQualifierIn),
primarySize(1),
secondarySize(1),
mInterfaceBlock(interfaceBlockIn),
mStructure(0),
mIsStructSpecifier(false)
{ {
return (uniqueId() == other.uniqueId());
} }
bool TType::canBeConstructed() const bool TType::canBeConstructed() const
...@@ -430,10 +503,10 @@ TString TType::buildMangledName() const ...@@ -430,10 +503,10 @@ TString TType::buildMangledName() const
mangledName += "ac"; mangledName += "ac";
break; break;
case EbtStruct: case EbtStruct:
mangledName += structure->mangledName(); mangledName += mStructure->mangledName();
break; break;
case EbtInterfaceBlock: case EbtInterfaceBlock:
mangledName += interfaceBlock->mangledName(); mangledName += mInterfaceBlock->mangledName();
break; break;
default: default:
// EbtVoid, EbtAddress and non types // EbtVoid, EbtAddress and non types
...@@ -467,7 +540,7 @@ size_t TType::getObjectSize() const ...@@ -467,7 +540,7 @@ size_t TType::getObjectSize() const
size_t totalSize; size_t totalSize;
if (getBasicType() == EbtStruct) if (getBasicType() == EbtStruct)
totalSize = structure->objectSize(); totalSize = mStructure->objectSize();
else else
totalSize = primarySize * secondarySize; totalSize = primarySize * secondarySize;
...@@ -491,7 +564,7 @@ int TType::getLocationCount() const ...@@ -491,7 +564,7 @@ int TType::getLocationCount() const
if (getBasicType() == EbtStruct) if (getBasicType() == EbtStruct)
{ {
count = structure->getLocationCount(); count = mStructure->getLocationCount();
} }
if (count == 0) if (count == 0)
...@@ -539,7 +612,7 @@ bool TType::isUnsizedArray() const ...@@ -539,7 +612,7 @@ bool TType::isUnsizedArray() const
bool TType::sameNonArrayType(const TType &right) const bool TType::sameNonArrayType(const TType &right) const
{ {
return (type == right.type && primarySize == right.primarySize && return (type == right.type && primarySize == right.primarySize &&
secondarySize == right.secondarySize && structure == right.structure); secondarySize == right.secondarySize && mStructure == right.mStructure);
} }
bool TType::isElementTypeOf(const TType &arrayType) const bool TType::isElementTypeOf(const TType &arrayType) const
...@@ -588,6 +661,100 @@ void TType::sizeOutermostUnsizedArray(unsigned int arraySize) ...@@ -588,6 +661,100 @@ void TType::sizeOutermostUnsizedArray(unsigned int arraySize)
mArraySizes.back() = arraySize; mArraySizes.back() = arraySize;
} }
void TType::setBasicType(TBasicType t)
{
if (type != t)
{
type = t;
invalidateMangledName();
}
}
void TType::setPrimarySize(unsigned char ps)
{
if (primarySize != ps)
{
ASSERT(ps <= 4);
primarySize = ps;
invalidateMangledName();
}
}
void TType::setSecondarySize(unsigned char ss)
{
if (secondarySize != ss)
{
ASSERT(ss <= 4);
secondarySize = ss;
invalidateMangledName();
}
}
void TType::makeArray(unsigned int s)
{
mArraySizes.push_back(s);
invalidateMangledName();
}
void TType::setArraySize(size_t arrayDimension, unsigned int s)
{
ASSERT(arrayDimension < mArraySizes.size());
if (mArraySizes.at(arrayDimension) != s)
{
mArraySizes[arrayDimension] = s;
invalidateMangledName();
}
}
void TType::toArrayElementType()
{
if (mArraySizes.size() > 0)
{
mArraySizes.pop_back();
invalidateMangledName();
}
}
void TType::setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
{
if (mInterfaceBlock != interfaceBlockIn)
{
mInterfaceBlock = interfaceBlockIn;
invalidateMangledName();
}
}
void TType::setStruct(TStructure *s)
{
if (mStructure != s)
{
mStructure = s;
invalidateMangledName();
}
}
const TString &TType::getMangledName() const
{
if (mMangledName.empty())
{
mMangledName = buildMangledName();
mMangledName += ';';
}
return mMangledName;
}
void TType::realize()
{
getMangledName();
}
void TType::invalidateMangledName()
{
mMangledName = "";
}
// TStructure implementation.
TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields) TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields)
: TFieldListCollection(name, fields), : TFieldListCollection(name, fields),
mDeepestNesting(0), mDeepestNesting(0),
...@@ -596,6 +763,11 @@ TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldLis ...@@ -596,6 +763,11 @@ TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldLis
{ {
} }
bool TStructure::equals(const TStructure &other) const
{
return (uniqueId() == other.uniqueId());
}
bool TStructure::containsArrays() const bool TStructure::containsArrays() const
{ {
for (size_t i = 0; i < mFields->size(); ++i) for (size_t i = 0; i < mFields->size(); ++i)
...@@ -654,7 +826,7 @@ void TType::createSamplerSymbols(const TString &namePrefix, ...@@ -654,7 +826,7 @@ void TType::createSamplerSymbols(const TString &namePrefix,
} }
else else
{ {
structure->createSamplerSymbols(namePrefix, apiNamePrefix, outputSymbols, mStructure->createSamplerSymbols(namePrefix, apiNamePrefix, outputSymbols,
outputSymbolsToAPINames, symbolTable); outputSymbolsToAPINames, symbolTable);
} }
return; return;
...@@ -741,4 +913,68 @@ int TStructure::calculateDeepestNesting() const ...@@ -741,4 +913,68 @@ int TStructure::calculateDeepestNesting() const
return 1 + maxNesting; return 1 + maxNesting;
} }
// TPublicType implementation.
void TPublicType::initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q)
{
typeSpecifierNonArray = typeSpecifier;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = q;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
void TPublicType::initializeBasicType(TBasicType basicType)
{
typeSpecifierNonArray.type = basicType;
typeSpecifierNonArray.primarySize = 1;
typeSpecifierNonArray.secondarySize = 1;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = EvqTemporary;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
bool TPublicType::isStructureContainingArrays() const
{
if (!typeSpecifierNonArray.userDef)
{
return false;
}
return typeSpecifierNonArray.userDef->containsArrays();
}
bool TPublicType::isStructureContainingType(TBasicType t) const
{
if (!typeSpecifierNonArray.userDef)
{
return false;
}
return typeSpecifierNonArray.userDef->containsType(t);
}
void TPublicType::setArraySize(int s)
{
array = true;
arraySize = s;
}
void TPublicType::clearArrayness()
{
array = false;
arraySize = 0;
}
bool TPublicType::isAggregate() const
{
return array || typeSpecifierNonArray.isMatrix() || typeSpecifierNonArray.isVector();
}
} // namespace sh } // namespace sh
...@@ -182,96 +182,24 @@ class TType ...@@ -182,96 +182,24 @@ class TType
{ {
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
TType() TType();
: type(EbtVoid), explicit TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1);
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(0),
secondarySize(0),
interfaceBlock(nullptr),
structure(nullptr),
mIsStructSpecifier(false)
{
}
explicit TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1)
: type(t),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
interfaceBlock(0),
structure(0),
mIsStructSpecifier(false)
{
}
TType(TBasicType t, TType(TBasicType t,
TPrecision p, TPrecision p,
TQualifier q = EvqTemporary, TQualifier q = EvqTemporary,
unsigned char ps = 1, unsigned char ps = 1,
unsigned char ss = 1) unsigned char ss = 1);
: type(t),
precision(p),
qualifier(q),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
interfaceBlock(0),
structure(0),
mIsStructSpecifier(false)
{
}
explicit TType(const TPublicType &p); explicit TType(const TPublicType &p);
explicit TType(TStructure *userDef) explicit TType(TStructure *userDef);
: type(EbtStruct),
precision(EbpUndefined),
qualifier(EvqTemporary),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(1),
secondarySize(1),
interfaceBlock(0),
structure(userDef),
mIsStructSpecifier(false)
{
}
TType(TInterfaceBlock *interfaceBlockIn, TType(TInterfaceBlock *interfaceBlockIn,
TQualifier qualifierIn, TQualifier qualifierIn,
TLayoutQualifier layoutQualifierIn) TLayoutQualifier layoutQualifierIn);
: type(EbtInterfaceBlock),
precision(EbpUndefined),
qualifier(qualifierIn),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(layoutQualifierIn),
primarySize(1),
secondarySize(1),
interfaceBlock(interfaceBlockIn),
structure(0),
mIsStructSpecifier(false)
{
}
TType(const TType &) = default; TType(const TType &) = default;
TType &operator=(const TType &) = default; TType &operator=(const TType &) = default;
TBasicType getBasicType() const { return type; } TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t) void setBasicType(TBasicType t);
{
if (type != t)
{
type = t;
invalidateMangledName();
}
}
TPrecision getPrecision() const { return precision; } TPrecision getPrecision() const { return precision; }
void setPrecision(TPrecision p) { precision = p; } void setPrecision(TPrecision p) { precision = p; }
...@@ -301,24 +229,8 @@ class TType ...@@ -301,24 +229,8 @@ class TType
ASSERT(isMatrix()); ASSERT(isMatrix());
return secondarySize; return secondarySize;
} }
void setPrimarySize(unsigned char ps) void setPrimarySize(unsigned char ps);
{ void setSecondarySize(unsigned char ss);
if (primarySize != ps)
{
ASSERT(ps <= 4);
primarySize = ps;
invalidateMangledName();
}
}
void setSecondarySize(unsigned char ss)
{
if (secondarySize != ss)
{
ASSERT(ss <= 4);
secondarySize = ss;
invalidateMangledName();
}
}
// Full size of single instance of type // Full size of single instance of type
size_t getObjectSize() const; size_t getObjectSize() const;
...@@ -334,21 +246,10 @@ class TType ...@@ -334,21 +246,10 @@ class TType
unsigned int getArraySizeProduct() const; unsigned int getArraySizeProduct() const;
bool isUnsizedArray() const; bool isUnsizedArray() const;
unsigned int getOutermostArraySize() const { return mArraySizes.back(); } unsigned int getOutermostArraySize() const { return mArraySizes.back(); }
void makeArray(unsigned int s) void makeArray(unsigned int s);
{
mArraySizes.push_back(s);
invalidateMangledName();
}
// Here, the array dimension value 0 corresponds to the innermost array. // Here, the array dimension value 0 corresponds to the innermost array.
void setArraySize(size_t arrayDimension, unsigned int s) void setArraySize(size_t arrayDimension, unsigned int s);
{
ASSERT(arrayDimension < mArraySizes.size());
if (mArraySizes.at(arrayDimension) != s)
{
mArraySizes[arrayDimension] = s;
invalidateMangledName();
}
}
// Will set unsized array sizes according to arraySizes. In case there are more unsized arrays // Will set unsized array sizes according to arraySizes. In case there are more unsized arrays
// than there are sizes in arraySizes, defaults to setting array sizes to 1. // than there are sizes in arraySizes, defaults to setting array sizes to 1.
...@@ -358,57 +259,27 @@ class TType ...@@ -358,57 +259,27 @@ class TType
void sizeOutermostUnsizedArray(unsigned int arraySize); void sizeOutermostUnsizedArray(unsigned int arraySize);
// Note that the array element type might still be an array type in GLSL ES version >= 3.10. // Note that the array element type might still be an array type in GLSL ES version >= 3.10.
void toArrayElementType() void toArrayElementType();
{
if (mArraySizes.size() > 0)
{
mArraySizes.pop_back();
invalidateMangledName();
}
}
TInterfaceBlock *getInterfaceBlock() const { return interfaceBlock; } TInterfaceBlock *getInterfaceBlock() const { return mInterfaceBlock; }
void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn) void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn);
{
if (interfaceBlock != interfaceBlockIn)
{
interfaceBlock = interfaceBlockIn;
invalidateMangledName();
}
}
bool isInterfaceBlock() const { return type == EbtInterfaceBlock; } bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
bool isVector() const { return primarySize > 1 && secondarySize == 1; } bool isVector() const { return primarySize > 1 && secondarySize == 1; }
bool isScalar() const bool isScalar() const
{ {
return primarySize == 1 && secondarySize == 1 && !structure && !isArray(); return primarySize == 1 && secondarySize == 1 && !mStructure && !isArray();
} }
bool isScalarFloat() const { return isScalar() && type == EbtFloat; } bool isScalarFloat() const { return isScalar() && type == EbtFloat; }
bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); } bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
bool canBeConstructed() const; bool canBeConstructed() const;
TStructure *getStruct() { return structure; } TStructure *getStruct() { return mStructure; }
const TStructure *getStruct() const { return structure; } const TStructure *getStruct() const { return mStructure; }
void setStruct(TStructure *s) void setStruct(TStructure *s);
{
if (structure != s)
{
structure = s;
invalidateMangledName();
}
}
const TString &getMangledName() const const TString &getMangledName() const;
{
if (mangled.empty())
{
mangled = buildMangledName();
mangled += ';';
}
return mangled;
}
bool sameNonArrayType(const TType &right) const; bool sameNonArrayType(const TType &right) const;
...@@ -419,7 +290,7 @@ class TType ...@@ -419,7 +290,7 @@ class TType
{ {
return type == right.type && primarySize == right.primarySize && return type == right.type && primarySize == right.primarySize &&
secondarySize == right.secondarySize && mArraySizes == right.mArraySizes && secondarySize == right.secondarySize && mArraySizes == right.mArraySizes &&
structure == right.structure; mStructure == right.mStructure;
// don't check the qualifier, it's not ever what's being sought after // don't check the qualifier, it's not ever what's being sought after
} }
bool operator!=(const TType &right) const { return !operator==(right); } bool operator!=(const TType &right) const { return !operator==(right); }
...@@ -438,8 +309,8 @@ class TType ...@@ -438,8 +309,8 @@ class TType
if (mArraySizes[i] != right.mArraySizes[i]) if (mArraySizes[i] != right.mArraySizes[i])
return mArraySizes[i] < right.mArraySizes[i]; return mArraySizes[i] < right.mArraySizes[i];
} }
if (structure != right.structure) if (mStructure != right.mStructure)
return structure < right.structure; return mStructure < right.mStructure;
return false; return false;
} }
...@@ -465,23 +336,23 @@ class TType ...@@ -465,23 +336,23 @@ class TType
// For type "nesting2", this method would return 2 -- the number // For type "nesting2", this method would return 2 -- the number
// of structures through which indirection must occur to reach the // of structures through which indirection must occur to reach the
// deepest field (nesting2.field1.position). // deepest field (nesting2.field1.position).
int getDeepestStructNesting() const { return structure ? structure->deepestNesting() : 0; } int getDeepestStructNesting() const { return mStructure ? mStructure->deepestNesting() : 0; }
bool isNamelessStruct() const { return structure && structure->name() == ""; } bool isNamelessStruct() const { return mStructure && mStructure->name() == ""; }
bool isStructureContainingArrays() const bool isStructureContainingArrays() const
{ {
return structure ? structure->containsArrays() : false; return mStructure ? mStructure->containsArrays() : false;
} }
bool isStructureContainingType(TBasicType t) const bool isStructureContainingType(TBasicType t) const
{ {
return structure ? structure->containsType(t) : false; return mStructure ? mStructure->containsType(t) : false;
} }
bool isStructureContainingSamplers() const bool isStructureContainingSamplers() const
{ {
return structure ? structure->containsSamplers() : false; return mStructure ? mStructure->containsSamplers() : false;
} }
bool isStructSpecifier() const { return mIsStructSpecifier; } bool isStructSpecifier() const { return mIsStructSpecifier; }
...@@ -493,10 +364,10 @@ class TType ...@@ -493,10 +364,10 @@ class TType
TSymbolTable *symbolTable) const; TSymbolTable *symbolTable) const;
// Initializes all lazily-initialized members. // Initializes all lazily-initialized members.
void realize() { getMangledName(); } void realize();
private: private:
void invalidateMangledName() { mangled = ""; } void invalidateMangledName();
TString buildMangledName() const; TString buildMangledName() const;
TBasicType type; TBasicType type;
...@@ -516,13 +387,13 @@ class TType ...@@ -516,13 +387,13 @@ class TType
// 1) Represents an interface block. // 1) Represents an interface block.
// 2) Represents the member variable of an unnamed interface block. // 2) Represents the member variable of an unnamed interface block.
// It's nullptr also for members of named interface blocks. // It's nullptr also for members of named interface blocks.
TInterfaceBlock *interfaceBlock; TInterfaceBlock *mInterfaceBlock;
// 0 unless this is a struct // 0 unless this is a struct
TStructure *structure; TStructure *mStructure;
bool mIsStructSpecifier; bool mIsStructSpecifier;
mutable TString mangled; mutable TString mMangledName;
}; };
// TTypeSpecifierNonArray stores all of the necessary fields for type_specifier_nonarray from the // TTypeSpecifierNonArray stores all of the necessary fields for type_specifier_nonarray from the
...@@ -584,40 +455,8 @@ struct TTypeSpecifierNonArray ...@@ -584,40 +455,8 @@ struct TTypeSpecifierNonArray
// //
struct TPublicType struct TPublicType
{ {
TTypeSpecifierNonArray typeSpecifierNonArray; void initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q);
TLayoutQualifier layoutQualifier; void initializeBasicType(TBasicType basicType);
TMemoryQualifier memoryQualifier;
TQualifier qualifier;
bool invariant;
TPrecision precision;
bool array;
int arraySize;
void initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q)
{
typeSpecifierNonArray = typeSpecifier;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = q;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
void initializeBasicType(TBasicType basicType)
{
typeSpecifierNonArray.type = basicType;
typeSpecifierNonArray.primarySize = 1;
typeSpecifierNonArray.secondarySize = 1;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = EvqTemporary;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
TBasicType getBasicType() const { return typeSpecifierNonArray.type; } TBasicType getBasicType() const { return typeSpecifierNonArray.type; }
void setBasicType(TBasicType basicType) { typeSpecifierNonArray.type = basicType; } void setBasicType(TBasicType basicType) { typeSpecifierNonArray.type = basicType; }
...@@ -630,41 +469,20 @@ struct TPublicType ...@@ -630,41 +469,20 @@ struct TPublicType
bool isStructSpecifier() const { return typeSpecifierNonArray.isStructSpecifier; } bool isStructSpecifier() const { return typeSpecifierNonArray.isStructSpecifier; }
bool isStructureContainingArrays() const bool isStructureContainingArrays() const;
{ bool isStructureContainingType(TBasicType t) const;
if (!typeSpecifierNonArray.userDef) void setArraySize(int s);
{ void clearArrayness();
return false; bool isAggregate() const;
}
return typeSpecifierNonArray.userDef->containsArrays(); TTypeSpecifierNonArray typeSpecifierNonArray;
} TLayoutQualifier layoutQualifier;
TMemoryQualifier memoryQualifier;
bool isStructureContainingType(TBasicType t) const TQualifier qualifier;
{ bool invariant;
if (!typeSpecifierNonArray.userDef) TPrecision precision;
{ bool array;
return false; int arraySize;
}
return typeSpecifierNonArray.userDef->containsType(t);
}
void setArraySize(int s)
{
array = true;
arraySize = s;
}
void clearArrayness()
{
array = false;
arraySize = 0;
}
bool isAggregate() const
{
return array || typeSpecifierNonArray.isMatrix() || typeSpecifierNonArray.isVector();
}
}; };
} // namespace sh } // namespace sh
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment