[PATCH] D30760: Record command lines in objects built by clang, Clang part
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 24 14:10:16 PDT 2017
As Adrian mentioned, this can probably be covered/added to an existing test
case in clang/test/Driver
On Fri, Mar 24, 2017 at 1:57 PM Zhizhou Yang via Phabricator <
reviews at reviews.llvm.org> wrote:
> zhizhouy updated this revision to Diff 93003.
> zhizhouy marked 3 inline comments as done.
> zhizhouy added a comment.
>
> Checked both grecord-gcc-swtiches and gno-record-gcc-switches.
>
> Modified testcases for it.
>
>
> https://reviews.llvm.org/D30760
>
> Files:
> lib/Driver/ToolChains/Clang.cpp
> test/Driver/grecord-gcc-switches.c
>
>
> Index: test/Driver/grecord-gcc-switches.c
> ===================================================================
> --- /dev/null
> +++ test/Driver/grecord-gcc-switches.c
> @@ -0,0 +1,13 @@
> +// RUN: %clang -### -g -c -grecord-gcc-switches %s 2>&1 | FileCheck
> -check-prefix=REC %s
> +// RUN: %clang -### -g -c -gno-record-gcc-switches %s 2>&1 | FileCheck
> -check-prefix=NO_REC %s
> +// RUN: %clang -### -g -c %s 2>&1 | FileCheck %s
> +int main (void) {
> + return 0;
> +}
> +
> +// REC: "-dwarf-debug-flags"
> +// REC: -### -g -c -grecord-gcc-switches
> +// NO_REC-NOT: "-dwarf-debug-flags"
> +// NO_REC-NOT: -### -g -c -gno-record-gcc-switches
> +// CHECK-NOT: "-dwarf-debug-flags"
> +// CHECK-NOT: -### -g -c
> Index: lib/Driver/ToolChains/Clang.cpp
> ===================================================================
> --- lib/Driver/ToolChains/Clang.cpp
> +++ lib/Driver/ToolChains/Clang.cpp
> @@ -2728,7 +2728,8 @@
> DwarfVersion = getToolChain().GetDefaultDwarfVersion();
> }
>
> - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
> + // We ignore flag -gstrict-dwarf for now.
> + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags.
> Args.ClaimAllArgs(options::OPT_g_flags_Group);
>
> // Column info is included by default for everything except PS4 and
> CodeView.
> @@ -4321,7 +4322,12 @@
>
> // Optionally embed the -cc1 level arguments into the debug info, for
> build
> // analysis.
> - if (getToolChain().UseDwarfDebugFlags()) {
> + // Also record command line arguments into the debug info if
> + // -grecord-gcc-switches options is set on.
> + // By default, -gno-record-gcc-switches is set on and no recording.
> + if (getToolChain().UseDwarfDebugFlags() ||
> + Args.hasFlag(options::OPT_grecord_gcc_switches,
> + options::OPT_gno_record_gcc_switches, false)) {
> ArgStringList OriginalArgs;
> for (const auto &Arg : Args)
> Arg->render(Args, OriginalArgs);
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170324/a332387c/attachment-0001.html>
More information about the cfe-commits
mailing list