Skip to content

Commit 8e73928

Browse files
author
Fariborz Jahanian
committed
Fixes a typo which prevented proper code gen. for
copy-in of c++ class objects into blocks. llvm-svn: 105622
1 parent 4038cf4 commit 8e73928

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,8 +1764,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
17641764
if (!Res.isInvalid()) {
17651765
Res = MaybeCreateCXXExprWithTemporaries(move(Res));
17661766
Expr *Init = Res.takeAs<Expr>();
1767-
if (isa<CXXConstructExpr>(Init))
1768-
BDRE->setCopyConstructorExpr(Init);
1767+
BDRE->setCopyConstructorExpr(Init);
17691768
}
17701769
}
17711770
return Owned(BDRE);

clang/test/CodeGenCXX/copy-in-cplus-object.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
22

3+
struct S {
4+
S(const char *);
5+
~S();
6+
};
7+
38
struct TestObject
49
{
5-
TestObject(const TestObject& inObj, int def = 100);
10+
TestObject(const TestObject& inObj, int def = 100, const S &Silly = "silly");
611
TestObject();
712
TestObject& operator=(const TestObject& inObj);
813
int version() const;
@@ -14,5 +19,8 @@ void testRoutine() {
1419
int (^V)() = ^{ return one.version(); };
1520
}
1621

17-
// CHECK: call void @_ZN10TestObjectC1ERKS_i
22+
// CHECK: call void @_ZN10TestObjectC1Ev
23+
// CHECK: call void @_ZN1SC1EPKc
24+
// CHECK: call void @_ZN10TestObjectC1ERKS_iRK1S
25+
// CHECK: call void @_ZN1SD1Ev
1826

0 commit comments

Comments
 (0)