Skip to content

Commit f469a28

Browse files
committed
Address code review comments
1 parent 51882dd commit f469a28

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenCall.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ CIRGenFunctionInfo::create(CanQualType resultType,
4242
return fi;
4343
}
4444

45-
cir::FuncType CIRGenTypes::getFunctionType(const CIRGenFunctionInfo &fi) {
46-
mlir::Type resultType = convertType(fi.getReturnType());
45+
cir::FuncType CIRGenTypes::getFunctionType(const CIRGenFunctionInfo &info) {
46+
mlir::Type resultType = convertType(info.getReturnType());
4747
SmallVector<mlir::Type, 8> argTypes;
48-
argTypes.reserve(fi.getNumRequiredArgs());
48+
argTypes.reserve(info.getNumRequiredArgs());
4949

50-
for (const CanQualType &argType : fi.requiredArguments())
50+
for (const CanQualType &argType : info.requiredArguments())
5151
argTypes.push_back(convertType(argType));
5252

5353
return cir::FuncType::get(argTypes,
5454
(resultType ? resultType : builder.getVoidTy()),
55-
fi.isVariadic());
55+
info.isVariadic());
5656
}
5757

5858
CIRGenCallee CIRGenCallee::prepareConcreteCallee(CIRGenFunction &cgf) const {

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,8 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf,
11691169
->getBaseElementTypeUnsafe()
11701170
->getAs<clang::RecordType>()) {
11711171
// Get the destructor for the reference temporary.
1172-
auto *classDecl = cast<CXXRecordDecl>(rt->getOriginalDecl());
1172+
auto *classDecl =
1173+
cast<CXXRecordDecl>(rt->getOriginalDecl()->getDefinitionOrSelf());
11731174
if (!classDecl->hasTrivialDestructor())
11741175
referenceTemporaryDtor =
11751176
classDecl->getDefinitionOrSelf()->getDestructor();

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ static bool mayDropFunctionReturn(const ASTContext &astContext,
356356
// destructor or a non-trivially copyable type.
357357
if (const RecordType *recordType =
358358
returnType.getCanonicalType()->getAs<RecordType>()) {
359-
if (const auto *classDecl =
360-
dyn_cast<CXXRecordDecl>(recordType->getOriginalDecl()))
359+
if (const auto *classDecl = dyn_cast<CXXRecordDecl>(
360+
recordType->getOriginalDecl()->getDefinitionOrSelf()))
361361
return classDecl->hasTrivialDestructor();
362362
}
363363
return returnType.isTriviallyCopyableType(astContext);

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ isSafeToConvert(const RecordDecl *rd, CIRGenTypes &cgt,
139139
if (!alreadyChecked.insert(rd).second)
140140
return true;
141141

142+
assert(rd->isCompleteDefinition() &&
143+
"Expect RecordDecl to be CompleteDefinition");
142144
const Type *key = cgt.getASTContext().getCanonicalTagType(rd).getTypePtr();
143145

144146
// If this type is already laid out, converting it is a noop.

0 commit comments

Comments
 (0)