[cfe-commits] r143732 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/debug-options.c

Chandler Carruth chandlerc at google.com
Fri Nov 4 12:54:51 PDT 2011


On Fri, Nov 4, 2011 at 12:28 PM, Chad Rosier <mcrosier at apple.com> wrote:

> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=143732&r1=143731&r2=143732&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Nov  4 14:28:44 2011
> @@ -1455,8 +1455,24 @@
>   // wrong.
>   Args.ClaimAllArgs(options::OPT_g_Group);
>   if (Arg *A = Args.getLastArg(options::OPT_g_Group))
> -    if (!A->getOption().matches(options::OPT_g0))
> -      CmdArgs.push_back("-g");
> +    if (!A->getOption().matches(options::OPT_g0)) {
> +      StringRef ArgString = A->getAsString(Args);
> +      bool Valid_g = llvm::StringSwitch<bool>(ArgString)
> +        .Case("-g", true)
> +        .Case("-g3", true)
> +        .Case("-gdwarf-2", true)
> +        .Case("-gstabs", true)
> +        .Case("-gstabs+", true)
> +        .Case("-gstabs1", true)
> +        .Case("-gstabs2", true)
> +        .Case("-gfull", true)
> +        .Case("-gused", true)
> +        .Default(false);
>

Alternatively, we could avoid treating these as a '-g' flag with a value
and instead treat them as separate flags. I think that would be slightly
cleaner as it would move this logic out of C++ code and into the tablegen
file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111104/b90abf94/attachment.html>


More information about the cfe-commits mailing list