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

     1  // Code generated by "string2enum -linecomment -type Linkage ../../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.LinkageNone-0]
    16  	_ = x[enum.LinkageAppending-1]
    17  	_ = x[enum.LinkageAvailableExternally-2]
    18  	_ = x[enum.LinkageCommon-3]
    19  	_ = x[enum.LinkageInternal-4]
    20  	_ = x[enum.LinkageLinkOnce-5]
    21  	_ = x[enum.LinkageLinkOnceODR-6]
    22  	_ = x[enum.LinkagePrivate-7]
    23  	_ = x[enum.LinkageWeak-8]
    24  	_ = x[enum.LinkageWeakODR-9]
    25  	_ = x[enum.LinkageExternal-10]
    26  	_ = x[enum.LinkageExternWeak-11]
    27  }
    28  
    29  const _Linkage_name = "noneappendingavailable_externallycommoninternallinkoncelinkonce_odrprivateweakweak_odrexternalextern_weak"
    30  
    31  var _Linkage_index = [...]uint8{0, 4, 13, 33, 39, 47, 55, 67, 74, 78, 86, 94, 105}
    32  
    33  // LinkageFromString returns the Linkage enum corresponding to s.
    34  func LinkageFromString(s string) enum.Linkage {
    35  	if len(s) == 0 {
    36  		return 0
    37  	}
    38  	for i := range _Linkage_index[:len(_Linkage_index)-1] {
    39  		if s == _Linkage_name[_Linkage_index[i]:_Linkage_index[i+1]] {
    40  			return enum.Linkage(i)
    41  		}
    42  	}
    43  	panic(fmt.Errorf("unable to locate Linkage enum corresponding to %q", s))
    44  }
    45  
    46  func _(s string) {
    47  	// Check for duplicate string values in type "Linkage".
    48  	switch s {
    49  	// 0
    50  	case "none":
    51  	// 1
    52  	case "appending":
    53  	// 2
    54  	case "available_externally":
    55  	// 3
    56  	case "common":
    57  	// 4
    58  	case "internal":
    59  	// 5
    60  	case "linkonce":
    61  	// 6
    62  	case "linkonce_odr":
    63  	// 7
    64  	case "private":
    65  	// 8
    66  	case "weak":
    67  	// 9
    68  	case "weak_odr":
    69  	// 10
    70  	case "external":
    71  	// 11
    72  	case "extern_weak":
    73  	}
    74  }