[Lldb-commits] [PATCH] D157512: [lldb][PlatformDarwin] Only parse SDK from debug-info if target language is Objective-C

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 9 07:48:17 PDT 2023


Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a subscriber: kadircet.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added subscribers: lldb-commits, ilya-biryukov.
Herald added a project: LLDB.

The call to `HostInfoMacOSX::GetSDKRoot` can noticeably slow down the first
expression evaluation in an LLDB session. For C++ expressions we don't
actually ever use the results of the `ClangDeclVendor`, so getting the
flags right isn't necessary. Thus skip SDK parsing logic for C++
targets.

An alternative would be to entirely omit the setup of the
ClangDeclVendor (and other Objective-C machinery) for C++ targets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157512

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp


Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -18,6 +18,7 @@
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSite.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
@@ -1097,7 +1098,7 @@
 
   FileSpec sysroot_spec;
 
-  if (target) {
+  if (target && Language::LanguageIsObjC(target->GetLanguage())) {
     if (ModuleSP exe_module_sp = target->GetExecutableModule()) {
       auto path_or_err = ResolveSDKPathFromDebugInfo(*exe_module_sp);
       if (path_or_err) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157512.548621.patch
Type: text/x-patch
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230809/589884ba/attachment.bin>


More information about the lldb-commits mailing list