Skip to content

Commit f443900

Browse files
YazZz1klanza
authored andcommitted
[CIR][CIRGen][Bugfix] Fix source location in ctors (#415)
1 parent 6e1677c commit f443900

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,8 @@ void CIRGenFunction::buildNullabilityCheck(LValue LHS, mlir::Value RHS,
657657
void CIRGenFunction::buildScalarInit(const Expr *init, mlir::Location loc,
658658
LValue lvalue, bool capturedByInit) {
659659
// TODO: this is where a lot of ObjC lifetime stuff would be done.
660-
mlir::Value value = buildScalarExpr(init);
661660
SourceLocRAIIObject Loc{*this, loc};
661+
mlir::Value value = buildScalarExpr(init);
662662
buildStoreThroughLValue(RValue::get(value), lvalue);
663663
return;
664664
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
2+
// RUN: FileCheck --input-file=%t.cir %s
3+
4+
struct e { e(int); };
5+
e *g = new e(0);
6+
7+
//CHECK: {{%.*}} = cir.const(#cir.int<1> : !u64i) : !u64i loc(#loc11)
8+
//CHECK: {{%.*}} = cir.call @_Znwm(%1) : (!u64i) -> !cir.ptr<!void> loc(#loc6)

0 commit comments

Comments
 (0)