[PATCH] D100809: [Debug-Info] implement -gstrict-dwarf

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 20 10:01:37 PDT 2021


probinson added a comment.

Nit on the description, this patch supports -gstrict-dwarf in the frontend.



================
Comment at: clang/docs/ClangCommandLineReference.rst:3549-3550
 
+Use DWARF extensions in later DWARF versions.
+
 .. option:: -gz=<arg>, -gz (equivalent to -gz=zlib)
----------------
dblaikie wrote:
> This description is probably backwards/doesn't explicitly clarify which version of the flag does which behavior.
> 
> I guess the only nearby example is the -gembed-source, which describes the effect of -gembed-source, not the effect of -gno-embed-source.
Maybe something like, "Restrict DWARF features to those defined in the specified version, avoiding features from later versions."


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3973-3974
+  // as true by default.
+  if (const Arg *A = Args.getLastArg(options::OPT_gstrict_dwarf))
+    (void)checkDebugInfoOption(A, Args, D, TC);
+  if (Args.hasFlag(options::OPT_gstrict_dwarf, options::OPT_gno_strict_dwarf,
----------------
shchenz wrote:
> dblaikie wrote:
> > @aprantl or anyone else - is this the right use of checkDebugInfoOption? I forget what it's for/how it should be used.
> See the nearby example for `-gcolumn-info`:
> ```
>   if (const Arg *A = Args.getLastArg(options::OPT_gcolumn_info))
>     (void)checkDebugInfoOption(A, Args, D, TC)
> ```
It's a wrapper for ToolChain::supportsDebugInfoOption() and the only implementation I see is for Cuda, which has severely limited support for the g options.  I think this is correct.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100809/new/

https://reviews.llvm.org/D100809



More information about the cfe-commits mailing list