Skip to content

Commit 0c0c4ea

Browse files
committed
[ClangImporter] Use new CXXThisExpr::Create function
The constructor takes a new arg which `Create` now handles. Use it instead.
1 parent b330550 commit 0c0c4ea

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/ClangImporter/ClangDerivedConformances.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ instantiateTemplatedOperator(ClangImporter::Implementation &impl,
264264

265265
clang::UnresolvedSet<1> ops;
266266
auto qualType = clang::QualType(classDecl->getTypeForDecl(), 0);
267-
auto arg = new (clangCtx)
268-
clang::CXXThisExpr(clang::SourceLocation(), qualType, false);
267+
auto arg = clang::CXXThisExpr::Create(clangCtx, clang::SourceLocation(),
268+
qualType, false);
269269
arg->setType(clang::QualType(classDecl->getTypeForDecl(), 0));
270270

271271
clang::OverloadedOperatorKind opKind =

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5211,9 +5211,9 @@ static clang::CXXMethodDecl *synthesizeCxxBaseGetterAccessorMethod(
52115211

52125212
// Returns the expression that accesses the base field from derived type.
52135213
auto createFieldAccess = [&]() -> clang::Expr * {
5214-
auto *thisExpr = new (clangCtx)
5215-
clang::CXXThisExpr(clang::SourceLocation(), newMethod->getThisType(),
5216-
/*IsImplicit=*/false);
5214+
auto *thisExpr = clang::CXXThisExpr::Create(
5215+
clangCtx, clang::SourceLocation(), newMethod->getThisType(),
5216+
/*IsImplicit=*/false);
52175217
clang::QualType baseClassPtr = clangCtx.getRecordType(baseClass);
52185218
baseClassPtr.addConst();
52195219
baseClassPtr = clangCtx.getPointerType(baseClassPtr);

lib/ClangImporter/SwiftDeclSynthesizer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,8 +2114,9 @@ clang::CXXMethodDecl *SwiftDeclSynthesizer::synthesizeCXXForwardingMethod(
21142114
auto diagState = clangSema.DelayedDiagnostics.push(diagPool);
21152115

21162116
// Construct the method's body.
2117-
clang::Expr *thisExpr = new (clangCtx) clang::CXXThisExpr(
2118-
clang::SourceLocation(), newMethod->getThisType(), /*IsImplicit=*/false);
2117+
clang::Expr *thisExpr = clang::CXXThisExpr::Create(
2118+
clangCtx, clang::SourceLocation(), newMethod->getThisType(),
2119+
/*IsImplicit=*/false);
21192120
if (castThisToNonConstThis) {
21202121
auto baseClassPtr =
21212122
clangCtx.getPointerType(clangCtx.getRecordType(derivedClass));

0 commit comments

Comments
 (0)