forked from OSchip/llvm-project
s/uncompress/decompress/g.
In lld, we use both "uncompress" and "decompress" which is confusing. Since LLVM uses "decompress", we should use the same term. llvm-svn: 324944
This commit is contained in:
parent
edcd564820
commit
ac114d27ae
|
@ -34,7 +34,7 @@ template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
|
|||
.Case(".debug_ranges", &RangeSection)
|
||||
.Case(".debug_line", &LineSection)
|
||||
.Default(nullptr)) {
|
||||
Sec->maybeUncompress();
|
||||
Sec->maybeDecompress();
|
||||
M->Data = toStringRef(Sec->Data);
|
||||
M->Sec = Sec;
|
||||
continue;
|
||||
|
|
|
@ -175,22 +175,22 @@ OutputSection *SectionBase::getOutputSection() {
|
|||
return Sec ? Sec->getParent() : nullptr;
|
||||
}
|
||||
|
||||
// Uncompress section contents if required. Note that this function
|
||||
// Decompress section contents if required. Note that this function
|
||||
// is called from parallelForEach, so it must be thread-safe.
|
||||
void InputSectionBase::maybeUncompress() {
|
||||
if (UncompressBuf || !Decompressor::isCompressedELFSection(Flags, Name))
|
||||
void InputSectionBase::maybeDecompress() {
|
||||
if (DecompressBuf || !Decompressor::isCompressedELFSection(Flags, Name))
|
||||
return;
|
||||
|
||||
Decompressor Dec = check(Decompressor::create(Name, toStringRef(Data),
|
||||
Config->IsLE, Config->Is64));
|
||||
|
||||
size_t Size = Dec.getDecompressedSize();
|
||||
UncompressBuf.reset(new char[Size]());
|
||||
if (Error E = Dec.decompress({UncompressBuf.get(), Size}))
|
||||
DecompressBuf.reset(new char[Size]());
|
||||
if (Error E = Dec.decompress({DecompressBuf.get(), Size}))
|
||||
fatal(toString(this) +
|
||||
": decompress failed: " + llvm::toString(std::move(E)));
|
||||
|
||||
Data = makeArrayRef((uint8_t *)UncompressBuf.get(), Size);
|
||||
Data = makeArrayRef((uint8_t *)DecompressBuf.get(), Size);
|
||||
Flags &= ~(uint64_t)SHF_COMPRESSED;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
// Compilers emit zlib-compressed debug sections if the -gz option
|
||||
// is given. This function checks if this section is compressed, and
|
||||
// if so, decompress in memory.
|
||||
void maybeUncompress();
|
||||
void maybeDecompress();
|
||||
|
||||
// Returns a source location string. Used to construct an error message.
|
||||
template <class ELFT> std::string getLocation(uint64_t Offset);
|
||||
|
@ -189,9 +189,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
// A pointer that owns uncompressed data if a section is compressed by zlib.
|
||||
// A pointer that owns decompressed data if a section is compressed by zlib.
|
||||
// Since the feature is not used often, this is usually a nullptr.
|
||||
std::unique_ptr<char[]> UncompressBuf;
|
||||
std::unique_ptr<char[]> DecompressBuf;
|
||||
};
|
||||
|
||||
// SectionPiece represents a piece of splittable section contents.
|
||||
|
|
|
@ -2482,11 +2482,11 @@ static MergeSyntheticSection *createMergeSynthetic(StringRef Name,
|
|||
return make<MergeNoTailSection>(Name, Type, Flags, Alignment);
|
||||
}
|
||||
|
||||
// Debug sections may be compressed by zlib. Uncompress if exists.
|
||||
// Debug sections may be compressed by zlib. Decompress if exists.
|
||||
void elf::decompressSections() {
|
||||
parallelForEach(InputSections, [](InputSectionBase *Sec) {
|
||||
if (Sec->Live)
|
||||
Sec->maybeUncompress();
|
||||
Sec->maybeDecompress();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue