Пример #1
0
func (a nameAttribute) Apply(v llvm.Value) {
	if !v.IsAFunction().IsNil() {
		name := string(a)
		curr := v.GlobalParent().NamedFunction(name)
		if !curr.IsNil() && curr != v {
			if curr.BasicBlocksCount() != 0 {
				panic(fmt.Errorf("Want to take the name %s from a function that has a body!", name))
			}
			curr.SetName(name + "_llgo_replaced")
			curr.ReplaceAllUsesWith(llvm.ConstBitCast(v, curr.Type()))
		}
		v.SetName(name)
	} else {
		v.SetName(string(a))
	}
}