diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-07-29 13:53:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-07-29 13:53:19 +0000 |
commit | 3bce5adb32fbbe5c5549b902f4d65737f40c1499 (patch) | |
tree | fb5ef5e2fb4669b6c0c753581ba1f461251cdd42 /include | |
parent | 808ecfce6a312625bee5c0f4f9831a0d0ed01b16 (diff) | |
download | llvm-3bce5adb32fbbe5c5549b902f4d65737f40c1499.tar.gz llvm-3bce5adb32fbbe5c5549b902f4d65737f40c1499.tar.bz2 llvm-3bce5adb32fbbe5c5549b902f4d65737f40c1499.tar.xz |
Stop leaking std::strings in GetDwarfFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/MC/MCContext.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCDwarf.h | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 86f83ad240..8b30bfcd37 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -70,7 +70,7 @@ namespace llvm { /// The dwarf file and directory tables from the dwarf .file directive. std::vector<MCDwarfFile *> MCDwarfFiles; - std::vector<std::string *> MCDwarfDirs; + std::vector<StringRef> MCDwarfDirs; /// Allocator - Allocator object used for creating machine code objects. /// diff --git a/include/llvm/MC/MCDwarf.h b/include/llvm/MC/MCDwarf.h index 4ba401a49a..619351400d 100644 --- a/include/llvm/MC/MCDwarf.h +++ b/include/llvm/MC/MCDwarf.h @@ -16,7 +16,7 @@ #ifndef LLVM_MC_MCDWARF_H #define LLVM_MC_MCDWARF_H -#include <string> +#include "llvm/ADT/StringRef.h" namespace llvm { class MCContext; @@ -29,21 +29,22 @@ namespace llvm { /// index 0 is not used and not a valid dwarf file number). class MCDwarfFile { // Name - the base name of the file without its directory path. - std::string Name; + // The StringRef references memory allocated in the MCContext. + StringRef Name; // DirIndex - the index into the list of directory names for this file name. unsigned DirIndex; private: // MCContext creates and uniques these. friend class MCContext; - MCDwarfFile(std::string name, unsigned dirIndex) + MCDwarfFile(StringRef name, unsigned dirIndex) : Name(name), DirIndex(dirIndex) {} MCDwarfFile(const MCDwarfFile&); // DO NOT IMPLEMENT void operator=(const MCDwarfFile&); // DO NOT IMPLEMENT public: /// getName - Get the base name of this MCDwarfFile. - std::string getName() const { return Name; } + StringRef getName() const { return Name; } /// print - Print the value to the stream \arg OS. void print(raw_ostream &OS) const; |