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

     1  // Code generated by "string2enum -linecomment -type DwarfMacinfo ../../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.DwarfMacinfoDefine-1]
    16  	_ = x[enum.DwarfMacinfoUndef-2]
    17  	_ = x[enum.DwarfMacinfoStartFile-3]
    18  	_ = x[enum.DwarfMacinfoEndFile-4]
    19  	_ = x[enum.DwarfMacinfoVendorExt-255]
    20  }
    21  
    22  const (
    23  	_DwarfMacinfo_name_0 = "DW_MACINFO_defineDW_MACINFO_undefDW_MACINFO_start_fileDW_MACINFO_end_file"
    24  	_DwarfMacinfo_name_1 = "DW_MACINFO_vendor_ext"
    25  )
    26  
    27  var (
    28  	_DwarfMacinfo_index_0 = [...]uint8{0, 17, 33, 54, 73}
    29  )
    30  
    31  // DwarfMacinfoFromString returns the DwarfMacinfo enum corresponding to s.
    32  func DwarfMacinfoFromString(s string) enum.DwarfMacinfo {
    33  	if len(s) == 0 {
    34  		return 0
    35  	}
    36  	for i := range _DwarfMacinfo_index_0[:len(_DwarfMacinfo_index_0)-1] {
    37  		if s == _DwarfMacinfo_name_0[_DwarfMacinfo_index_0[i]:_DwarfMacinfo_index_0[i+1]] {
    38  			return enum.DwarfMacinfo(i + 1)
    39  		}
    40  	}
    41  	if s == _DwarfMacinfo_name_1 {
    42  		return enum.DwarfMacinfo(255)
    43  	}
    44  	panic(fmt.Errorf("unable to locate DwarfMacinfo enum corresponding to %q", s))
    45  }
    46  
    47  func _(s string) {
    48  	// Check for duplicate string values in type "DwarfMacinfo".
    49  	switch s {
    50  	// 1
    51  	case "DW_MACINFO_define":
    52  	// 2
    53  	case "DW_MACINFO_undef":
    54  	// 3
    55  	case "DW_MACINFO_start_file":
    56  	// 4
    57  	case "DW_MACINFO_end_file":
    58  	// 255
    59  	case "DW_MACINFO_vendor_ext":
    60  	}
    61  }