AST: Fix the mangling for unqualified-blocks
CXXNameMangler::mangleUnqualifiedBlock believed that MangleContext::getBlockId returned something that used Itanium-style discriminator numbers. Discriminator numbers start their numberign from 1 and the first mangling that actually gets any sort of number mangled in is the second discriminator. However, Block IDs start from zero. The logic for omitting the mangling number did a ' > 1' instead of a ' > 0' comparison; this could potentially cause mangling conflicts. llvm-svn: 214699
This commit is contained in:
parent
37bffb6f3a
commit
11d2427b21
|
@ -1409,8 +1409,8 @@ void CXXNameMangler::mangleUnqualifiedBlock(const BlockDecl *Block) {
|
|||
if (!Number)
|
||||
Number = Context.getBlockId(Block, false);
|
||||
Out << "Ub";
|
||||
if (Number > 1)
|
||||
Out << Number - 2;
|
||||
if (Number > 0)
|
||||
Out << Number - 1;
|
||||
Out << '_';
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s
|
||||
|
||||
// CHECK: @_ZGVZZ3foovEUb_E5value = internal global i64 0
|
||||
// CHECK: @_ZZZN26externally_visible_statics1S3fooEiEd_Ub_E1k = linkonce_odr global i32 0
|
||||
// CHECK: @_ZZ26externally_visible_statics1S1xMUb_E1j = linkonce_odr global i32 0
|
||||
// CHECK: @_ZZZN26externally_visible_statics10inlinefuncEvEUb_E1i = linkonce_odr global i32 0
|
||||
// CHECK: @_ZZZN26externally_visible_statics1S3fooEiEd_Ub0_E1k = linkonce_odr global i32 0
|
||||
// CHECK: @_ZZ26externally_visible_statics1S1xMUb0_E1j = linkonce_odr global i32 0
|
||||
// CHECK: @_ZZZN26externally_visible_statics10inlinefuncEvEUb0_E1i = linkonce_odr global i32 0
|
||||
|
||||
int f();
|
||||
|
||||
|
@ -27,7 +26,7 @@ int i = ^(int x) { return x;}(i);
|
|||
- (void)method {
|
||||
// CHECK: define internal signext i8 @"__11-[A method]_block_invoke"
|
||||
(void)^(int x) {
|
||||
// CHECK: @"_ZZZ11-[A method]EUb0_E4name"
|
||||
// CHECK: @"_ZZZ11-[A method]EUb1_E4name"
|
||||
static const char *name = "hello";
|
||||
return name[x];
|
||||
};
|
||||
|
@ -45,7 +44,7 @@ namespace N {
|
|||
// CHECK-LABEL: define internal signext i8 @___Z3fooi_block_invoke
|
||||
void bar() {
|
||||
(void)^(int x) {
|
||||
// CHECK: @_ZZZN1N3barEvEUb2_E4name
|
||||
// CHECK: @_ZZZN1N3barEvEUb3_E4name
|
||||
static const char *name = "hello";
|
||||
return name[x];
|
||||
};
|
||||
|
@ -57,7 +56,7 @@ class C {
|
|||
};
|
||||
C::C() {
|
||||
(void)^(int x) {
|
||||
// CHECK: @_ZZZN1CC1EvEUb3_E5nameb
|
||||
// CHECK: @_ZZZN1CC1EvEUb4_E5nameb
|
||||
static const char *nameb = "hello";
|
||||
return nameb[x];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue