mstorsjo 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
----------------
smeenai wrote:
> bogner wrote:
> > smeenai wrote:
> > > bogner wrote:
> > > > rnk wrote:
> > > > > I think Meta folks depend on a mode that emits both codeview and 
> > > > > DWARF. +@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.
> > Also note that this change does not affect what happens if we specify both 
> > `-gcodeview` and `-gdwarf` together. That continues to pass both 
> > `-gcodeview` and `-dwarf-version=...` to `clang -cc1`. However, I don't see 
> > any tests that actually check that behaviour, so if that is a mode that's 
> > useful to keep working we definitely have some gaps there.
> > 
> > This change means that if you want to ask `-cc1` for dwarf *and* codeview 
> > with `/Z7` or `/Zi`, you'll need to specify `-gdwarf` and `-gcodeview` now. 
> > This matches how you would get both sets of options to render with `-g`, 
> > which I think makes sense.
> Yeah, that sounds good. IIRC when we were using the joint codeview + DWARF 
> mode it was with the gcc-style Clang driver and not clang-cl, and we passed 
> `-gdwarf -gcodeview` or similar to enable it anyway. We don't need that 
> anymore though; @mstorsjo would know if there's anything on the MinGW side 
> that cares for it.
I'm not aware of mingw usecases of using both codeview and DWARF at the same 
time - I've occasionally mentioned that I know some people do use that, but I 
haven't actually guided anybody into doing it.

For mingw, as long as `-g -gcodeview` on the driver level generates codeview 
(and not DWARF) like it used to, mingw should be fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157794

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to