[llvm] r239772 - Add safestack attribute to LLVMAttribute enum and Go bindings. Correct

Peter Collingbourne peter at pcc.me.uk
Mon Jun 15 15:16:51 PDT 2015


Author: pcc
Date: Mon Jun 15 17:16:51 2015
New Revision: 239772

URL: http://llvm.org/viewvc/llvm-project?rev=239772&view=rev
Log:
Add safestack attribute to LLVMAttribute enum and Go bindings. Correct
constants in commented-out part of LLVMAttribute enum. Add tests that verify
that the safestack attribute is only allowed as a function attribute.

Added:
    llvm/trunk/test/Assembler/invalid-safestack-param.ll
    llvm/trunk/test/Assembler/invalid-safestack-return.ll
Modified:
    llvm/trunk/bindings/go/llvm/ir.go
    llvm/trunk/bindings/go/llvm/ir_test.go
    llvm/trunk/include/llvm-c/Core.h

Modified: llvm/trunk/bindings/go/llvm/ir.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/ir.go?rev=239772&r1=239771&r2=239772&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir.go (original)
+++ llvm/trunk/bindings/go/llvm/ir.go Mon Jun 15 17:16:51 2015
@@ -160,6 +160,8 @@ const (
 	InAllocaAttribute           Attribute = 1 << 43
 	NonNullAttribute            Attribute = 1 << 44
 	JumpTableAttribute          Attribute = 1 << 45
+	ConvergentAttribute         Attribute = 1 << 46
+	SafeStackAttribute          Attribute = 1 << 47
 )
 
 //-------------------------------------------------------------------------

Modified: llvm/trunk/bindings/go/llvm/ir_test.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/ir_test.go?rev=239772&r1=239771&r2=239772&view=diff
==============================================================================
--- llvm/trunk/bindings/go/llvm/ir_test.go (original)
+++ llvm/trunk/bindings/go/llvm/ir_test.go Mon Jun 15 17:16:51 2015
@@ -53,6 +53,7 @@ func TestAttributes(t *testing.T) {
 		{AlwaysInlineAttribute, "alwaysinline"},
 		{BuiltinAttribute, "builtin"},
 		{ByValAttribute, "byval"},
+		{ConvergentAttribute, "convergent"},
 		{InAllocaAttribute, "inalloca"},
 		{InlineHintAttribute, "inlinehint"},
 		{InRegAttribute, "inreg"},
@@ -78,6 +79,7 @@ func TestAttributes(t *testing.T) {
 		{ReturnedAttribute, "returned"},
 		{ReturnsTwiceAttribute, "returns_twice"},
 		{SExtAttribute, "signext"},
+		{SafeStackAttribute, "safestack"},
 		{StackProtectAttribute, "ssp"},
 		{StackProtectReqAttribute, "sspreq"},
 		{StackProtectStrongAttribute, "sspstrong"},

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=239772&r1=239771&r2=239772&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Jun 15 17:16:51 2015
@@ -161,15 +161,15 @@ typedef enum {
     /* FIXME: These attributes are currently not included in the C API as
        a temporary measure until the API/ABI impact to the C API is understood
        and the path forward agreed upon.
-    LLVMAddressSafety = 1ULL << 32,
-    LLVMStackProtectStrongAttribute = 1ULL<<33,
-    LLVMCold = 1ULL << 34,
-    LLVMOptimizeNone = 1ULL << 35,
-    LLVMInAllocaAttribute = 1ULL << 36,
-    LLVMNonNullAttribute = 1ULL << 37,
-    LLVMJumpTableAttribute = 1ULL << 38,
-    LLVMDereferenceableAttribute = 1ULL << 39,
-    LLVMDereferenceableOrNullAttribute = 1ULL << 40,
+    LLVMSanitizeAddressAttribute = 1ULL << 32,
+    LLVMStackProtectStrongAttribute = 1ULL<<35,
+    LLVMColdAttribute = 1ULL << 40,
+    LLVMOptimizeNoneAttribute = 1ULL << 42,
+    LLVMInAllocaAttribute = 1ULL << 43,
+    LLVMNonNullAttribute = 1ULL << 44,
+    LLVMJumpTableAttribute = 1ULL << 45,
+    LLVMConvergentAttribute = 1ULL << 46,
+    LLVMSafeStackAttribute = 1ULL << 47,
     */
 } LLVMAttribute;
 

Added: llvm/trunk/test/Assembler/invalid-safestack-param.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-safestack-param.ll?rev=239772&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-safestack-param.ll (added)
+++ llvm/trunk/test/Assembler/invalid-safestack-param.ll Mon Jun 15 17:16:51 2015
@@ -0,0 +1,4 @@
+; RUN: not llvm-as -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: error: invalid use of function-only attribute
+declare void @foo(i32 safestack %x)

Added: llvm/trunk/test/Assembler/invalid-safestack-return.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-safestack-return.ll?rev=239772&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-safestack-return.ll (added)
+++ llvm/trunk/test/Assembler/invalid-safestack-return.ll Mon Jun 15 17:16:51 2015
@@ -0,0 +1,4 @@
+; RUN: not llvm-as -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: error: invalid use of function-only attribute
+declare safestack void @foo()





More information about the llvm-commits mailing list