1 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s 2 3 %swift_error = type {i64, i8} 4 5 ; CHECK: swifterror value can only be loaded and stored from, or as a swifterror argument! 6 ; CHECK: %swift_error** %error_ptr_ref 7 ; CHECK: %t = getelementptr inbounds %swift_error*, %swift_error** %error_ptr_ref, i64 1 8 define float @foo(%swift_error** swifterror %error_ptr_ref) { 9 %t = getelementptr inbounds %swift_error*, %swift_error** %error_ptr_ref, i64 1 10 ret float 1.0 11 } 12 13 ; CHECK: swifterror argument for call has mismatched alloca 14 ; CHECK: %error_ptr_ref = alloca %swift_error* 15 ; CHECK: %call = call float @foo(%swift_error** swifterror %error_ptr_ref) 16 define float @caller(i8* %error_ref) { 17 entry: 18 %error_ptr_ref = alloca %swift_error* 19 store %swift_error* null, %swift_error** %error_ptr_ref 20 %call = call float @foo(%swift_error** swifterror %error_ptr_ref) 21 ret float 1.0 22 } 23 24 ; CHECK: Cannot have multiple 'swifterror' parameters! 25 declare void @a(i32** swifterror %a, i32** swifterror %b) 26 27 ; CHECK: Attribute 'swifterror' only applies to parameters with pointer type! 28 declare void @b(i32 swifterror %a) 29 30 ; CHECK: Attribute 'swifterror' only applies to parameters with pointer to pointer type! 31 declare void @c(i32* swifterror %a) 32