Commit 030017a4 by Kai Ninomiya Committed by Commit Bot

Mark StaticType related functions as constexpr

Fixes compilation on some versions of GCC and probably Clang. Follow-up to http://crrev.com/c/786317 Bug: angleproject:1432 Change-Id: I3fc3ad0f65492f9543eb27fcdce6ca29a9ad06e5 Reviewed-on: https://chromium-review.googlesource.com/812220Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
parent 43fd0d44
...@@ -160,7 +160,7 @@ template <TBasicType basicType, ...@@ -160,7 +160,7 @@ template <TBasicType basicType,
TPrecision precision, TPrecision precision,
TQualifier qualifier, TQualifier qualifier,
unsigned char secondarySize> unsigned char secondarySize>
const TType *GetForVecMatHelper(unsigned char primarySize) constexpr const TType *GetForVecMatHelper(unsigned char primarySize)
{ {
static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt || static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
basicType == EbtBool, basicType == EbtBool,
...@@ -186,7 +186,7 @@ const TType *GetForVecMatHelper(unsigned char primarySize) ...@@ -186,7 +186,7 @@ const TType *GetForVecMatHelper(unsigned char primarySize)
template <TBasicType basicType, template <TBasicType basicType,
TPrecision precision = EbpUndefined, TPrecision precision = EbpUndefined,
TQualifier qualifier = EvqGlobal> TQualifier qualifier = EvqGlobal>
const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1) constexpr const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1)
{ {
static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt || static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
basicType == EbtBool, basicType == EbtBool,
...@@ -208,7 +208,7 @@ const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize ...@@ -208,7 +208,7 @@ const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize
} }
template <TBasicType basicType, TPrecision precision = EbpUndefined> template <TBasicType basicType, TPrecision precision = EbpUndefined>
const TType *GetForVec(TQualifier qualifier, unsigned char size) constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size)
{ {
switch (qualifier) switch (qualifier)
{ {
......
...@@ -236,7 +236,7 @@ TSymbolTable::~TSymbolTable() ...@@ -236,7 +236,7 @@ TSymbolTable::~TSymbolTable()
pop(); pop();
} }
bool IsGenType(const TType *type) constexpr bool IsGenType(const TType *type)
{ {
if (type) if (type)
{ {
...@@ -248,7 +248,7 @@ bool IsGenType(const TType *type) ...@@ -248,7 +248,7 @@ bool IsGenType(const TType *type)
return false; return false;
} }
bool IsVecType(const TType *type) constexpr bool IsVecType(const TType *type)
{ {
if (type) if (type)
{ {
......
...@@ -142,13 +142,13 @@ class TType ...@@ -142,13 +142,13 @@ class TType
{ {
} }
TBasicType getBasicType() const { return type; } constexpr TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t); void setBasicType(TBasicType t);
TPrecision getPrecision() const { return precision; } TPrecision getPrecision() const { return precision; }
void setPrecision(TPrecision p) { precision = p; } void setPrecision(TPrecision p) { precision = p; }
TQualifier getQualifier() const { return qualifier; } constexpr TQualifier getQualifier() const { return qualifier; }
void setQualifier(TQualifier q) { qualifier = q; } void setQualifier(TQualifier q) { qualifier = q; }
bool isInvariant() const { return invariant; } bool isInvariant() const { return invariant; }
......
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