Skip to content

Commit

Permalink
[Support] Rename DebugCompressionType::Z to Zlib
Browse files Browse the repository at this point in the history
"Z" was so named when we had both gABI ELFCOMPRESS_ZLIB and the legacy .zdebug support.
Now we have just one zlib format, we should use the more descriptive name.
  • Loading branch information
MaskRay committed Sep 8, 2022
1 parent 580f725 commit 781dea0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion clang/tools/driver/cc1as_main.cpp
Expand Up @@ -239,7 +239,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
Opts.CompressDebugSections =
llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
.Case("none", llvm::DebugCompressionType::None)
.Case("zlib", llvm::DebugCompressionType::Z)
.Case("zlib", llvm::DebugCompressionType::Zlib)
.Default(llvm::DebugCompressionType::None);
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Support/Compression.h
Expand Up @@ -26,7 +26,7 @@ class Error;
// compression::Format members for non-debugging purposes.
enum class DebugCompressionType {
None, ///< No compression
Z, ///< zlib
Zlib, ///< zlib
Zstd, ///< Zstandard
};

Expand Down Expand Up @@ -84,7 +84,7 @@ inline Format formatFor(DebugCompressionType Type) {
switch (Type) {
case DebugCompressionType::None:
llvm_unreachable("not a compression type");
case DebugCompressionType::Z:
case DebugCompressionType::Zlib:
return Format::Zlib;
case DebugCompressionType::Zstd:
return Format::Zstd;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/MC/ELFObjectWriter.cpp
Expand Up @@ -867,7 +867,7 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
switch (CompressionType) {
case DebugCompressionType::None:
llvm_unreachable("has been handled");
case DebugCompressionType::Z:
case DebugCompressionType::Zlib:
ChType = ELF::ELFCOMPRESS_ZLIB;
break;
case DebugCompressionType::Zstd:
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ObjCopy/ELF/ELFObject.cpp
Expand Up @@ -442,7 +442,7 @@ Error ELFSectionWriter<ELFT>::visit(const DecompressedSection &Sec) {
DebugCompressionType Type;
switch (Sec.ChType) {
case ELFCOMPRESS_ZLIB:
Type = DebugCompressionType::Z;
Type = DebugCompressionType::Zlib;
break;
case ELFCOMPRESS_ZSTD:
Type = DebugCompressionType::Zstd;
Expand Down Expand Up @@ -510,7 +510,7 @@ Error ELFSectionWriter<ELFT>::visit(const CompressedSection &Sec) {
case DebugCompressionType::None:
std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf);
return Error::success();
case DebugCompressionType::Z:
case DebugCompressionType::Zlib:
Chdr.ch_type = ELF::ELFCOMPRESS_ZLIB;
break;
case DebugCompressionType::Zstd:
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-mc/llvm-mc.cpp
Expand Up @@ -76,7 +76,7 @@ static cl::opt<DebugCompressionType> CompressDebugSections(
cl::init(DebugCompressionType::None),
cl::desc("Choose DWARF debug sections compression:"),
cl::values(clEnumValN(DebugCompressionType::None, "none", "No compression"),
clEnumValN(DebugCompressionType::Z, "zlib", "Use zlib"),
clEnumValN(DebugCompressionType::Zlib, "zlib", "Use zlib"),
clEnumValN(DebugCompressionType::Zstd, "zstd", "Use zstd")),
cl::cat(MCCategory));

Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
Expand Up @@ -720,7 +720,7 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> RawArgsArr,

if (const auto *A = InputArgs.getLastArg(OBJCOPY_compress_debug_sections)) {
Config.CompressionType = StringSwitch<DebugCompressionType>(A->getValue())
.Case("zlib", DebugCompressionType::Z)
.Case("zlib", DebugCompressionType::Zlib)
.Case("zstd", DebugCompressionType::Zstd)
.Default(DebugCompressionType::None);
if (Config.CompressionType == DebugCompressionType::None) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/Support/CompressionTest.cpp
Expand Up @@ -34,8 +34,8 @@ static void testZlibCompression(StringRef Input, int Level) {
EXPECT_EQ(Input, toStringRef(Uncompressed));

// decompress with Z dispatches to zlib::uncompress.
E = compression::decompress(DebugCompressionType::Z, Compressed, Uncompressed,
Input.size());
E = compression::decompress(DebugCompressionType::Zlib, Compressed,
Uncompressed, Input.size());
EXPECT_FALSE(std::move(E));
EXPECT_EQ(Input, toStringRef(Uncompressed));

Expand Down

0 comments on commit 781dea0

Please sign in to comment.