[PATCH] D51137: [clang-doc] Fix memory leaks
Julie Hockett via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 24 09:44:34 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL340620: [clang-doc] Fix memory leaks (authored by juliehockett, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51137?vs=162081&id=162399#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51137
Files:
clang-tools-extra/trunk/clang-doc/Representation.h
clang-tools-extra/trunk/clang-doc/Serialize.cpp
Index: clang-tools-extra/trunk/clang-doc/Representation.h
===================================================================
--- clang-tools-extra/trunk/clang-doc/Representation.h
+++ clang-tools-extra/trunk/clang-doc/Representation.h
@@ -162,6 +162,8 @@
Info(const Info &Other) = delete;
Info(Info &&Other) = default;
+ virtual ~Info() = default;
+
SymbolID USR =
SymbolID(); // Unique identifier for the decl described by this Info.
const InfoType IT = InfoType::IT_default; // InfoType of this particular Info.
Index: clang-tools-extra/trunk/clang-doc/Serialize.cpp
===================================================================
--- clang-tools-extra/trunk/clang-doc/Serialize.cpp
+++ clang-tools-extra/trunk/clang-doc/Serialize.cpp
@@ -361,7 +361,7 @@
I->USR = Func.Namespace[0].USR;
else
I->USR = SymbolID();
- I->ChildFunctions.push_back(std::move(Func));
+ I->ChildFunctions.emplace_back(std::move(Func));
return std::unique_ptr<Info>{std::move(I)};
}
@@ -382,7 +382,7 @@
// Wrap in enclosing scope
auto I = llvm::make_unique<RecordInfo>();
I->USR = ParentUSR;
- I->ChildFunctions.push_back(std::move(Func));
+ I->ChildFunctions.emplace_back(std::move(Func));
return std::unique_ptr<Info>{std::move(I)};
}
@@ -402,13 +402,13 @@
case InfoType::IT_namespace: {
auto I = llvm::make_unique<NamespaceInfo>();
I->USR = Enum.Namespace[0].USR;
- I->ChildEnums.push_back(std::move(Enum));
+ I->ChildEnums.emplace_back(std::move(Enum));
return std::unique_ptr<Info>{std::move(I)};
}
case InfoType::IT_record: {
auto I = llvm::make_unique<RecordInfo>();
I->USR = Enum.Namespace[0].USR;
- I->ChildEnums.push_back(std::move(Enum));
+ I->ChildEnums.emplace_back(std::move(Enum));
return std::unique_ptr<Info>{std::move(I)};
}
default:
@@ -419,7 +419,7 @@
// Put in global namespace
auto I = llvm::make_unique<NamespaceInfo>();
I->USR = SymbolID();
- I->ChildEnums.push_back(std::move(Enum));
+ I->ChildEnums.emplace_back(std::move(Enum));
return std::unique_ptr<Info>{std::move(I)};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51137.162399.patch
Type: text/x-patch
Size: 2148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180824/b5214c72/attachment.bin>
More information about the llvm-commits
mailing list