This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Add source languages ObjC and ObjC++
ClosedPublic

Authored by sgraenitz on Mar 16 2023, 5:17 AM.

Details

Summary

This patch adds llvm::codeview::SourceLanguage entries, DWARF translations, and PDB source file extensions in LLVM and allow LLDB's PDB parsers to recognize them correctly.

The CV_CFL_LANG enum in the Visual Studio 2022 documentation https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang defines:

CV_CFL_OBJC     = 0x11,
CV_CFL_OBJCXX   = 0x12,

Since the initial commit in D24317, ObjC was emitted as C language and ObjC++ as Masm.

Diff Detail

Event Timeline

sgraenitz created this revision.Mar 16 2023, 5:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2023, 5:17 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
sgraenitz requested review of this revision.Mar 16 2023, 5:17 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 16 2023, 5:17 AM
sgraenitz removed a subscriber: aprantl.
DavidSpickett added inline comments.Mar 17 2023, 7:50 AM
llvm/include/llvm/DebugInfo/CodeView/CodeView.h
142

Could put the same link from the commit message, here.

llvm/test/DebugInfo/COFF/objc.ll
5–7

Are these checked, should they be?

12–18

Do we need to check for these lines? Just the first few should be fine.

llvm/test/DebugInfo/COFF/objcpp.ll
5–7

Are these checked, should they be?

12–18

Same here.

Maybe I should have noted immediately, that this is mostly following the change for Rust from https://reviews.llvm.org/D115300

llvm/include/llvm/DebugInfo/CodeView/CodeView.h
142

I though about it, but such links will inevitably break again one day and/or lead to outdated information. The old link was very unfortunate. Web search for CV_CFL_LANG Microsoft Debug Interface Access SDK seems more stable. What do you think?

llvm/test/DebugInfo/COFF/objc.ll
5–7

Thanks for taking a look! What we check here is the 17 in language flags. The rest is just to make sure we get the right context. (Same for the others.) Is that your question?

DavidSpickett added inline comments.Mar 17 2023, 8:36 AM
llvm/include/llvm/DebugInfo/CodeView/CodeView.h
142

Yeah sure, one can google the term instead. Agreed.

It is better than "download this random header file that probably has a strange license" :)

llvm/test/DebugInfo/COFF/objc.ll
5–7

Right but I don't know what that adds once you get beyond the Language line. It's a small thing, so that the test doesn't fail if a new key is added.

DavidSpickett added inline comments.Mar 17 2023, 8:39 AM
llvm/test/DebugInfo/COFF/objc.ll
5–7

Ignore the previous comment, wrong line.

So yes you can check these, but no one actually does. If you look at the filecheck line it only does OBJ.

Same for the rust change you linked. Unless there is some implicit behaviour here. One way to find out, put a bogus value in there and it should fail.

12–18

So here it's fine to check up to language, mostly, but after that what does it matter? If someone adds a new key the test breaks.

(and granted, it won't happen often if at all but the general principle holds)

sgraenitz updated this revision to Diff 506100.Mar 17 2023, 9:03 AM
sgraenitz marked 7 inline comments as done.

Cut down check-lines

llvm/test/DebugInfo/COFF/objc.ll
5–7

The first RUN line will exercise the ASM checks:

; RUN: llc < %s | FileCheck %s --check-prefix=ASM
12–18

Ok, fair enough. Cut it down.

DavidSpickett accepted this revision.Mar 17 2023, 9:06 AM

LGTM

llvm/test/DebugInfo/COFF/objc.ll
5–7

Doh, sometimes I forget how to read.

This revision is now accepted and ready to land.Mar 17 2023, 9:06 AM
This revision was landed with ongoing or failed builds.Mar 17 2023, 9:10 AM
This revision was automatically updated to reflect the committed changes.