[PATCH] D157794: [Driver] Make /Zi and /Z7 aliases of -g rather than handling them specially

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 09:59:05 PDT 2023


smeenai added inline comments.


================
Comment at: clang/test/Driver/cl-options.c:567
 
-// This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
-// later on the command line, so it should win. Interestingly the cc1 arguments
-// came out right, but had wrong semantics, because an invariant assumed by
-// CompilerInvocation was violated: it expects that at most one of {gdwarfN,
-// line-tables-only} appear. If you assume that, then you can safely use
-// Args.hasArg to test whether a boolean flag is present without caring
-// where it appeared. And for this test, it appeared to the left of -gdwarf
-// which made it "win". This test could not detect that bug.
+// If We specify both /Z7 and -gdwarf we should get dwarf, not codeview.
 // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
----------------
bogner wrote:
> rnk wrote:
> > I think Meta folks depend on a mode that emits both codeview and DWARF. + at smeenai
> Hopefully if that's the case there's a better test somewhere than this one that discusses in detail how `/Z7` is an alias for `-gline-tables-only`, which hasn't been true since 2017.
Thanks for the headers up :) We don't depend on that mode any more though, so no problems on our end.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157794



More information about the cfe-commits mailing list