From: qining Date: Fri, 26 Aug 2016 15:54:36 +0000 (-0400) Subject: Add a method in the types to check whether there is no decoration on a X-Git-Tag: upstream/2018.6~1096 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec07a0772409e48e0abde8ded16aaa2bb3b4660d;p=platform%2Fupstream%2FSPIRV-Tools.git Add a method in the types to check whether there is no decoration on a type. --- diff --git a/source/opt/types.h b/source/opt/types.h index c085b1e..0286d8d 100644 --- a/source/opt/types.h +++ b/source/opt/types.h @@ -84,6 +84,11 @@ class Type { // Returns a human-readable string to represent this type. virtual std::string str() const = 0; + // Returns true if there is no decoration on this type. For struct types, + // returns true only when there is no decoration for both the struct type + // and the struct members. + virtual bool decoration_empty() const { return decorations_.empty(); } + // A bunch of methods for casting this type to a given type. Returns this if the // cast can be done, nullptr otherwise. #define DeclareCastMethod(target) \ @@ -271,6 +276,9 @@ class Struct : public Type { bool IsSame(Type* that) const override; std::string str() const override; + bool decoration_empty() const override { + return decorations_.empty() && element_decorations_.empty(); + } Struct* AsStruct() override { return this; } const Struct* AsStruct() const override { return this; }