1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

MCDwarf: Oh, and move the directory string over to std::string as well

(see r203831 for similar stuff)

llvm-svn: 203833
This commit is contained in:
David Blaikie 2014-03-13 19:05:33 +00:00
parent 299af813bb
commit 457b4da818
4 changed files with 9 additions and 12 deletions

View File

@ -325,7 +325,7 @@ namespace llvm {
const SmallVectorImpl<MCDwarfFile> &getMCDwarfFiles(unsigned CUID = 0) {
return getMCDwarfFileTable(CUID).getMCDwarfFiles();
}
const SmallVectorImpl<StringRef> &getMCDwarfDirs(unsigned CUID = 0) {
const SmallVectorImpl<std::string> &getMCDwarfDirs(unsigned CUID = 0) {
return getMCDwarfFileTable(CUID).getMCDwarfDirs();
}

View File

@ -22,6 +22,7 @@
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <vector>
#include <string>
namespace llvm {
class MCAsmBackend;
@ -175,7 +176,7 @@ public:
class MCDwarfFileTable {
MCSymbol *Label;
SmallVector<StringRef, 3> MCDwarfDirs;
SmallVector<std::string, 3> MCDwarfDirs;
SmallVector<MCDwarfFile, 3> MCDwarfFiles;
MCLineSection MCLineSections;
@ -189,11 +190,11 @@ public:
//
const MCSymbol *EmitCU(MCStreamer *MCOS) const;
const SmallVectorImpl<StringRef> &getMCDwarfDirs() const {
const SmallVectorImpl<std::string> &getMCDwarfDirs() const {
return MCDwarfDirs;
}
SmallVectorImpl<StringRef> &getMCDwarfDirs() {
SmallVectorImpl<std::string> &getMCDwarfDirs() {
return MCDwarfDirs;
}

View File

@ -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

View File

@ -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("/");