From 030017a4855c7b6e7f2ff8d9566c146f31eb301b Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Wed, 06 Dec 2017 14:06:53 -0800 Subject: [PATCH] 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/812220 Reviewed-by: Jamie Madill Commit-Queue: Kai Ninomiya --- diff --git a/third_party/angle/src/compiler/translator/StaticType.h b/third_party/angle/src/compiler/translator/StaticType.h index e26e5ff..30b391a 100644 --- a/third_party/angle/src/compiler/translator/StaticType.h +++ b/third_party/angle/src/compiler/translator/StaticType.h @@ -160,7 +160,7 @@ TPrecision precision, TQualifier qualifier, unsigned char secondarySize> -const TType *GetForVecMatHelper(unsigned char primarySize) +constexpr const TType *GetForVecMatHelper(unsigned char primarySize) { static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt || basicType == EbtBool, @@ -186,7 +186,7 @@ template -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 || basicType == EbtBool, @@ -208,7 +208,7 @@ } template -const TType *GetForVec(TQualifier qualifier, unsigned char size) +constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size) { switch (qualifier) { diff --git a/third_party/angle/src/compiler/translator/SymbolTable.cpp b/third_party/angle/src/compiler/translator/SymbolTable.cpp index adf1e4e..90d4c15 100644 --- a/third_party/angle/src/compiler/translator/SymbolTable.cpp +++ b/third_party/angle/src/compiler/translator/SymbolTable.cpp @@ -236,7 +236,7 @@ pop(); } -bool IsGenType(const TType *type) +constexpr bool IsGenType(const TType *type) { if (type) { @@ -248,7 +248,7 @@ return false; } -bool IsVecType(const TType *type) +constexpr bool IsVecType(const TType *type) { if (type) { diff --git a/third_party/angle/src/compiler/translator/Types.h b/third_party/angle/src/compiler/translator/Types.h index 04f46f1..a54d447 100644 --- a/third_party/angle/src/compiler/translator/Types.h +++ b/third_party/angle/src/compiler/translator/Types.h @@ -142,13 +142,13 @@ { } - TBasicType getBasicType() const { return type; } + constexpr TBasicType getBasicType() const { return type; } void setBasicType(TBasicType t); TPrecision getPrecision() const { return precision; } void setPrecision(TPrecision p) { precision = p; } - TQualifier getQualifier() const { return qualifier; } + constexpr TQualifier getQualifier() const { return qualifier; } void setQualifier(TQualifier q) { qualifier = q; } bool isInvariant() const { return invariant; }