forked from OSchip/llvm-project
[llgo] Remove support for LLVM attributes
llgo supports the application of LLVM attributes to global objects and functions. This "feature" is undocumented and untested. As discusses in D27442, it should be removed. Differential Revision: https://reviews.llvm.org/D27474 llvm-svn: 288843
This commit is contained in:
parent
dd6ca639d5
commit
e6c29d6d85
|
@ -74,8 +74,6 @@ func parseAttribute(line string) Attribute {
|
|||
return parseLinkageAttribute(value)
|
||||
case "name":
|
||||
return nameAttribute(strings.TrimSpace(value))
|
||||
case "attr":
|
||||
return parseLLVMAttribute(strings.TrimSpace(value))
|
||||
case "thread_local":
|
||||
return tlsAttribute{}
|
||||
default:
|
||||
|
@ -142,36 +140,6 @@ func (a nameAttribute) Apply(v llvm.Value) {
|
|||
}
|
||||
}
|
||||
|
||||
func parseLLVMAttribute(value string) llvmAttribute {
|
||||
var result llvmAttribute
|
||||
value = strings.Replace(value, ",", " ", -1)
|
||||
for _, field := range strings.Fields(value) {
|
||||
switch strings.ToLower(field) {
|
||||
case "noreturn":
|
||||
case "nounwind":
|
||||
case "noinline":
|
||||
case "alwaysinline":
|
||||
kind := llvm.AttributeKindID(strings.ToLower(field))
|
||||
result.AttrKinds = append(result.AttrKinds, kind)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
type llvmAttribute struct {
|
||||
AttrKinds []uint
|
||||
}
|
||||
|
||||
func (a llvmAttribute) Apply(v llvm.Value) {
|
||||
ctx := v.GlobalParent().Context()
|
||||
if !v.IsAFunction().IsNil() {
|
||||
for _, kind := range a.AttrKinds {
|
||||
attr := ctx.CreateEnumAttribute(kind, 0)
|
||||
v.AddFunctionAttr(attr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type tlsAttribute struct{}
|
||||
|
||||
func (tlsAttribute) Apply(v llvm.Value) {
|
||||
|
|
Loading…
Reference in New Issue