Skip to content

Commit 4450b3e

Browse files
committed
fix enum starting with a number
1 parent 60f1df8 commit 4450b3e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/spirv/unified1/spirv.hpp11

+3-3
Original file line numberDiff line numberDiff line change
@@ -3220,9 +3220,9 @@ inline const char* StorageClassToString(StorageClass value) {
32203220

32213221
inline const char* DimToString(Dim value) {
32223222
switch (value) {
3223-
case Dim::1D: return "1D";
3224-
case Dim::2D: return "2D";
3225-
case Dim::3D: return "3D";
3223+
case Dim::Dim1D: return "1D";
3224+
case Dim::Dim2D: return "2D";
3225+
case Dim::Dim3D: return "3D";
32263226
case Dim::Cube: return "Cube";
32273227
case Dim::Rect: return "Rect";
32283228
case Dim::Buffer: return "Buffer";

tools/buildHeaders/header.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ IN THE MATERIALS.
513513
virtual std::string pre() const { return ""; } // C name prefix
514514
virtual std::string headerGuardSuffix() const = 0;
515515

516-
virtual std::string fmtEnumUse(const std::string& opPrefix, const std::string& opEnum, const std::string& name) const { return pre() + opPrefix + name; }
516+
virtual std::string fmtEnumUse(const std::string &opPrefix, const std::string &opEnum, const std::string &name) const { return pre() + opPrefix + name; }
517517

518518
void printUtility(std::ostream& out) const override
519519
{
@@ -710,7 +710,7 @@ IN THE MATERIALS.
710710
}
711711

712712
// Add type prefix for scoped enum
713-
std::string fmtEnumUse(const std::string& opPrefix, const std::string& opEnum, const std::string& name) const override { return opEnum + "::" + name; }
713+
std::string fmtEnumUse(const std::string& opPrefix, const std::string& opEnum, const std::string& name) const override { return opEnum + "::" + prependIfDigit(opEnum, name); }
714714

715715
std::string headerGuardSuffix() const override { return "HPP"; }
716716
};

0 commit comments

Comments
 (0)