From 27f67c5ad59f05c58ac92c36044ae513a5701927 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 19 Nov 2013 04:08:34 +0000 Subject: [PATCH] Improving calling convention test coverage by adding tests for things not currently handled. Specifically: the diagnostics in SemaDeclAttr.cpp, and ensuring that calling convention attributes are applied to ObjC method declarations. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195098 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenObjC/attr-callconv.m | 11 +++++++++++ test/Sema/callingconv.c | 2 ++ test/SemaObjC/method-attributes.m | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 test/CodeGenObjC/attr-callconv.m diff --git a/test/CodeGenObjC/attr-callconv.m b/test/CodeGenObjC/attr-callconv.m new file mode 100644 index 0000000000..bfc8a191cd --- /dev/null +++ b/test/CodeGenObjC/attr-callconv.m @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +@interface Test +- (void)test; +@end + +@implementation Test +- (void)test __attribute__((stdcall)) { + // CHECK: define{{.*}}x86_stdcallcc{{.*}}Test test +} +@end diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c index 500c0fbfb2..f9fa9fef2b 100644 --- a/test/Sema/callingconv.c +++ b/test/Sema/callingconv.c @@ -66,3 +66,5 @@ void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {} typedef void typedef_fun_t(int); typedef_fun_t typedef_fun; // expected-note {{previous declaration is here}} void __attribute__((stdcall)) typedef_fun(int x) { } // expected-error {{function declared 'stdcall' here was previously declared without calling convention}} + +struct type_test {} __attribute__((stdcall)); // expected-warning {{'stdcall' attribute only applies to functions and methods}} diff --git a/test/SemaObjC/method-attributes.m b/test/SemaObjC/method-attributes.m index b402d52a42..2e794b9de9 100644 --- a/test/SemaObjC/method-attributes.m +++ b/test/SemaObjC/method-attributes.m @@ -7,6 +7,7 @@ - (NSString *)stringByAppendingFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); -(void) m0 __attribute__((noreturn)); -(void) m1 __attribute__((unused)); +-(void) m2 __attribute__((stdcall)); @end @@ -84,3 +85,7 @@ return self; } @end + +__attribute__((cdecl)) // expected-warning {{'cdecl' attribute only applies to functions and methods}} +@interface Complain +@end -- 2.40.0