]> granicus.if.org Git - clang/commitdiff
objc - fix up the builtin type for objc_assign_ivar.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 23 Aug 2011 23:33:09 +0000 (23:33 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 23 Aug 2011 23:33:09 +0000 (23:33 +0000)
// rdar://9362887.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138412 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Builtins.def
lib/AST/ASTContext.cpp
test/SemaObjC/builtin_objc_assign_ivar.m [new file with mode: 0644]

index f45ca4458f62acd6a5b59729dbb599e27a37f17e..d12a04d8f10b4d481f27c69679c96236c33aa09a 100644 (file)
@@ -35,6 +35,7 @@
 //  A -> "reference" to __builtin_va_list
 //  V -> Vector, following num elements and a base type.
 //  X -> _Complex, followed by the base type.
+//  Y -> ptrdiff_t
 //  P -> FILE
 //  J -> jmp_buf
 //  SJ -> sigjmp_buf
@@ -690,8 +691,7 @@ LIBBUILTIN(objc_read_weak, "GG*", "f", "/objc/objc-auto.h", OBJC_LANG)
 // id objc_assign_weak(id value, id *location)
 LIBBUILTIN(objc_assign_weak, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG)
 // id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
-// FIXME. Darwin has ptrdiff_t typedef'ed to int.
-LIBBUILTIN(objc_assign_ivar, "GGGi", "f", "/objc/objc-auto.h", OBJC_LANG)
+LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "/objc/objc-auto.h", OBJC_LANG)
 // id objc_assign_global(id val, id *dest)
 LIBBUILTIN(objc_assign_global, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG)
 // id objc_assign_strongCast(id val, id *dest
index 1b2c5cf418760297e53d3cd63059fd21fa24838a..75a573e301b0a228529724f34ed8fef03a48363f 100644 (file)
@@ -6140,7 +6140,11 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
     assert(!RequiresICE && "Can't require complex ICE");
     Type = Context.getComplexType(ElementType);
     break;
-  }      
+  }  
+  case 'Y' : {
+    Type = Context.getPointerDiffType();
+    break;
+  }
   case 'P':
     Type = Context.getFILEType();
     if (Type.isNull()) {
diff --git a/test/SemaObjC/builtin_objc_assign_ivar.m b/test/SemaObjC/builtin_objc_assign_ivar.m
new file mode 100644 (file)
index 0000000..5839bf4
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
+// rdar://9362887
+
+typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
+extern id objc_assign_ivar(id value, id dest, ptrdiff_t offset);
+