mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 01:29:52 +00:00
extern variable declared locally to objective-c++ method
should not be mangled either. Fixes radar 8016412. llvm-svn: 107303
This commit is contained in:
parent
c39d3497c8
commit
0f19afb9d4
@ -294,7 +294,7 @@ bool MangleContext::shouldMangleDeclName(const NamedDecl *D) {
|
||||
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)
|
||||
|
14
clang/test/CodeGenObjCXX/method-local-extern-mangle.mm
Normal file
14
clang/test/CodeGenObjCXX/method-local-extern-mangle.mm
Normal file
@ -0,0 +1,14 @@
|
||||
// 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
|
Loading…
Reference in New Issue
Block a user