aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-09-06 16:44:16 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-09-06 16:44:16 +0000
commit2d234d73f687428c89f8a99af94f123012f05551 (patch)
tree54a33471e620ac4d8558e9043bec5bec07f0ae7a
parent2d40d9e3bd6638399260332d8c7a98ac715f7b0d (diff)
Fixing the return type information for objc_sync_enter and objc_sync_exit. Patch thanks to Joe Ranieri!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163330 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGObjCMac.cpp8
-rw-r--r--lib/Rewrite/Frontend/RewriteModernObjC.cpp4
-rw-r--r--lib/Rewrite/Frontend/RewriteObjC.cpp4
-rw-r--r--test/CodeGenObjC/arc.m4
-rw-r--r--test/CodeGenObjC/synchronized.m8
5 files changed, 14 insertions, 14 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 9a61e34ab2..08e706c82e 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -433,19 +433,19 @@ public:
/// SyncEnterFn - LLVM object_sync_enter function.
llvm::Constant *getSyncEnterFn() {
- // void objc_sync_enter (id)
+ // int objc_sync_enter (id)
llvm::Type *args[] = { ObjectPtrTy };
llvm::FunctionType *FTy =
- llvm::FunctionType::get(CGM.VoidTy, args, false);
+ llvm::FunctionType::get(CGM.IntTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_sync_enter");
}
/// SyncExitFn - LLVM object_sync_exit function.
llvm::Constant *getSyncExitFn() {
- // void objc_sync_exit (id)
+ // int objc_sync_exit (id)
llvm::Type *args[] = { ObjectPtrTy };
llvm::FunctionType *FTy =
- llvm::FunctionType::get(CGM.VoidTy, args, false);
+ llvm::FunctionType::get(CGM.IntTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_sync_exit");
}
diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index c735da03fd..0dbdbaee33 100644
--- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -5891,8 +5891,8 @@ void RewriteModernObjC::Initialize(ASTContext &context) {
Preamble += "(const char *);\n";
Preamble += "__OBJC_RW_DLLIMPORT void objc_exception_throw( struct objc_object *);\n";
// @synchronized hooks.
- Preamble += "__OBJC_RW_DLLIMPORT void objc_sync_enter( struct objc_object *);\n";
- Preamble += "__OBJC_RW_DLLIMPORT void objc_sync_exit( struct objc_object *);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT int objc_sync_enter( struct objc_object *);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT int objc_sync_exit( struct objc_object *);\n";
Preamble += "__OBJC_RW_DLLIMPORT Protocol *objc_getProtocol(const char *);\n";
Preamble += "#ifndef __FASTENUMERATIONSTATE\n";
Preamble += "struct __objcFastEnumerationState {\n\t";
diff --git a/lib/Rewrite/Frontend/RewriteObjC.cpp b/lib/Rewrite/Frontend/RewriteObjC.cpp
index 0b9e656418..5a0ac541be 100644
--- a/lib/Rewrite/Frontend/RewriteObjC.cpp
+++ b/lib/Rewrite/Frontend/RewriteObjC.cpp
@@ -5112,8 +5112,8 @@ void RewriteObjCFragileABI::Initialize(ASTContext &context) {
Preamble += "__OBJC_RW_DLLIMPORT int objc_exception_match";
Preamble += "(struct objc_class *, struct objc_object *);\n";
// @synchronized hooks.
- Preamble += "__OBJC_RW_DLLIMPORT void objc_sync_enter(struct objc_object *);\n";
- Preamble += "__OBJC_RW_DLLIMPORT void objc_sync_exit(struct objc_object *);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT int objc_sync_enter(struct objc_object *);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT int objc_sync_exit(struct objc_object *);\n";
Preamble += "__OBJC_RW_DLLIMPORT Protocol *objc_getProtocol(const char *);\n";
Preamble += "#ifndef __FASTENUMERATIONSTATE\n";
Preamble += "struct __objcFastEnumerationState {\n\t";
diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m
index 66a6a2f54b..d6bce5f87d 100644
--- a/test/CodeGenObjC/arc.m
+++ b/test/CodeGenObjC/arc.m
@@ -1358,9 +1358,9 @@ void test59(void) {
// CHECK: define void @test59()
// CHECK: [[T0:%.*]] = call i8* @test59_getlock()
// CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
- // CHECK-NEXT: call void @objc_sync_enter(i8* [[T1]])
+ // CHECK-NEXT: call i32 @objc_sync_enter(i8* [[T1]])
// CHECK-NEXT: call void @test59_body()
- // CHECK-NEXT: call void @objc_sync_exit(i8* [[T1]])
+ // CHECK-NEXT: call i32 @objc_sync_exit(i8* [[T1]])
// CHECK-NEXT: call void @objc_release(i8* [[T1]])
// CHECK-NEXT: ret void
}
diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m
index 1f012820f9..e927882b3f 100644
--- a/test/CodeGenObjC/synchronized.m
+++ b/test/CodeGenObjC/synchronized.m
@@ -11,7 +11,7 @@
// CHECK: define internal void @"\01-[MyClass method]"
- (void)method
{
- // CHECK: call void @objc_sync_enter
+ // CHECK: call i32 @objc_sync_enter
// CHECK: call void @objc_exception_try_enter
// CHECK: call i32 @_setjmp
@synchronized(self) {
@@ -26,21 +26,21 @@ void foo(id a) {
// CHECK: [[SYNC:%.*]] = alloca i8*
// CHECK: store i8* [[AVAL:%.*]], i8** [[A]]
- // CHECK-NEXT: call void @objc_sync_enter(i8* [[AVAL]])
+ // CHECK-NEXT: call i32 @objc_sync_enter(i8* [[AVAL]])
// CHECK-NEXT: store i8* [[AVAL]], i8** [[SYNC]]
// CHECK-NEXT: call void @objc_exception_try_enter
// CHECK: call i32 @_setjmp
@synchronized(a) {
// This is unreachable, but the optimizers can't know that.
// CHECK: call void asm sideeffect "", "=*m,=*m,=*m"(i8** [[A]], i8** [[SYNC]]
- // CHECK: call void @objc_sync_exit
+ // CHECK: call i32 @objc_sync_exit
// CHECK: call i8* @objc_exception_extract
// CHECK: call void @objc_exception_throw
// CHECK: unreachable
// CHECK: call void @objc_exception_try_exit
// CHECK: [[T:%.*]] = load i8** [[SYNC]]
- // CHECK-NEXT: call void @objc_sync_exit
+ // CHECK-NEXT: call i32 @objc_sync_exit
// CHECK: ret void
return;
}