Skip to content

Commit 4109e82

Browse files
committed
[nfc] Fix leak after creating ItaniumMangleContext.
We need to delete the `MangleContext` after we create it. This follows the existing use of `ItaniumMangleContext::create` in ASTMangler.cpp and a similar change in llvm here: llvm/llvm-project/commit/8b5783194ced98cabaa585678cacaf7c2e2763d8
1 parent bc15343 commit 4109e82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/ClangImporter/ImportName.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,9 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
20852085
auto &astContext = classTemplateSpecDecl->getASTContext();
20862086
// Itanium mangler produces valid Swift identifiers, use it to generate a name for
20872087
// this instantiation.
2088-
clang::MangleContext *mangler = clang::ItaniumMangleContext::create(
2089-
astContext, astContext.getDiagnostics());
2088+
std::unique_ptr<clang::MangleContext> mangler{
2089+
clang::ItaniumMangleContext::create(astContext,
2090+
astContext.getDiagnostics())};
20902091
llvm::SmallString<128> storage;
20912092
llvm::raw_svector_ostream buffer(storage);
20922093
mangler->mangleTypeName(astContext.getRecordType(classTemplateSpecDecl),

0 commit comments

Comments
 (0)