[PATCH] D26234: [Frontend] Add a predefined macro that describes the Objective-C bool type

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 03:15:20 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287529: [Frontend] Add a predefined macro that describes the Objective-C bool type (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D26234?vs=76680&id=78698#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26234

Files:
  cfe/trunk/lib/Frontend/InitPreprocessor.cpp
  cfe/trunk/test/Frontend/objc-bool-is-bool.m


Index: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp
@@ -591,6 +591,9 @@
         Builder.defineMacro("OBJC_ZEROCOST_EXCEPTIONS");
     }
 
+    Builder.defineMacro("__OBJC_BOOL_IS_BOOL",
+                        Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
+
     if (LangOpts.getGC() != LangOptions::NonGC)
       Builder.defineMacro("__OBJC_GC__");
 
Index: cfe/trunk/test/Frontend/objc-bool-is-bool.m
===================================================================
--- cfe/trunk/test/Frontend/objc-bool-is-bool.m
+++ cfe/trunk/test/Frontend/objc-bool-is-bool.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7k-apple-watchos %s | FileCheck --check-prefix=BOOL %s
+// RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=NONE %s
+
+// rdar://21170440
+
+// BOOL: #define __OBJC_BOOL_IS_BOOL 1
+// BOOL-NOT: #define __OBJC_BOOL_IS_BOOL 0
+
+// CHAR: #define __OBJC_BOOL_IS_BOOL 0
+// CHAR-NOT: #define __OBJC_BOOL_IS_BOOL 1
+
+// NONE-NOT: __OBJC_BOOL_IS_BOOL


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26234.78698.patch
Type: text/x-patch
Size: 1315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161121/fbf440dc/attachment.bin>


More information about the cfe-commits mailing list