Don't copy the .drective section with std::string

Both COFF and bitcode input files expose these as stable strings.

llvm-svn: 357314
This commit is contained in:
Reid Kleckner 2019-03-29 21:00:22 +00:00
parent 6f8251fb38
commit ba708619ad
2 changed files with 3 additions and 3 deletions

View File

@ -172,7 +172,7 @@ SectionChunk *ObjFile::readSection(uint32_t SectionNumber,
if (Name == ".drectve") {
ArrayRef<uint8_t> Data;
COFFObj->getSectionContents(Sec, Data);
Directives = std::string((const char *)Data.data(), Data.size());
Directives = StringRef((const char *)Data.data(), Data.size());
return nullptr;
}

View File

@ -74,12 +74,12 @@ public:
StringRef ParentName;
// Returns .drectve section contents if exist.
StringRef getDirectives() { return StringRef(Directives).trim(); }
StringRef getDirectives() { return Directives; }
protected:
InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {}
std::string Directives;
StringRef Directives;
private:
const Kind FileKind;