Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,11 @@ LValue CIRGenFunction::emitLValue(const Expr *E) {
// bitfield lvalue or some other non-simple lvalue?
return LV;
}
case Expr::CXXDefaultArgExprClass: {
auto *DAE = cast<CXXDefaultArgExpr>(E);
CXXDefaultArgExprScope Scope(*this, DAE);
return emitLValue(DAE->getExpr());
}
case Expr::ParenExprClass:
return emitLValue(cast<ParenExpr>(E)->getSubExpr());
case Expr::DeclRefExprClass:
Expand Down
12 changes: 12 additions & 0 deletions clang/test/CIR/CodeGen/defaultarg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -std=c++17 %s -o - | FileCheck %s

void bar(const int &i = 42);

void foo() {
bar();
}

// CHECK: [[TMP0:%.*]] = cir.alloca !s32i
// CHECK: [[TMP1:%.*]] = cir.const #cir.int<42>
// CHECK: cir.store [[TMP1]], [[TMP0]]
// CHECK: cir.call @_Z3barRKi([[TMP0]])
Loading