summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCContext.cpp9
-rw-r--r--llvm/lib/MC/MCDwarf.cpp3
2 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 3c8de997124..48cb5aae1fb 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -339,7 +339,7 @@ unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,
unsigned FileNumber, unsigned CUID) {
MCDwarfFileTable &Table = MCDwarfFileTablesCUMap[CUID];
SmallVectorImpl<MCDwarfFile>& MCDwarfFiles = Table.getMCDwarfFiles();
- SmallVectorImpl<StringRef>& MCDwarfDirs = Table.getMCDwarfDirs();
+ SmallVectorImpl<std::string>& MCDwarfDirs = Table.getMCDwarfDirs();
// Make space for this FileNumber in the MCDwarfFiles vector if needed.
if (FileNumber >= MCDwarfFiles.size()) {
MCDwarfFiles.resize(FileNumber + 1);
@@ -374,11 +374,8 @@ unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,
if (Directory == MCDwarfDirs[DirIndex])
break;
}
- if (DirIndex >= MCDwarfDirs.size()) {
- char *Buf = static_cast<char *>(Allocate(Directory.size()));
- memcpy(Buf, Directory.data(), Directory.size());
- MCDwarfDirs.push_back(StringRef(Buf, Directory.size()));
- }
+ if (DirIndex >= MCDwarfDirs.size())
+ MCDwarfDirs.push_back(Directory);
// The DirIndex is one based, as DirIndex of 0 is used for FileNames with
// no directories. MCDwarfDirs[] is unlike MCDwarfFiles[] in that the
// directory names are stored at MCDwarfDirs[DirIndex-1] where FileNames
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 2c1874f5e91..b0a75d5de20 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -596,8 +596,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// AT_name, the name of the source file. Reconstruct from the first directory
// and file table entries.
- const SmallVectorImpl<StringRef> &MCDwarfDirs =
- context.getMCDwarfDirs();
+ const SmallVectorImpl<std::string> &MCDwarfDirs = context.getMCDwarfDirs();
if (MCDwarfDirs.size() > 0) {
MCOS->EmitBytes(MCDwarfDirs[0]);
MCOS->EmitBytes("/");
OpenPOWER on IntegriCloud