github.com/llir/llvm@v0.3.6/asm/enum/overflowflag_string2enum.go (about) 1 // Code generated by "string2enum -linecomment -type OverflowFlag ../../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.OverflowFlagNSW-0] 16 _ = x[enum.OverflowFlagNUW-1] 17 } 18 19 const _OverflowFlag_name = "nswnuw" 20 21 var _OverflowFlag_index = [...]uint8{0, 3, 6} 22 23 // OverflowFlagFromString returns the OverflowFlag enum corresponding to s. 24 func OverflowFlagFromString(s string) enum.OverflowFlag { 25 if len(s) == 0 { 26 return 0 27 } 28 for i := range _OverflowFlag_index[:len(_OverflowFlag_index)-1] { 29 if s == _OverflowFlag_name[_OverflowFlag_index[i]:_OverflowFlag_index[i+1]] { 30 return enum.OverflowFlag(i) 31 } 32 } 33 panic(fmt.Errorf("unable to locate OverflowFlag enum corresponding to %q", s)) 34 } 35 36 func _(s string) { 37 // Check for duplicate string values in type "OverflowFlag". 38 switch s { 39 // 0 40 case "nsw": 41 // 1 42 case "nuw": 43 } 44 }