Skip to content

Commit 72b4b2d

Browse files
committed
Address review feedback
1 parent 3b19527 commit 72b4b2d

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ void CIRGenFunction::emitExprAsInit(const Expr *init, const ValueDecl *d,
260260

261261
void CIRGenFunction::emitDecl(const Decl &d) {
262262
switch (d.getKind()) {
263+
case Decl::Record: // struct/union/class X;
264+
assert(!cir::MissingFeatures::generateDebugInfo());
265+
return;
263266
case Decl::Var: {
264267
const VarDecl &vd = cast<VarDecl>(d);
265268
assert(vd.isLocalVarDecl() &&
@@ -274,7 +277,9 @@ void CIRGenFunction::emitDecl(const Decl &d) {
274277
emitOpenACCRoutine(cast<OpenACCRoutineDecl>(d));
275278
return;
276279
default:
277-
cgm.errorNYI(d.getSourceRange(), "emitDecl: unhandled decl type");
280+
cgm.errorNYI(d.getSourceRange(),
281+
std::string("emitDecl: unhandled decl type: ") +
282+
d.getDeclKindName());
278283
}
279284
}
280285

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ std::string CIRGenTypes::getRecordTypeName(const clang::RecordDecl *recordDecl,
9797
policy.SuppressInlineNamespace = false;
9898

9999
if (recordDecl->getIdentifier()) {
100-
if (recordDecl->getDeclContext())
101-
recordDecl->printQualifiedName(outStream, policy);
102-
else
103-
recordDecl->printName(outStream, policy);
100+
recordDecl->printQualifiedName(outStream, policy);
104101

105102
// Ensure each template specialization has a unique name.
106103
if (auto *templateSpecialization =
@@ -116,10 +113,7 @@ std::string CIRGenTypes::getRecordTypeName(const clang::RecordDecl *recordDecl,
116113
outStream << '>';
117114
}
118115
} else if (auto *typedefNameDecl = recordDecl->getTypedefNameForAnonDecl()) {
119-
if (typedefNameDecl->getDeclContext())
120-
typedefNameDecl->printQualifiedName(outStream, policy);
121-
else
122-
typedefNameDecl->printName(outStream);
116+
typedefNameDecl->printQualifiedName(outStream, policy);
123117
} else {
124118
outStream << builder.getUniqueAnonRecordName();
125119
}

clang/test/CIR/CodeGen/struct.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ struct U *p;
1111
// CIR: cir.global external @p = #cir.ptr<null> : !cir.ptr<!cir.struct<struct "U" incomplete>>
1212
// LLVM: @p = dso_local global ptr null
1313
// OGCG: @p = global ptr null, align 8
14+
15+
void f(void) {
16+
struct U2 *p;
17+
}
18+
19+
// CIR: cir.func @f()
20+
// CIR-NEXT: cir.alloca !cir.ptr<!cir.struct<struct "U2" incomplete>>,
21+
// CIR-SAME: !cir.ptr<!cir.ptr<!cir.struct<struct "U2" incomplete>>>, ["p"]
22+
// CIR-NEXT: cir.return

clang/test/CIR/IR/struct.cir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: cir-opt %s | FileCheck %s
22

3-
!s32i = !cir.int<s, 32>
4-
53
module {
64
cir.global external @p = #cir.ptr<null> : !cir.ptr<!cir.struct<struct "U" incomplete>>
75
}

0 commit comments

Comments
 (0)