summaryrefslogtreecommitdiff
path: root/test/Bindings
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2016-11-15 22:19:59 +0000
committerAmaury Sechet <deadalnix@gmail.com>2016-11-15 22:19:59 +0000
commitb451ba82e0adb61c59b574b374a6f10d3bc6350d (patch)
treed8096cd389e82ee3c96bc2f27f640fa4a794cd02 /test/Bindings
parent0f0347373785b27ebdabb01555077267e0733593 (diff)
[C API] Prevent nullptr dereferences in C API for counting attributes.
See https://reviews.llvm.org/D26392 Patch by @maleadt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287044 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bindings')
-rw-r--r--test/Bindings/llvm-c/callsite_attributes.ll12
-rw-r--r--test/Bindings/llvm-c/function_attributes.ll7
2 files changed, 19 insertions, 0 deletions
diff --git a/test/Bindings/llvm-c/callsite_attributes.ll b/test/Bindings/llvm-c/callsite_attributes.ll
new file mode 100644
index 00000000000..4b4e488a695
--- /dev/null
+++ b/test/Bindings/llvm-c/callsite_attributes.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-c-test --test-callsite-attributes < %t.bc
+; This used to segfault
+
+define void @Y() {
+ ret void
+}
+
+define void @X() {
+ call void @X()
+ ret void
+}
diff --git a/test/Bindings/llvm-c/function_attributes.ll b/test/Bindings/llvm-c/function_attributes.ll
new file mode 100644
index 00000000000..9aa1787fde7
--- /dev/null
+++ b/test/Bindings/llvm-c/function_attributes.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-c-test --test-function-attributes < %t.bc
+; This used to segfault
+
+define void @X() {
+ ret void
+}