mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
Plug another leak in the DWARF unittests, DIEInlineStrings are never destroyed.
llvm-svn: 289208
This commit is contained in:
parent
87d6393262
commit
11e0ca31fc
@ -256,15 +256,16 @@ public:
|
|||||||
///
|
///
|
||||||
/// This class is used with the DW_FORM_string form.
|
/// This class is used with the DW_FORM_string form.
|
||||||
class DIEInlineString {
|
class DIEInlineString {
|
||||||
std::string S;
|
StringRef S;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DIEInlineString(StringRef Str) : S(Str.str()) {}
|
template <typename Allocator>
|
||||||
|
explicit DIEInlineString(StringRef Str, Allocator &A) : S(Str.copy(A)) {}
|
||||||
|
|
||||||
~DIEInlineString() = default;
|
~DIEInlineString() = default;
|
||||||
|
|
||||||
/// Grab the string out of the object.
|
/// Grab the string out of the object.
|
||||||
StringRef getString() const { return StringRef(S); }
|
StringRef getString() const { return S; }
|
||||||
|
|
||||||
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
|
||||||
|
@ -606,7 +606,7 @@ unsigned DIEInlineString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
|
|||||||
|
|
||||||
LLVM_DUMP_METHOD
|
LLVM_DUMP_METHOD
|
||||||
void DIEInlineString::print(raw_ostream &O) const {
|
void DIEInlineString::print(raw_ostream &O) const {
|
||||||
O << "InlineString: " << S.c_str();
|
O << "InlineString: " << S;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -61,7 +61,8 @@ void dwarfgen::DIE::addAttribute(uint16_t A, dwarf::Form Form,
|
|||||||
auto &DG = CU->getGenerator();
|
auto &DG = CU->getGenerator();
|
||||||
if (Form == DW_FORM_string) {
|
if (Form == DW_FORM_string) {
|
||||||
Die->addValue(DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,
|
Die->addValue(DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,
|
||||||
new (DG.getAllocator()) DIEInlineString(String));
|
new (DG.getAllocator())
|
||||||
|
DIEInlineString(String, DG.getAllocator()));
|
||||||
} else {
|
} else {
|
||||||
Die->addValue(
|
Die->addValue(
|
||||||
DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,
|
DG.getAllocator(), static_cast<dwarf::Attribute>(A), Form,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user