github.com/llir/llvm@v0.3.6/asm/enum/preemption_string2enum.go (about) 1 // Code generated by "string2enum -linecomment -type Preemption ../../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.PreemptionNone-0] 16 _ = x[enum.PreemptionDSOLocal-1] 17 _ = x[enum.PreemptionDSOLocalEquivalent-2] 18 _ = x[enum.PreemptionDSOPreemptable-3] 19 } 20 21 const _Preemption_name = "nonedso_localdso_local_equivalentdso_preemptable" 22 23 var _Preemption_index = [...]uint8{0, 4, 13, 33, 48} 24 25 // PreemptionFromString returns the Preemption enum corresponding to s. 26 func PreemptionFromString(s string) enum.Preemption { 27 if len(s) == 0 { 28 return 0 29 } 30 for i := range _Preemption_index[:len(_Preemption_index)-1] { 31 if s == _Preemption_name[_Preemption_index[i]:_Preemption_index[i+1]] { 32 return enum.Preemption(i) 33 } 34 } 35 panic(fmt.Errorf("unable to locate Preemption enum corresponding to %q", s)) 36 } 37 38 func _(s string) { 39 // Check for duplicate string values in type "Preemption". 40 switch s { 41 // 0 42 case "none": 43 // 1 44 case "dso_local": 45 // 2 46 case "dso_local_equivalent": 47 // 3 48 case "dso_preemptable": 49 } 50 }