github.com/llir/llvm@v0.3.6/asm/enum/checksumkind_string2enum.go (about) 1 // Code generated by "string2enum -linecomment -type ChecksumKind ../../ir/enum"; DO NOT EDIT. 2 3 package enum 4 5 import ( 6 "fmt" 7 8 "github.com/llir/llvm/ir/enum" 9 ) 10 11 func _() { 12 // An "invalid array index" compiler error signifies that the constant values have changed. 13 // Re-run the string2enum command to generate them again. 14 var x [1]struct{} 15 _ = x[enum.ChecksumKindMD5-1] 16 _ = x[enum.ChecksumKindSHA1-2] 17 } 18 19 const _ChecksumKind_name = "CSK_MD5CSK_SHA1" 20 21 var _ChecksumKind_index = [...]uint8{0, 7, 15} 22 23 // ChecksumKindFromString returns the ChecksumKind enum corresponding to s. 24 func ChecksumKindFromString(s string) enum.ChecksumKind { 25 if len(s) == 0 { 26 return 0 27 } 28 for i := range _ChecksumKind_index[:len(_ChecksumKind_index)-1] { 29 if s == _ChecksumKind_name[_ChecksumKind_index[i]:_ChecksumKind_index[i+1]] { 30 return enum.ChecksumKind(i + 1) 31 } 32 } 33 panic(fmt.Errorf("unable to locate ChecksumKind enum corresponding to %q", s)) 34 } 35 36 func _(s string) { 37 // Check for duplicate string values in type "ChecksumKind". 38 switch s { 39 // 1 40 case "CSK_MD5": 41 // 2 42 case "CSK_SHA1": 43 } 44 }