From 2484e9159c54def19aac69c4a217a55329da54d2 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 19 Oct 2020 23:05:26 -0700 Subject: [Driver] Clean up -gz & --compress-debug-sections * Make cc1 and cc1as --compress-debug-sections an alias for --compress-debug-sections=zlib * Make -gz an alias for -gz=zlib The new behavior is consistent with GCC when binutils>=2.26 is detected: -gz is translated to --compress-debug-sections=zlib instead of --compress-debug-sections. --- clang/lib/Frontend/CompilerInvocation.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index c3b5edc..f61a393 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1170,18 +1170,13 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, } } - if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections, - OPT_compress_debug_sections_EQ)) { - if (A->getOption().getID() == OPT_compress_debug_sections) { - Opts.setCompressDebugSections(llvm::DebugCompressionType::Z); - } else { - auto DCT = llvm::StringSwitch(A->getValue()) - .Case("none", llvm::DebugCompressionType::None) - .Case("zlib", llvm::DebugCompressionType::Z) - .Case("zlib-gnu", llvm::DebugCompressionType::GNU) - .Default(llvm::DebugCompressionType::None); - Opts.setCompressDebugSections(DCT); - } + if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections_EQ)) { + auto DCT = llvm::StringSwitch(A->getValue()) + .Case("none", llvm::DebugCompressionType::None) + .Case("zlib", llvm::DebugCompressionType::Z) + .Case("zlib-gnu", llvm::DebugCompressionType::GNU) + .Default(llvm::DebugCompressionType::None); + Opts.setCompressDebugSections(DCT); } Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations); -- cgit v1.1