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

     1  // Code generated by "string2enum -linecomment -type AtomicOrdering ../../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.AtomicOrderingNone-0]
    16  	_ = x[enum.AtomicOrderingUnordered-1]
    17  	_ = x[enum.AtomicOrderingMonotonic-2]
    18  	_ = x[enum.AtomicOrderingAcquire-4]
    19  	_ = x[enum.AtomicOrderingRelease-5]
    20  	_ = x[enum.AtomicOrderingAcquireRelease-6]
    21  	_ = x[enum.AtomicOrderingSequentiallyConsistent-7]
    22  }
    23  
    24  const (
    25  	_AtomicOrdering_name_0 = "noneunorderedmonotonic"
    26  	_AtomicOrdering_name_1 = "acquirereleaseacq_relseq_cst"
    27  )
    28  
    29  var (
    30  	_AtomicOrdering_index_0 = [...]uint8{0, 4, 13, 22}
    31  	_AtomicOrdering_index_1 = [...]uint8{0, 7, 14, 21, 28}
    32  )
    33  
    34  // AtomicOrderingFromString returns the AtomicOrdering enum corresponding to s.
    35  func AtomicOrderingFromString(s string) enum.AtomicOrdering {
    36  	if len(s) == 0 {
    37  		return 0
    38  	}
    39  	for i := range _AtomicOrdering_index_0[:len(_AtomicOrdering_index_0)-1] {
    40  		if s == _AtomicOrdering_name_0[_AtomicOrdering_index_0[i]:_AtomicOrdering_index_0[i+1]] {
    41  			return enum.AtomicOrdering(i + 0)
    42  		}
    43  	}
    44  	for i := range _AtomicOrdering_index_1[:len(_AtomicOrdering_index_1)-1] {
    45  		if s == _AtomicOrdering_name_1[_AtomicOrdering_index_1[i]:_AtomicOrdering_index_1[i+1]] {
    46  			return enum.AtomicOrdering(i + 4)
    47  		}
    48  	}
    49  	panic(fmt.Errorf("unable to locate AtomicOrdering enum corresponding to %q", s))
    50  }
    51  
    52  func _(s string) {
    53  	// Check for duplicate string values in type "AtomicOrdering".
    54  	switch s {
    55  	// 0
    56  	case "none":
    57  	// 1
    58  	case "unordered":
    59  	// 2
    60  	case "monotonic":
    61  	// 4
    62  	case "acquire":
    63  	// 5
    64  	case "release":
    65  	// 6
    66  	case "acq_rel":
    67  	// 7
    68  	case "seq_cst":
    69  	}
    70  }