summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-07 05:41:24 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-07 05:41:24 +0000
commit48b35d9a14236468d484954b747de39468bb8f91 (patch)
tree8d9801c242eff8976df39550f9689f021d76d2e4
parent65ca292a8d3f11d54f8066aa4882321a1dcd75f9 (diff)
downloadbcm5719-llvm-48b35d9a14236468d484954b747de39468bb8f91.tar.gz
bcm5719-llvm-48b35d9a14236468d484954b747de39468bb8f91.zip
Fix off-by-one error in block mangling.
This restores the ABI prior to r214699. llvm-svn: 312700
-rw-r--r--clang/lib/AST/ItaniumMangle.cpp4
-rw-r--r--clang/test/CodeGenObjCXX/mangle-blocks.mm10
2 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 5372cad2999..1c90419ca97 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -1669,6 +1669,10 @@ void CXXNameMangler::mangleUnqualifiedBlock(const BlockDecl *Block) {
// the symbol in question isn't externally visible.
if (!Number)
Number = Context.getBlockId(Block, false);
+ else {
+ // Stored mangling numbers are 1-based.
+ --Number;
+ }
Out << "Ub";
if (Number > 0)
Out << Number - 1;
diff --git a/clang/test/CodeGenObjCXX/mangle-blocks.mm b/clang/test/CodeGenObjCXX/mangle-blocks.mm
index 283996d18aa..bbe5c1f77f4 100644
--- a/clang/test/CodeGenObjCXX/mangle-blocks.mm
+++ b/clang/test/CodeGenObjCXX/mangle-blocks.mm
@@ -1,8 +1,9 @@
// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s
-// CHECK: @_ZZZN26externally_visible_statics1S3fooEiEd_Ub0_E1k = linkonce_odr global i32 0
-// CHECK: @_ZZZN26externally_visible_statics10inlinefuncEvEUb0_E1i = linkonce_odr global i32 0
-// CHECK: @_ZZ26externally_visible_statics1S1xMUb0_E1j = linkonce_odr global i32 0
+// CHECK-DAG: @_ZZZN26externally_visible_statics1S3fooEiEd_Ub_E1k = linkonce_odr global i32 0
+// CHECK-DAG: @_ZZZN26externally_visible_statics10inlinefuncEvEUb_E1i = linkonce_odr global i32 0
+// CHECK-DAG: @_ZZZN26externally_visible_statics10inlinefuncEvEUb0_E1j = linkonce_odr global i32 0
+// CHECK-DAG: @_ZZ26externally_visible_statics1S1xMUb_E1j = linkonce_odr global i32 0
int f();
@@ -68,6 +69,9 @@ namespace externally_visible_statics {
^{
static int i = f();
}();
+ ^{
+ static int j = f();
+ }();
}
struct S {
int x = ^{
OpenPOWER on IntegriCloud