github.com/llir/llvm@v0.3.6/asm/enum/visibility_string2enum.go (about)

     1  // Code generated by "string2enum -linecomment -type Visibility ../../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.VisibilityNone-0]
    16  	_ = x[enum.VisibilityDefault-1]
    17  	_ = x[enum.VisibilityHidden-2]
    18  	_ = x[enum.VisibilityProtected-3]
    19  }
    20  
    21  const _Visibility_name = "nonedefaulthiddenprotected"
    22  
    23  var _Visibility_index = [...]uint8{0, 4, 11, 17, 26}
    24  
    25  // VisibilityFromString returns the Visibility enum corresponding to s.
    26  func VisibilityFromString(s string) enum.Visibility {
    27  	if len(s) == 0 {
    28  		return 0
    29  	}
    30  	for i := range _Visibility_index[:len(_Visibility_index)-1] {
    31  		if s == _Visibility_name[_Visibility_index[i]:_Visibility_index[i+1]] {
    32  			return enum.Visibility(i)
    33  		}
    34  	}
    35  	panic(fmt.Errorf("unable to locate Visibility enum corresponding to %q", s))
    36  }
    37  
    38  func _(s string) {
    39  	// Check for duplicate string values in type "Visibility".
    40  	switch s {
    41  	// 0
    42  	case "none":
    43  	// 1
    44  	case "default":
    45  	// 2
    46  	case "hidden":
    47  	// 3
    48  	case "protected":
    49  	}
    50  }