[Lldb-commits] [PATCH] D111278: Recognize the Swift compiler in DW_AT_producer

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 7 12:51:19 PDT 2021


aprantl added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:684
+  llvm::SmallVector<llvm::StringRef, 3> matches;
+  if (g_swiftlang_version_regex.Execute(producer, &matches)) {
+      m_producer_version.tryParse(matches[1]);
----------------
aprantl wrote:
> JDevlieghere wrote:
> > 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. 
> 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.
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.


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

https://reviews.llvm.org/D111278



More information about the lldb-commits mailing list