[PATCH] D27474: [llgo] Remove support for LLVM attributes

Meador Inge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 11:04:13 PST 2016


meadori created this revision.
meadori added a reviewer: pcc.
meadori added a subscriber: llvm-commits.

llgo supports the application of LLVM attributes to global objects
and functions.  This "feature" is undocumented and untested.  As
discusses in https://reviews.llvm.org/D27442, it should be removed.


https://reviews.llvm.org/D27474

Files:
  irgen/attribute.go


Index: irgen/attribute.go
===================================================================
--- irgen/attribute.go
+++ irgen/attribute.go
@@ -74,8 +74,6 @@
 		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 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27474.80451.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161206/672f8bbb/attachment.bin>


More information about the llvm-commits mailing list