should not be mangled either. Fixes radar
8016412.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107303
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!FD) {
const DeclContext *DC = D->getDeclContext();
// Check for extern variable declared locally.
- if (isa<FunctionDecl>(DC) && D->hasLinkage())
+ if ((isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC) ) && D->hasLinkage())
while (!DC->isNamespace() && !DC->isTranslationUnit())
DC = DC->getParent();
if (DC->isTranslationUnit() && D->getLinkage() != InternalLinkage)
--- /dev/null
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: @gGlobals = external global
+
+@interface I
+- (int) Meth;
+@end
+
+@implementation I
+- (int) Meth {
+ extern int gGlobals;
+ return gGlobals;
+}
+@end