[cfe-commits] r95005 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/objc2-legacy-dispatch.m

Daniel Dunbar daniel at zuster.org
Mon Feb 1 13:07:33 PST 2010


Author: ddunbar
Date: Mon Feb  1 15:07:33 2010
New Revision: 95005

URL: http://llvm.org/viewvc/llvm-project?rev=95005&view=rev
Log:
NeXT: Add support for -fobjc-legacy-dispatch.

Added:
    cfe/trunk/test/CodeGenObjC/objc2-legacy-dispatch.m
Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=95005&r1=95004&r2=95005&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Feb  1 15:07:33 2010
@@ -21,6 +21,7 @@
 #include "clang/AST/RecordLayout.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 
 #include "llvm/Intrinsics.h"
 #include "llvm/LLVMContext.h"
@@ -4224,6 +4225,9 @@
 /// message dispatch call for all the rest.
 ///
 bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) {
+  if (CGM.getCodeGenOpts().ObjCLegacyDispatch)
+    return true;
+
   if (NonLegacyDispatchMethods.empty()) {
     NonLegacyDispatchMethods.insert(GetNullarySelector("alloc"));
     NonLegacyDispatchMethods.insert(GetNullarySelector("class"));

Added: cfe/trunk/test/CodeGenObjC/objc2-legacy-dispatch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-legacy-dispatch.m?rev=95005&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-legacy-dispatch.m (added)
+++ cfe/trunk/test/CodeGenObjC/objc2-legacy-dispatch.m Mon Feb  1 15:07:33 2010
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
+//
+// CHECK_NEW_DISPATCH: define void @f0
+// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc
+// CHECK_NEW_DISPATCH: define void @f1
+// CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
+//
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
+//
+// CHECK_OLD_DISPATCH: define void @f0
+// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
+// CHECK_OLD_DISPATCH: define void @f1
+// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
+
+ at interface A
++(id) alloc;
+-(int) im0;
+ at end
+
+void f0(void) {
+  [A alloc];
+}
+
+void f1(A *a) {
+  [a im0];
+}





More information about the cfe-commits mailing list