Author: dougk Date: Mon Sep 14 15:31:28 2015 New Revision: 247611 URL: http://llvm.org/viewvc/llvm-project?rev=247611&view=rev Log: Driver should forward at most one gdwarf-N flag to cc1as.
Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/integrated-as.s Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=247611&r1=247610&r2=247611&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Mon Sep 14 15:31:28 2015 @@ -3769,14 +3769,12 @@ void Clang::ConstructJob(Compilation &C, Triple.getOS() == llvm::Triple::Solaris) CmdArgs.push_back("-gdwarf-2"); SplitDwarfArg = nullptr; - } else if (A->getOption().matches(options::OPT_gdwarf_2)) - CmdArgs.push_back("-gdwarf-2"); - else if (A->getOption().matches(options::OPT_gdwarf_3)) - CmdArgs.push_back("-gdwarf-3"); - else if (A->getOption().matches(options::OPT_gdwarf_4)) - CmdArgs.push_back("-gdwarf-4"); - else if (!A->getOption().matches(options::OPT_g0) && - !A->getOption().matches(options::OPT_ggdb0)) { + } else if (A->getOption().matches(options::OPT_gdwarf_2) || + A->getOption().matches(options::OPT_gdwarf_3) || + A->getOption().matches(options::OPT_gdwarf_4)) { + A->render(Args, CmdArgs); + } else if (!A->getOption().matches(options::OPT_g0) && + !A->getOption().matches(options::OPT_ggdb0)) { // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris. const llvm::Triple &Triple = getToolChain().getTriple(); if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD || @@ -5550,12 +5548,9 @@ void ClangAs::ConstructJob(Compilation & if (!A->getOption().matches(options::OPT_g0)) CmdArgs.push_back("-g"); - if (Args.hasArg(options::OPT_gdwarf_2)) - CmdArgs.push_back("-gdwarf-2"); - if (Args.hasArg(options::OPT_gdwarf_3)) - CmdArgs.push_back("-gdwarf-3"); - if (Args.hasArg(options::OPT_gdwarf_4)) - CmdArgs.push_back("-gdwarf-4"); + if (Arg *A = Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3, + options::OPT_gdwarf_4)) + A->render(Args, CmdArgs); // Add the -fdebug-compilation-dir flag if needed. addDebugCompDirArg(Args, CmdArgs); Modified: cfe/trunk/test/Driver/integrated-as.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/integrated-as.s?rev=247611&r1=247610&r2=247611&view=diff ============================================================================== --- cfe/trunk/test/Driver/integrated-as.s (original) +++ cfe/trunk/test/Driver/integrated-as.s Mon Sep 14 15:31:28 2015 @@ -26,8 +26,9 @@ // XA_INCLUDE2: cc1as // XA_INCLUDE2: "-Ifoo_dir" -// RUN: %clang -### -c -integrated-as %s -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s +// RUN: %clang -### -c -integrated-as %s -gdwarf-4 -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s // DWARF2: "-g" "-gdwarf-2" +// DWARF2-NOT: "-gdwarf-4" // RUN: %clang -### -c -integrated-as %s -gdwarf-3 2>&1 | FileCheck --check-prefix=DWARF3 %s // DWARF3: "-g" "-gdwarf-3" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits