Skip to content

Commit 9ca40f1

Browse files
authored
Merge pull request #40109 from zoecarver/fix-leak-mangler
[nfc] Fix leak after creating `ItaniumMangleContext`.
2 parents ebafda8 + 4109e82 commit 9ca40f1

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)