]> granicus.if.org Git - clang/commitdiff
Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
authorDavid Chisnall <csdavec@swan.ac.uk>
Tue, 3 Jul 2012 20:49:52 +0000 (20:49 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Tue, 3 Jul 2012 20:49:52 +0000 (20:49 +0000)
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

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

18 files changed:
include/clang/Basic/ObjCRuntime.h
lib/Basic/ObjCRuntime.cpp
lib/CodeGen/CGException.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Driver/ToolChain.cpp
lib/Driver/Tools.cpp
test/CodeGenObjC/bitfield-gnu.m
test/CodeGenObjC/bitfield_encoding.m
test/CodeGenObjC/constant-strings.m
test/CodeGenObjC/gnu-exceptions.m
test/CodeGenObjC/messages.m
test/CodeGenObjC/undefined-protocol.m
test/Coverage/codegen-gnu.m
test/Driver/gnu-runtime.m
test/Preprocessor/init.c
test/Preprocessor/non_fragile_feature1.m

index 1be3b142c3ef7dc4901d25779454e4de33be28a7..9212a8bf9504f3ff43e9f53c2d3a4ca63f130d94 100644 (file)
@@ -40,11 +40,12 @@ public:
     /// version of iOS.
     iOS,
 
-    /// 'gnu' is the non-fragile GNU runtime.
-    GNU,
+    /// 'gcc' is the Objective-C runtime shipped with GCC, implementing a
+    /// fragile Objective-C ABI
+    GCC,
 
-    /// 'gnu-fragile' is the fragile GNU runtime.
-    FragileGNU
+    /// 'gnustep' is the modern non-fragile GNUstep runtime.
+   GNUstep 
   };
 
 private:
@@ -71,9 +72,9 @@ public:
   bool isNonFragile() const {
     switch (getKind()) {
     case FragileMacOSX: return false;
-    case FragileGNU: return false;
+    case GCC: return false;
     case MacOSX: return true;
-    case GNU: return true;
+    case GNUstep: return true;
     case iOS: return true;
     }
     llvm_unreachable("bad kind");
@@ -83,15 +84,15 @@ public:
   /// implied behaviors for a "fragile" ABI?
   bool isFragile() const { return !isNonFragile(); }
 
-  /// \brief Is this runtime basically of the GNU family of runtimes?
+  /// \brief Is this runtime basically of the GNUstep family of runtimes?
   bool isGNUFamily() const {
     switch (getKind()) {
     case FragileMacOSX:
     case MacOSX:
     case iOS:
       return false;
-    case FragileGNU:
-    case GNU:
+    case GCC:
+    case GNUstep:
       return true;
     }
     llvm_unreachable("bad kind");
@@ -118,8 +119,8 @@ public:
     // This is really a lie, because some implementations and versions
     // of the runtime do not support ARC.  Probably -fgnu-runtime
     // should imply a "maximal" runtime or something?
-    case FragileGNU: return true;
-    case GNU: return true;
+    case GCC: return true;
+    case GNUstep: return true;
     }
     llvm_unreachable("bad kind");
   }
@@ -143,8 +144,8 @@ public:
     // This is really a lie, because some implementations and versions
     // of the runtime do not support ARC.  Probably -fgnu-runtime
     // should imply a "maximal" runtime or something?
-    case FragileGNU: return true;
-    case GNU: return true;
+    case GCC: return true;
+    case GNUstep: return true;
     }
     llvm_unreachable("bad kind");
   }
@@ -158,8 +159,8 @@ public:
     case FragileMacOSX: return getVersion() >= VersionTuple(10, 8);
     case MacOSX: return getVersion() >= VersionTuple(10, 8);
     case iOS: return getVersion() >= VersionTuple(5);
-    case FragileGNU: return false;
-    case GNU: return false;
+    case GCC: return false;
+    case GNUstep: return false;
     }
     llvm_unreachable("bad kind");
   }
