[cfe-commits] r61880 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/category-super-class-meth.m
Fariborz Jahanian
fjahanian at apple.com
Wed Jan 7 12:11:22 PST 2009
Author: fjahanian
Date: Wed Jan 7 14:11:22 2009
New Revision: 61880
URL: http://llvm.org/viewvc/llvm-project?rev=61880&view=rev
Log:
Another nasty code gen. bug with trivial fix. Calling class
method on 'super' receiver in a category implementation.
Other simpler cases were working by accident.
Added:
cfe/trunk/test/CodeGenObjC/category-super-class-meth.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=61880&r1=61879&r2=61880&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Jan 7 14:11:22 2009
@@ -1244,7 +1244,9 @@
// if know when we entered/exitted an implementation block.
// Check for an existing forward reference.
- if (llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name)) {
+ // Previously, metaclass with internal linkage may have been defined.
+ // pass 'true' as 2nd argument so it is returned.
+ if (llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true)) {
assert(GV->getType()->getElementType() == ObjCTypes.ClassTy &&
"Forward metaclass reference has incorrect type.");
return GV;
Added: cfe/trunk/test/CodeGenObjC/category-super-class-meth.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/category-super-class-meth.m?rev=61880&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/category-super-class-meth.m (added)
+++ cfe/trunk/test/CodeGenObjC/category-super-class-meth.m Wed Jan 7 14:11:22 2009
@@ -0,0 +1,19 @@
+// RUN: clang -emit-llvm -o %t %s
+
+ at interface BASE
++ (int) BaseMeth;
+ at end
+
+ at interface Child: BASE
+ at end
+
+ at interface Child (Categ)
++ (int) flushCache2;
+ at end
+
+ at implementation Child @end
+
+ at implementation Child (Categ)
++ (int) flushCache2 { [super BaseMeth]; }
+ at end
+
More information about the cfe-commits
mailing list