aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-14 16:42:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-14 16:42:16 +0000
commit49f59ec45bf469c700603a656282cf86f1bce382 (patch)
treeb79dc2b1eaa0d94fa5f16bb4127e795bb0045028
parent501c5ce63c2ff54c103fbab8c1c45234d5a82a57 (diff)
Skip the asm prefix when storing the name in block info.
- Otherwise we emit internal names with embedded '\01' characters, which confuses some tools. - Ideally all the code which wants to get a "display name" for the given function should follow one code path, but this should be a monotonic improvement for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71774 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGBlocks.h8
-rw-r--r--test/CodeGenObjC/blocks.m11
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/CodeGen/CGBlocks.h b/lib/CodeGen/CGBlocks.h
index e065e003d4..56d3a2d3b1 100644
--- a/lib/CodeGen/CGBlocks.h
+++ b/lib/CodeGen/CGBlocks.h
@@ -140,7 +140,7 @@ public:
/// BlockLiteralTy - The type of the block literal.
const llvm::Type *BlockLiteralTy;
- /// Name - the name of the function this block was created for, if any
+ /// Name - the name of the function this block was created for, if any.
const char *Name;
/// ByCopyDeclRefs - Variables from parent scopes that have been imported
@@ -152,7 +152,11 @@ public:
llvm::SmallVector<const BlockDeclRefExpr *, 8> ByRefDeclRefs;
BlockInfo(const llvm::Type *blt, const char *n)
- : BlockLiteralTy(blt), Name(n) {}
+ : BlockLiteralTy(blt), Name(n) {
+ // Skip asm prefix, if any.
+ if (Name && Name[0] == '\01')
+ ++Name;
+ }
};
CGBuilderTy &Builder;
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index da11561295..18c455ad9e 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -fblocks -S -o - %s
+// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s &&
// rdar://6676764
struct S {
@@ -19,9 +19,18 @@ void foo(T *P) {
-(void) im0;
@end
+// RUN: grep 'define internal i32 @"__-\[A im0\]_block_invoke_"' %t &&
+@implementation A
+-(void) im0 {
+ (void) ^{ return 1; }();
+}
+@end
+
@interface B : A @end
@implementation B
-(void) im1 {
^(void) { [super im0]; }();
}
@end
+
+// RUN: true