[lld] r312675 - Simplify type. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 15:16:32 PDT 2017
Author: rafael
Date: Wed Sep 6 15:16:32 2017
New Revision: 312675
URL: http://llvm.org/viewvc/llvm-project?rev=312675&view=rev
Log:
Simplify type. NFC.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/InputSection.h
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=312675&r1=312674&r2=312675&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Sep 6 15:16:32 2017
@@ -200,12 +200,12 @@ void InputSectionBase::uncompress() {
Config->IsLE, Config->Is64));
size_t Size = Dec.getDecompressedSize();
- UncompressBuf.reset(new std::vector<uint8_t>(Size));
- if (Error E = Dec.decompress({(char *)UncompressBuf->data(), Size}))
+ UncompressBuf.reset(new char[Size]());
+ if (Error E = Dec.decompress({UncompressBuf.get(), Size}))
fatal(toString(this) +
": decompress failed: " + llvm::toString(std::move(E)));
- this->Data = *UncompressBuf;
+ this->Data = makeArrayRef((uint8_t *)UncompressBuf.get(), Size);
this->Flags &= ~(uint64_t)SHF_COMPRESSED;
}
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=312675&r1=312674&r2=312675&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Wed Sep 6 15:16:32 2017
@@ -187,7 +187,7 @@ public:
private:
// A pointer that owns uncompressed data if a section is compressed by zlib.
// Since the feature is not used often, this is usually a nullptr.
- std::unique_ptr<std::vector<uint8_t>> UncompressBuf;
+ std::unique_ptr<char[]> UncompressBuf;
};
// SectionPiece represents a piece of splittable section contents.
More information about the llvm-commits
mailing list