This is an archive of the discontinued LLVM Phabricator instance.

Recognize the Swift compiler in DW_AT_producer
ClosedPublic

Authored by aprantl on Oct 6 2021, 2:59 PM.

Details

Summary

This patch adds support for Swift compiler producer strings to DWARFUnit.

Diff Detail

Event Timeline

aprantl requested review of this revision.Oct 6 2021, 2:59 PM
aprantl created this revision.
aprantl updated this revision to Diff 377702.Oct 6 2021, 3:01 PM

Sort variables in a more logical order.

JDevlieghere added inline comments.Oct 6 2021, 4:54 PM
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
685

For consistency with the code below, should we first check if roducer.contains("swift") and then execute the regex? Otherwise the indentation on the line below is off.

shafik added a subscriber: shafik.Oct 6 2021, 7:27 PM
shafik added inline comments.
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
674

const?

aprantl added inline comments.Oct 7 2021, 12:49 PM
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
685

I think it makes more sense to run the clang regex right away. Matching the regex is faster than first searching for clang and then running the regex.

aprantl added inline comments.Oct 7 2021, 12:51 PM
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
685

No, that does not preserve the semantics. We want to set the producer even if we can't parse the version. In any case, scanning the string twice in the Swift case is unnecessary.

JDevlieghere accepted this revision.Oct 7 2021, 12:52 PM

LGTM

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
685

Sounds reasonable to me. Should we do the same for clang? Then we just need to fix the indentation on line 685.

This revision is now accepted and ready to land.Oct 7 2021, 12:52 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2021, 1:54 PM