[clang] 781dea0 - [Support] Rename DebugCompressionType::Z to Zlib
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 8 16:11:39 PDT 2022
Author: Fangrui Song
Date: 2022-09-08T16:11:29-07:00
New Revision: 781dea021a4a38aed89ea0cbf8c0d3641b16d56d
URL: https://github.com/llvm/llvm-project/commit/781dea021a4a38aed89ea0cbf8c0d3641b16d56d
DIFF: https://github.com/llvm/llvm-project/commit/781dea021a4a38aed89ea0cbf8c0d3641b16d56d.diff
LOG: [Support] Rename DebugCompressionType::Z to Zlib
"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.
Added:
Modified:
clang/tools/driver/cc1as_main.cpp
llvm/include/llvm/Support/Compression.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
llvm/unittests/Support/CompressionTest.cpp
Removed:
################################################################################
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 5e528a00aa778..4dcbc4fe77ccf 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -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);
}
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 36150f65e8b14..05b7babfac48e 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -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
};
@@ -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;
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index bb058690ebda3..6f54f5033f6c4 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -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:
diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp
index ebe297b4cffdb..a2edad8ad233c 100644
--- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp
+++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp
@@ -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;
@@ -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:
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 1ca30d19fecc4..dd5a66a6eb7d3 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -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));
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
index 3bdd00799e327..b2250ca8facda 100644
--- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -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) {
diff --git a/llvm/unittests/Support/CompressionTest.cpp b/llvm/unittests/Support/CompressionTest.cpp
index 46f3003842df0..c2314552f79ea 100644
--- a/llvm/unittests/Support/CompressionTest.cpp
+++ b/llvm/unittests/Support/CompressionTest.cpp
@@ -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));
More information about the cfe-commits
mailing list