[Lldb-commits] [PATCH] D30624: Remove all of LLDB's custom filesystem statting code.

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Mar 5 09:26:39 PST 2017


zturner created this revision.
Herald added a subscriber: emaste.

LLVM provides this functionality, so there is no point duplicating it.  This is a pretty large patch because we call functions like `FileSpec::IsRegularFile()`, or `FileSpec::GetFileType()` all over the place, and all of these are replaced with calls to llvm now.  Also deleted is LLDB's entire `FileType` enumeration.

I don't think it's a very important optimization, but one nice functional change is that we now stat only once when previously we would stat many times on the same file (for example calling `Exists()` followed by `IsDirectory()` followed by `IsRegularFile()` is 3 stats, whereas in this patch we're down to 1.

In addition to all of this, I think this is an important change because it removes an assumption previously baked into the `FileSpec` API that this was always a valid operation.   But it is pretty common to have a `FileSpec` that refers to a file on a remote platform, perhaps even with an incomptible `PathSyntax`, and in this case it doesn't make sense to be calling these functions on it.

In any case, it's a necessary pre-requisite to getting `FileSpec` not be dependent on `Host`.


https://reviews.llvm.org/D30624

Files:
  lldb/include/lldb/Host/FileSpec.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/FileSpecList.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Host/common/FileSpec.cpp
  lldb/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/source/Host/common/Symbols.cpp
  lldb/source/Host/macosx/Host.mm
  lldb/source/Host/macosx/HostInfoMacOSX.mm
  lldb/source/Host/macosx/Symbols.cpp
  lldb/source/Host/posix/FileSystem.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/TargetList.cpp
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/Support/Path.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30624.90619.patch
Type: text/x-patch
Size: 59638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170305/d2103830/attachment-0001.bin>


More information about the lldb-commits mailing list