[PATCH] D88497: [objc] Fix memory leak in CGObjCMac.cpp
Ellis Hoag via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 29 11:01:44 PDT 2020
ellis updated this revision to Diff 295055.
ellis added a subscriber: vsapsai.
ellis added a comment.
Herald added a reviewer: JDevlieghere.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fix a comment to reference the correct method.
Thanks to @vsapsai for pointing this out.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88497/new/
https://reviews.llvm.org/D88497
Files:
clang/lib/CodeGen/CGObjCMac.cpp
llvm/tools/dsymutil/SymbolMap.cpp
Index: llvm/tools/dsymutil/SymbolMap.cpp
===================================================================
--- llvm/tools/dsymutil/SymbolMap.cpp
+++ llvm/tools/dsymutil/SymbolMap.cpp
@@ -47,7 +47,7 @@
return Translation;
// Objective-C symbols for the MachO symbol table start with a \1. Please see
- // `CGObjCCommonMac::GetNameForMethod` in clang.
+ // `MangleContext::mangleObjCMethodName` in clang.
if (Translation[0] == 1)
return StringRef(Translation).drop_front();
Index: clang/lib/CodeGen/CGObjCMac.cpp
===================================================================
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -1079,8 +1079,9 @@
void EmitImageInfo();
public:
- CGObjCCommonMac(CodeGen::CodeGenModule &cgm) :
- CGObjCRuntime(cgm), VMContext(cgm.getLLVMContext()) { }
+ CGObjCCommonMac(CodeGen::CodeGenModule &cgm)
+ : CGObjCRuntime(cgm), VMContext(cgm.getLLVMContext()),
+ Mangler(cgm.getContext().createMangleContext()) {}
bool isNonFragileABI() const {
return ObjCABI == 2;
@@ -1121,6 +1122,7 @@
private:
void fillRunSkipBlockVars(CodeGenModule &CGM, const CGBlockInfo &blockInfo);
+ std::unique_ptr<MangleContext> Mangler;
};
namespace {
@@ -4003,9 +4005,8 @@
} else {
SmallString<256> Name;
llvm::raw_svector_ostream OS(Name);
- const auto &MC = CGM.getContext().createMangleContext();
- MC->mangleObjCMethodName(OMD, OS, /*includePrefixByte=*/true,
- /*includeCategoryNamespace=*/true);
+ Mangler->mangleObjCMethodName(OMD, OS, /*includePrefixByte=*/true,
+ /*includeCategoryNamespace=*/true);
CodeGenTypes &Types = CGM.getTypes();
llvm::FunctionType *MethodTy =
@@ -4059,9 +4060,8 @@
} else {
SmallString<256> Name;
llvm::raw_svector_ostream OS(Name);
- const auto &MC = CGM.getContext().createMangleContext();
- MC->mangleObjCMethodName(OMD, OS, /*includePrefixByte=*/true,
- /*includeCategoryNamespace=*/false);
+ Mangler->mangleObjCMethodName(OMD, OS, /*includePrefixByte=*/true,
+ /*includeCategoryNamespace=*/false);
Fn = llvm::Function::Create(MethodTy, llvm::GlobalValue::ExternalLinkage,
Name.str(), &CGM.getModule());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88497.295055.patch
Type: text/x-patch
Size: 2362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200929/590baa2c/attachment.bin>
More information about the cfe-commits
mailing list