@@ -170,8 +171,19 @@ public:
     case MacOSX: return true;
     case iOS: return true;
     case FragileMacOSX: return false;
-    case FragileGNU: return false;
-    case GNU: return false;
+    case GCC: return true;
+    case GNUstep: return true;
+    }
+    llvm_unreachable("bad kind");
+  }
+  /// \brief Does this runtime use zero-cost exceptions?
+  bool hasUnwindExceptions() const {
+    switch (getKind()) {
+    case MacOSX: return true;
+    case iOS: return true;
+    case FragileMacOSX: return false;
+    case GCC: return true;
+    case GNUstep: return true;
     }
     llvm_unreachable("bad kind");
   }
index d66da0706f36c0d9ca9e660daf34eb4c8c7f2221..0f30bfaa2c4a353c10fb1851abaf3b8e6fb96fe1 100644 (file)
@@ -30,8 +30,8 @@ raw_ostream &clang::operator<<(raw_ostream &out, const ObjCRuntime &value) {
   case ObjCRuntime::MacOSX: out << "macosx"; break;
   case ObjCRuntime::FragileMacOSX: out << "macosx-fragile"; break;
   case ObjCRuntime::iOS: out << "ios"; break;
-  case ObjCRuntime::GNU: out << "gnu"; break;
-  case ObjCRuntime::FragileGNU: out << "gnu-fragile"; break;
+  case ObjCRuntime::GNUstep: out << "gnustep"; break;
+  case ObjCRuntime::GCC: out << "gcc"; break;
   }
   if (value.getVersion() > VersionTuple(0)) {
     out << '-' << value.getVersion();
@@ -60,10 +60,10 @@ bool ObjCRuntime::tryParse(StringRef input) {
     kind = ObjCRuntime::FragileMacOSX;
   } else if (runtimeName == "ios") {
     kind = ObjCRuntime::iOS;
-  } else if (runtimeName == "gnu") {
-    kind = ObjCRuntime::GNU;
-  } else if (runtimeName == "gnu-fragile") {
-    kind = ObjCRuntime::FragileGNU;
+  } else if (runtimeName == "gnustep") {
+    kind = ObjCRuntime::GNUstep;
+  } else if (runtimeName == "gcc") {
+    kind = ObjCRuntime::GCC;
   } else {
     return true;
   }
index fb36715364ba2efd7f27b68b3dbc31bb3459fac8..2fdc74ce6d0960ac60ba264cc614ccce37e253c9 100644 (file)
@@ -186,8 +186,8 @@ static const EHPersonality &getObjCPersonality(const LangOptions &L) {
   case ObjCRuntime::MacOSX:
   case ObjCRuntime::iOS:
     return EHPersonality::NeXT_ObjC;
-  case ObjCRuntime::GNU:
-  case ObjCRuntime::FragileGNU:
+  case ObjCRuntime::GNUstep:
+  case ObjCRuntime::GCC:
     return EHPersonality::GNU_ObjC;
   }
   llvm_unreachable("bad runtime kind");
@@ -216,10 +216,11 @@ static const EHPersonality &getObjCXXPersonality(const LangOptions &L) {
   case ObjCRuntime::FragileMacOSX:
     return getCXXPersonality(L);
 
-  // The GNU runtime's personality function inherently doesn't support
+  // The GCC runtime's personality function inherently doesn't support
   // mixed EH.  Use the C++ personality just to avoid returning null.
-  case ObjCRuntime::GNU:
-  case ObjCRuntime::FragileGNU:
+  case ObjCRuntime::GCC:
+    return EHPersonality::GNU_ObjC;
+  case ObjCRuntime::GNUstep:
     return EHPersonality::GNU_ObjCXX;
   }
   llvm_unreachable("bad runtime kind");
index a949436e8597c55524c2b1d2ad6de26f5e90faeb..686fb051b706f5decc19a55af3b4292b5ac384ea 100644 (file)
@@ -2666,10 +2666,10 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF,
 CGObjCRuntime *
 clang::CodeGen::CreateGNUObjCRuntime(CodeGenModule &CGM) {
   switch (CGM.getLangOpts().ObjCRuntime.getKind()) {
-  case ObjCRuntime::GNU:
+  case ObjCRuntime::GNUstep:
     return new CGObjCGNUstep(CGM);
 
-  case ObjCRuntime::FragileGNU:
+  case ObjCRuntime::GCC:
     return new CGObjCGCC(CGM);
 
   case ObjCRuntime::FragileMacOSX:
index 3eb5d5291dce0e7b6fc59b56398019d7ec9d1d53..3b7c238a8d5abf9ea51e9d347e2705682971fc5d 100644 (file)
@@ -6389,8 +6389,8 @@ CodeGen::CreateMacObjCRuntime(CodeGen::CodeGenModule &CGM) {
   case ObjCRuntime::iOS:
     return new CGObjCNonFragileABIMac(CGM);
 
-  case ObjCRuntime::GNU:
-  case ObjCRuntime::FragileGNU:
+  case ObjCRuntime::GNUstep:
+  case ObjCRuntime::GCC:
     llvm_unreachable("these runtimes are not Mac runtimes");
   }
   llvm_unreachable("bad runtime");
index ef20cf45562c9b6788b52843568d66b22104128c..bba3e7c5f755c0937add64eaa5461f4d7765ee17 100644 (file)
@@ -138,8 +138,8 @@ void CodeGenModule::createObjCRuntime() {
   // This is just isGNUFamily(), but we want to force implementors of
   // new ABIs to decide how best to do this.
   switch (LangOpts.ObjCRuntime.getKind()) {
-  case ObjCRuntime::GNU:
-  case ObjCRuntime::FragileGNU:
+  case ObjCRuntime::GNUstep:
+  case ObjCRuntime::GCC:
     ObjCRuntime = CreateGNUObjCRuntime(*this);
     return;
 
@@ -546,7 +546,7 @@ static bool hasUnwindExceptions(const LangOptions &LangOpts) {
 
   // If ObjC exceptions are enabled, this depends on the ABI.
   if (LangOpts.ObjCExceptions) {
-    if (LangOpts.ObjCRuntime.isFragile()) return false;
+    return LangOpts.ObjCRuntime.hasUnwindExceptions();
   }
 
   return true;
index 21aefb6439721c39b2bafe8693ec6bc95c690e8d..48ed044c8f5c985d9d1f50e225cfd77fc9620a6f 100644 (file)
@@ -50,7 +50,7 @@ bool ToolChain::HasNativeLLVMSupport() const {
 }
 
 ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const {
-  return ObjCRuntime(isNonFragile ? ObjCRuntime::GNU : ObjCRuntime::FragileGNU,
+  return ObjCRuntime(isNonFragile ? ObjCRuntime::GNUstep : ObjCRuntime::GCC,
                      VersionTuple());
 }
 
index 601ea54c2958e48cca318a770fdd6d061f2fa56f..01792ae11fa55d4bcc8bfdfd142dd8f6a9a983b6 100644 (file)
@@ -2934,7 +2934,7 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &args,
   // -fgnu-runtime
   } else {
     assert(runtimeArg->getOption().matches(options::OPT_fgnu_runtime));
-    runtime = ObjCRuntime(ObjCRuntime::GNU, VersionTuple());
+    runtime = ObjCRuntime(ObjCRuntime::GCC, VersionTuple());
   }
 
   cmdArgs.push_back(args.MakeArgString(
index 19c5cc4a08f364bcc5fb47a5085bc440fa13d74c..383907f15c5164b44535c134e78b5c208bc99c23 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang -S -emit-llvm -fobjc-runtime=gnu -o %t %s
+// RUN: %clang -S -emit-llvm -fobjc-runtime=gcc -o %t %s
 typedef enum { A1, A2 } A;
 typedef struct { A a : 1; } B;
 @interface Obj { B *b; } @end
index 0f26bcfdaf4c7c6c2e11e03bbf043fbb0ac9dac1..1a516aaf8619eeab5d7999a71ab89b6758e11ee7 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
 // RUN: grep "ib1b14" %t | count 1
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -fobjc-runtime=gcc -emit-llvm -o %t %s
 // RUN: grep "ib32i1b33i14" %t | count 1
 
 struct foo{
index 7d7f2408c6c73831246f4063dfdf95ecc0a8a6af..cad634a4b10395bf489591e5e146be84e692352c 100644 (file)
@@ -5,11 +5,11 @@
 //
 // CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", align 1
 
-// RUN: %clang_cc1 -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o %t %s
 // RUN: FileCheck --check-prefix=CHECK-GNU < %t %s
 // CHECK-GNU: NXConstantString
 
-// RUN: %clang_cc1 -fobjc-runtime=gnu -fconstant-string-class NSConstantString -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-runtime=gcc -fconstant-string-class NSConstantString -emit-llvm -o %t %s
 // RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s
 // CHECK-GNU-WITH-CLASS: NSConstantString
 id a = @"Hello World!";
index 0d8f7e67ed524b3432cce4234f3dbaf0faac31c7..141747ec8d3db5bea4c021b1fe6a5f4784506aaf 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gnu -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gcc -o - %s | FileCheck %s
 
 void opaque(void);
 void log(int i);
index 2dadec406c8349e2c654fd86b00efb15763737a2..a42677ef7849a5587b0bc20fcd9a25dc99772a19 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC
 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF
-// RUN: %clang_cc1 -fobjc-runtime=gnu-fragile -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
-// RUN: %clang_cc1 -fobjc-runtime=gnu -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
+// RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
+// RUN: %clang_cc1 -fobjc-runtime=gnustep -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
 
 typedef struct {
   int x;
index d998a6624234944ddef11eab403913675462940a..e5a72ab602f0497239849dc401e59809c97cbe29 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -fobjc-runtime=gnu %s
+// RUN: %clang_cc1 -emit-llvm-only -fobjc-runtime=gcc %s
 
 @protocol MadeUpProtocol;
 
index 540821388df74163eac7c20db57db7484db12f42..67f99064a6ab4e81a57b7f88fda23f07c3716888 100644 (file)
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-exceptions -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-exceptions -fobjc-runtime=gcc -emit-llvm -o %t %s
 
 #include "objc-language-features.inc"
index 7685cc6f67f57560c5ab272f8f4449d6532fefb7..1d7a40ab2b86b769186e59634120829f62340d72 100644 (file)
@@ -1,4 +1,4 @@
 // RUN: %clang -target i386-apple-darwin10 -### -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
 // RUN: %clang -target i386-apple-darwin10 -### -x objective-c++ -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
-// CHECK: -fobjc-runtime=gnu
+// CHECK: -fobjc-runtime=gcc
 // CHECK-NOT: fragile
index 8e08e239f1798da6c3cee9afb3b29f6a8c9c629c..9694aad3f341948399394b5f9d0e1d293e3a66f7 100644 (file)
@@ -85,7 +85,7 @@
 // C94:#define __STDC_VERSION__ 199409L
 //
 // 
-// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-runtime=gnu-fragile -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
+// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
 //
 // MSEXT-NOT:#define __STDC__
 // MSEXT:#define _INTEGRAL_MAX_BITS 64
 // X86_64-LINUX:#define __x86_64 1
 // X86_64-LINUX:#define __x86_64__ 1
 //
-// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gnu-fragile -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
+// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
 // GNUSOURCE:#define _GNU_SOURCE 1
 // 
 // RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -check-prefix NORTTI %s
index 7bd6a941ba6a60016e8b0a92720d3e9fa6fe2950..6ea7fa8b6c5a9b755af8b7b04479bbf40b62326c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=gnu-fragile %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=gcc %s
 #ifndef __has_feature
 #error Should have __has_feature
 #endif