[Lldb-commits] [lldb] r298536 - Move FileSpec from Host -> Utility.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 22 11:40:08 PDT 2017
Author: zturner
Date: Wed Mar 22 13:40:07 2017
New Revision: 298536
URL: http://llvm.org/viewvc/llvm-project?rev=298536&view=rev
Log:
Move FileSpec from Host -> Utility.
Added:
lldb/trunk/include/lldb/Utility/FileSpec.h
lldb/trunk/source/Utility/FileSpec.cpp
Removed:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Host/common/FileSpec.cpp
Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
lldb/trunk/include/lldb/Core/AddressResolver.h
lldb/trunk/include/lldb/Core/Disassembler.h
lldb/trunk/include/lldb/Core/FileSpecList.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/ModuleSpec.h
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Core/SourceManager.h
lldb/trunk/include/lldb/Host/Editline.h
lldb/trunk/include/lldb/Host/FileCache.h
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Host/HostInfoBase.h
lldb/trunk/include/lldb/Host/Symbols.h
lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h
lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h
lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
lldb/trunk/include/lldb/Symbol/Declaration.h
lldb/trunk/include/lldb/Symbol/LineEntry.h
lldb/trunk/include/lldb/Symbol/ObjectContainer.h
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/include/lldb/Target/FileAction.h
lldb/trunk/include/lldb/Target/ModuleCache.h
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/include/lldb/Target/ProcessInfo.h
lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
lldb/trunk/source/API/SBFileSpec.cpp
lldb/trunk/source/API/SBFileSpecList.cpp
lldb/trunk/source/API/SBHostOS.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Core/StructuredData.cpp
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.h
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
lldb/trunk/source/Target/PathMappingList.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/tools/lldb-server/lldb-platform.cpp
lldb/trunk/unittests/Host/FileSpecTest.cpp
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Wed Mar 22 13:40:07 2017
@@ -18,8 +18,8 @@
#include "lldb/Breakpoint/BreakpointResolver.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/SearchFilter.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/lldb-private.h"
Modified: lldb/trunk/include/lldb/Core/AddressResolver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/AddressResolver.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/AddressResolver.h (original)
+++ lldb/trunk/include/lldb/Core/AddressResolver.h Wed Mar 22 13:40:07 2017
@@ -19,8 +19,8 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/SearchFilter.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Wed Mar 22 13:40:07 2017
@@ -24,9 +24,9 @@
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Core/FileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpecList.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FileSpecList.h (original)
+++ lldb/trunk/include/lldb/Core/FileSpecList.h Wed Mar 22 13:40:07 2017
@@ -11,7 +11,7 @@
#define liblldb_FileSpecList_h_
#if defined(__cplusplus)
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
#include <vector>
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Wed Mar 22 13:40:07 2017
@@ -14,10 +14,10 @@
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
#include "lldb/lldb-forward.h"
// Other libraries and framework includes
Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Mar 22 13:40:07 2017
@@ -12,10 +12,10 @@
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/UUID.h"
// Other libraries and framework includes
#include "llvm/Support/Chrono.h"
Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Wed Mar 22 13:40:07 2017
@@ -14,7 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Core/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SourceManager.h (original)
+++ lldb/trunk/include/lldb/Core/SourceManager.h Wed Mar 22 13:40:07 2017
@@ -11,7 +11,7 @@
#define liblldb_SourceManager_h_
// Project includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
// Other libraries and framework includes
Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Wed Mar 22 13:40:07 2017
@@ -64,8 +64,8 @@
#include <vector>
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Predicate.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
namespace line_editor {
Modified: lldb/trunk/include/lldb/Host/FileCache.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileCache.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileCache.h (original)
+++ lldb/trunk/include/lldb/Host/FileCache.h Wed Mar 22 13:40:07 2017
@@ -15,8 +15,8 @@
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
class FileCache {
Removed: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=298535&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h (removed)
@@ -1,606 +0,0 @@
-//===-- FileSpec.h ----------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_FileSpec_h_
-#define liblldb_FileSpec_h_
-
-// C Includes
-// C++ Includes
-#include <functional>
-#include <string>
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Utility/ConstString.h"
-#include "lldb/lldb-private.h"
-
-#include "llvm/ADT/Triple.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormatVariadic.h"
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class FileSpec FileSpec.h "lldb/Host/FileSpec.h"
-/// @brief A file utility class.
-///
-/// A file specification class that divides paths up into a directory
-/// and basename. These string values of the paths are put into uniqued
-/// string pools for fast comparisons and efficient memory usage.
-///
-/// Another reason the paths are split into the directory and basename
-/// is to allow efficient debugger searching. Often in a debugger the
-/// user types in the basename of the file, for example setting a
-/// breakpoint by file and line, or specifying a module (shared library)
-/// to limit the scope in which to execute a command. The user rarely
-/// types in a full path. When the paths are already split up, it makes
-/// it easy for us to compare only the basenames of a lot of file
-/// specifications without having to split up the file path each time
-/// to get to the basename.
-//----------------------------------------------------------------------
-class FileSpec {
-public:
- enum PathSyntax {
- ePathSyntaxPosix,
- ePathSyntaxWindows,
- ePathSyntaxHostNative
- };
-
- FileSpec();
-
- //------------------------------------------------------------------
- /// Constructor with path.
- ///
- /// Takes a path to a file which can be just a filename, or a full
- /// path. If \a path is not nullptr or empty, this function will call
- /// FileSpec::SetFile (const char *path, bool resolve).
- ///
- /// @param[in] path
- /// The full or partial path to a file.
- ///
- /// @param[in] resolve_path
- /// If \b true, then we resolve the path, removing stray ../.. and so
- /// forth,
- /// if \b false we trust the path is in canonical form already.
- ///
- /// @see FileSpec::SetFile (const char *path, bool resolve)
- //------------------------------------------------------------------
- explicit FileSpec(llvm::StringRef path, bool resolve_path,
- PathSyntax syntax = ePathSyntaxHostNative);
-
- explicit FileSpec(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple);
-
- //------------------------------------------------------------------
- /// Copy constructor
- ///
- /// Makes a copy of the uniqued directory and filename strings from
- /// \a rhs.
- ///
- /// @param[in] rhs
- /// A const FileSpec object reference to copy.
- //------------------------------------------------------------------
- FileSpec(const FileSpec &rhs);
-
- //------------------------------------------------------------------
- /// Copy constructor
- ///
- /// Makes a copy of the uniqued directory and filename strings from
- /// \a rhs if it is not nullptr.
- ///
- /// @param[in] rhs
- /// A const FileSpec object pointer to copy if non-nullptr.
- //------------------------------------------------------------------
- FileSpec(const FileSpec *rhs);
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~FileSpec();
-
- bool DirectoryEquals(const FileSpec &other) const;
-
- bool FileEquals(const FileSpec &other) const;
-
- //------------------------------------------------------------------
- /// Assignment operator.
- ///
- /// Makes a copy of the uniqued directory and filename strings from
- /// \a rhs.
- ///
- /// @param[in] rhs
- /// A const FileSpec object reference to assign to this object.
- ///
- /// @return
- /// A const reference to this object.
- //------------------------------------------------------------------
- const FileSpec &operator=(const FileSpec &rhs);
-
- //------------------------------------------------------------------
- /// Equal to operator
- ///
- /// Tests if this object is equal to \a rhs.
- ///
- /// @param[in] rhs
- /// A const FileSpec object reference to compare this object
- /// to.
- ///
- /// @return
- /// \b true if this object is equal to \a rhs, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool operator==(const FileSpec &rhs) const;
-
- //------------------------------------------------------------------
- /// Not equal to operator
- ///
- /// Tests if this object is not equal to \a rhs.
- ///
- /// @param[in] rhs
- /// A const FileSpec object reference to compare this object
- /// to.
- ///
- /// @return
- /// \b true if this object is equal to \a rhs, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool operator!=(const FileSpec &rhs) const;
-
- //------------------------------------------------------------------
- /// Less than to operator
- ///
- /// Tests if this object is less than \a rhs.
- ///
- /// @param[in] rhs
- /// A const FileSpec object reference to compare this object
- /// to.
- ///
- /// @return
- /// \b true if this object is less than \a rhs, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool operator<(const FileSpec &rhs) const;
-
- //------------------------------------------------------------------
- /// Convert to pointer operator.
- ///
- /// This allows code to check a FileSpec object to see if it
- /// contains anything valid using code such as:
- ///
- /// @code
- /// FileSpec file_spec(...);
- /// if (file_spec)
- /// { ...
- /// @endcode
- ///
- /// @return
- /// A pointer to this object if either the directory or filename
- /// is valid, nullptr otherwise.
- //------------------------------------------------------------------
- explicit operator bool() const;
-
- //------------------------------------------------------------------
- /// Logical NOT operator.
- ///
- /// This allows code to check a FileSpec object to see if it is
- /// invalid using code such as:
- ///
- /// @code
- /// FileSpec file_spec(...);
- /// if (!file_spec)
- /// { ...
- /// @endcode
- ///
- /// @return
- /// Returns \b true if the object has an empty directory and
- /// filename, \b false otherwise.
- //------------------------------------------------------------------
- bool operator!() const;
-
- //------------------------------------------------------------------
- /// Clears the object state.
- ///
- /// Clear this object by releasing both the directory and filename
- /// string values and reverting them to empty strings.
- //------------------------------------------------------------------
- void Clear();
-
- //------------------------------------------------------------------
- /// Compare two FileSpec objects.
- ///
- /// If \a full is true, then both the directory and the filename
- /// must match. If \a full is false, then the directory names for
- /// \a lhs and \a rhs are only compared if they are both not empty.
- /// This allows a FileSpec object to only contain a filename
- /// and it can match FileSpec objects that have matching
- /// filenames with different paths.
- ///
- /// @param[in] lhs
- /// A const reference to the Left Hand Side object to compare.
- ///
- /// @param[in] rhs
- /// A const reference to the Right Hand Side object to compare.
- ///
- /// @param[in] full
- /// If true, then both the directory and filenames will have to
- /// match for a compare to return zero (equal to). If false
- /// and either directory from \a lhs or \a rhs is empty, then
- /// only the filename will be compared, else a full comparison
- /// is done.
- ///
- /// @return
- /// @li -1 if \a lhs is less than \a rhs
- /// @li 0 if \a lhs is equal to \a rhs
- /// @li 1 if \a lhs is greater than \a rhs
- //------------------------------------------------------------------
- static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full);
-
- static bool Equal(const FileSpec &a, const FileSpec &b, bool full,
- bool remove_backups = false);
-
- //------------------------------------------------------------------
- /// Case sensitivity of path.
- ///
- /// @return
- /// \b true if the file path is case sensitive (POSIX), false
- /// if case insensitive (Windows).
- //------------------------------------------------------------------
- bool IsCaseSensitive() const { return m_syntax != ePathSyntaxWindows; }
-
- //------------------------------------------------------------------
- /// Dump this object to a Stream.
- ///
- /// Dump the object to the supplied stream \a s. If the object
- /// contains a valid directory name, it will be displayed followed
- /// by a directory delimiter, and the filename.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void Dump(Stream *s) const;
-
- //------------------------------------------------------------------
- /// Existence test.
- ///
- /// @return
- /// \b true if the file exists on disk, \b false otherwise.
- //------------------------------------------------------------------
- bool Exists() const;
-
- //------------------------------------------------------------------
- /// Check if a file is readable by the current user
- ///
- /// @return
- /// \b true if the file exists on disk and is readable, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool Readable() const;
-
- //------------------------------------------------------------------
- /// Expanded existence test.
- ///
- /// Call into the Host to see if it can help find the file (e.g. by
- /// searching paths set in the environment, etc.).
- ///
- /// If found, sets the value of m_directory to the directory where
- /// the file was found.
- ///
- /// @return
- /// \b true if was able to find the file using expanded search
- /// methods, \b false otherwise.
- //------------------------------------------------------------------
- bool ResolveExecutableLocation();
-
- //------------------------------------------------------------------
- /// Canonicalize this file path (basically running the static
- /// FileSpec::Resolve method on it). Useful if you asked us not to
- /// resolve the file path when you set the file.
- //------------------------------------------------------------------
- bool ResolvePath();
-
- uint64_t GetByteSize() const;
-
- PathSyntax GetPathSyntax() const;
-
- //------------------------------------------------------------------
- /// Directory string get accessor.
- ///
- /// @return
- /// A reference to the directory string object.
- //------------------------------------------------------------------
- ConstString &GetDirectory();
-
- //------------------------------------------------------------------
- /// Directory string const get accessor.
- ///
- /// @return
- /// A const reference to the directory string object.
- //------------------------------------------------------------------
- const ConstString &GetDirectory() const;
-
- //------------------------------------------------------------------
- /// Filename string get accessor.
- ///
- /// @return
- /// A reference to the filename string object.
- //------------------------------------------------------------------
- ConstString &GetFilename();
-
- //------------------------------------------------------------------
- /// Filename string const get accessor.
- ///
- /// @return
- /// A const reference to the filename string object.
- //------------------------------------------------------------------
- const ConstString &GetFilename() const;
-
- //------------------------------------------------------------------
- /// Returns true if the filespec represents an implementation source
- /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
- /// extension).
- ///
- /// @return
- /// \b true if the filespec represents an implementation source
- /// file, \b false otherwise.
- //------------------------------------------------------------------
- bool IsSourceImplementationFile() const;
-
- //------------------------------------------------------------------
- /// Returns true if the filespec represents a relative path.
- ///
- /// @return
- /// \b true if the filespec represents a relative path,
- /// \b false otherwise.
- //------------------------------------------------------------------
- bool IsRelative() const;
-
- //------------------------------------------------------------------
- /// Returns true if the filespec represents an absolute path.
- ///
- /// @return
- /// \b true if the filespec represents an absolute path,
- /// \b false otherwise.
- //------------------------------------------------------------------
- bool IsAbsolute() const;
-
- //------------------------------------------------------------------
- /// Extract the full path to the file.
- ///
- /// Extract the directory and path into a fixed buffer. This is
- /// needed as the directory and path are stored in separate string
- /// values.
- ///
- /// @param[out] path
- /// The buffer in which to place the extracted full path.
- ///
- /// @param[in] max_path_length
- /// The maximum length of \a path.
- ///
- /// @return
- /// Returns the number of characters that would be needed to
- /// properly copy the full path into \a path. If the returned
- /// number is less than \a max_path_length, then the path is
- /// properly copied and terminated. If the return value is
- /// >= \a max_path_length, then the path was truncated (but is
- /// still NULL terminated).
- //------------------------------------------------------------------
- size_t GetPath(char *path, size_t max_path_length,
- bool denormalize = true) const;
-
- //------------------------------------------------------------------
- /// Extract the full path to the file.
- ///
- /// Extract the directory and path into a std::string, which is returned.
- ///
- /// @return
- /// Returns a std::string with the directory and filename
- /// concatenated.
- //------------------------------------------------------------------
- std::string GetPath(bool denormalize = true) const;
-
- const char *GetCString(bool denormalize = true) const;
-
- //------------------------------------------------------------------
- /// Extract the full path to the file.
- ///
- /// Extract the directory and path into an llvm::SmallVectorImpl<>
- ///
- /// @return
- /// Returns a std::string with the directory and filename
- /// concatenated.
- //------------------------------------------------------------------
- void GetPath(llvm::SmallVectorImpl<char> &path,
- bool denormalize = true) const;
-
- //------------------------------------------------------------------
- /// Extract the extension of the file.
- ///
- /// Returns a ConstString that represents the extension of the filename
- /// for this FileSpec object. If this object does not represent a file,
- /// or the filename has no extension, ConstString(nullptr) is returned.
- /// The dot ('.') character is not returned as part of the extension
- ///
- /// @return
- /// Returns the extension of the file as a ConstString object.
- //------------------------------------------------------------------
- ConstString GetFileNameExtension() const;
-
- //------------------------------------------------------------------
- /// Return the filename without the extension part
- ///
- /// Returns a ConstString that represents the filename of this object
- /// without the extension part (e.g. for a file named "foo.bar", "foo"
- /// is returned)
- ///
- /// @return
- /// Returns the filename without extension
- /// as a ConstString object.
- //------------------------------------------------------------------
- ConstString GetFileNameStrippingExtension() const;
-
- //------------------------------------------------------------------
- /// Return the current permissions of the path.
- ///
- /// Returns a bitmask for the current permissions of the file
- /// ( zero or more of the permission bits defined in
- /// File::Permissions).
- ///
- /// @return
- /// Zero if the file doesn't exist or we are unable to get
- /// information for the file, otherwise one or more permission
- /// bits from the File::Permissions enumeration.
- //------------------------------------------------------------------
- uint32_t GetPermissions() const;
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// Return the size in bytes that this object takes in memory. This
- /// returns the size in bytes of this object, not any shared string
- /// values it may refer to.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- ///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
- size_t MemorySize() const;
-
- //------------------------------------------------------------------
- /// Normalize a pathname by collapsing redundant separators and
- /// up-level references.
- //------------------------------------------------------------------
- FileSpec GetNormalizedPath() const;
-
- //------------------------------------------------------------------
- /// Change the file specified with a new path.
- ///
- /// Update the contents of this object with a new path. The path will
- /// be split up into a directory and filename and stored as uniqued
- /// string values for quick comparison and efficient memory usage.
- ///
- /// @param[in] path
- /// A full, partial, or relative path to a file.
- ///
- /// @param[in] resolve_path
- /// If \b true, then we will try to resolve links the path using
- /// the static FileSpec::Resolve.
- //------------------------------------------------------------------
- void SetFile(llvm::StringRef path, bool resolve_path,
- PathSyntax syntax = ePathSyntaxHostNative);
-
- void SetFile(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple);
-
- bool IsResolved() const { return m_is_resolved; }
-
- //------------------------------------------------------------------
- /// Set if the file path has been resolved or not.
- ///
- /// If you know a file path is already resolved and avoided passing
- /// a \b true parameter for any functions that take a "bool
- /// resolve_path" parameter, you can set the value manually using
- /// this call to make sure we don't try and resolve it later, or try
- /// and resolve a path that has already been resolved.
- ///
- /// @param[in] is_resolved
- /// A boolean value that will replace the current value that
- /// indicates if the paths in this object have been resolved.
- //------------------------------------------------------------------
- void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
-
- //------------------------------------------------------------------
- /// Resolves user name and links in \a path, and overwrites the input
- /// argument with the resolved path.
- ///
- /// @param[in] path
- /// Input path to be resolved, in the form of a llvm::SmallString or
- /// similar.
- //------------------------------------------------------------------
- static void Resolve(llvm::SmallVectorImpl<char> &path);
-
- FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
- FileSpec CopyByRemovingLastPathComponent() const;
-
- void PrependPathComponent(llvm::StringRef component);
- void PrependPathComponent(const FileSpec &new_path);
-
- void AppendPathComponent(llvm::StringRef component);
- void AppendPathComponent(const FileSpec &new_path);
-
- void RemoveLastPathComponent();
-
- ConstString GetLastPathComponent() const;
-
- enum EnumerateDirectoryResult {
- eEnumerateDirectoryResultNext, // Enumerate next entry in the current
- // directory
- eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a
- // directory or symlink, or next if not
- eEnumerateDirectoryResultQuit // Stop directory enumerations at any level
- };
-
- typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
- void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec);
-
- static void EnumerateDirectory(llvm::StringRef dir_path,
- bool find_directories, bool find_files,
- bool find_other,
- EnumerateDirectoryCallbackType callback,
- void *callback_baton);
-
- typedef std::function<EnumerateDirectoryResult(
- llvm::sys::fs::file_type file_type, const FileSpec &spec)>
- DirectoryCallback;
-
-protected:
- //------------------------------------------------------------------
- // Member variables
- //------------------------------------------------------------------
- ConstString m_directory; ///< The uniqued directory path
- ConstString m_filename; ///< The uniqued filename path
- mutable bool m_is_resolved = false; ///< True if this path has been resolved.
- PathSyntax
- m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix)
-};
-
-//----------------------------------------------------------------------
-/// Dump a FileSpec object to a stream
-//----------------------------------------------------------------------
-Stream &operator<<(Stream &s, const FileSpec &f);
-
-} // namespace lldb_private
-
-namespace llvm {
-
-/// Implementation of format_provider<T> for FileSpec.
-///
-/// The options string of a FileSpec has the grammar:
-///
-/// file_spec_options :: (empty) | F | D
-///
-/// =======================================================
-/// | style | Meaning | Example |
-/// -------------------------------------------------------
-/// | | | Input | Output |
-/// =======================================================
-/// | F | Only print filename | /foo/bar | bar |
-/// | D | Only print directory | /foo/bar | /foo/ |
-/// | (empty) | Print file and dir | | |
-/// =======================================================
-///
-/// Any other value is considered an invalid format string.
-///
-template <> struct format_provider<lldb_private::FileSpec> {
- static void format(const lldb_private::FileSpec &F, llvm::raw_ostream &Stream,
- StringRef Style);
-};
-}
-
-#endif // liblldb_FileSpec_h_
Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef liblldb_Host_FileSystem_h
#define liblldb_Host_FileSystem_h
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/Chrono.h"
#include "lldb/lldb-types.h"
Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Wed Mar 22 13:40:07 2017
@@ -17,8 +17,8 @@
#include <string>
#include "lldb/Host/File.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostThread.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-private.h"
Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Wed Mar 22 13:40:07 2017
@@ -11,7 +11,7 @@
#define lldb_Host_HostInfoBase_h_
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/StringRef.h"
Modified: lldb/trunk/include/lldb/Host/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Symbols.h (original)
+++ lldb/trunk/include/lldb/Host/Symbols.h Wed Mar 22 13:40:07 2017
@@ -16,7 +16,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_
#define lldb_Host_freebsd_HostInfoFreeBSD_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_linux_HostInfoLinux_h_
#define lldb_Host_linux_HostInfoLinux_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/StringRef.h"
Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_macosx_HostInfoMacOSX_h_
#define lldb_Host_macosx_HostInfoMacOSX_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h (original)
+++ lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_netbsd_HostInfoNetBSD_h_
#define lldb_Host_netbsd_HostInfoNetBSD_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_posix_HostInfoPosix_h_
#define lldb_Host_posix_HostInfoPosix_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h Wed Mar 22 13:40:07 2017
@@ -10,8 +10,8 @@
#ifndef lldb_Host_windows_HostInfoWindows_h_
#define lldb_Host_windows_HostInfoWindows_h_
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Wed Mar 22 13:40:07 2017
@@ -12,7 +12,7 @@
#include "lldb/Interpreter/OptionValue.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/Chrono.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Symbol/Declaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Declaration.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Declaration.h (original)
+++ lldb/trunk/include/lldb/Symbol/Declaration.h Wed Mar 22 13:40:07 2017
@@ -10,7 +10,7 @@
#ifndef liblldb_Declaration_h_
#define liblldb_Declaration_h_
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Symbol/LineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/LineEntry.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/LineEntry.h (original)
+++ lldb/trunk/include/lldb/Symbol/LineEntry.h Wed Mar 22 13:40:07 2017
@@ -11,7 +11,7 @@
#define liblldb_LineEntry_h_
#include "lldb/Core/AddressRange.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Symbol/ObjectContainer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectContainer.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectContainer.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectContainer.h Wed Mar 22 13:40:07 2017
@@ -16,9 +16,9 @@
// Project includes
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Wed Mar 22 13:40:07 2017
@@ -13,11 +13,11 @@
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/UnwindTable.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Target/FileAction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/FileAction.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/FileAction.h (original)
+++ lldb/trunk/include/lldb/Target/FileAction.h Wed Mar 22 13:40:07 2017
@@ -10,7 +10,7 @@
#ifndef liblldb_Target_FileAction_h
#define liblldb_Target_FileAction_h
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include <string>
namespace lldb_private {
Modified: lldb/trunk/include/lldb/Target/ModuleCache.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ModuleCache.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ModuleCache.h (original)
+++ lldb/trunk/include/lldb/Target/ModuleCache.h Wed Mar 22 13:40:07 2017
@@ -14,8 +14,8 @@
#include "lldb/lldb-types.h"
#include "lldb/Host/File.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include <functional>
#include <string>
Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Wed Mar 22 13:40:07 2017
@@ -24,9 +24,9 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"
Modified: lldb/trunk/include/lldb/Target/ProcessInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ProcessInfo.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ProcessInfo.h (original)
+++ lldb/trunk/include/lldb/Target/ProcessInfo.h Wed Mar 22 13:40:07 2017
@@ -12,8 +12,8 @@
// LLDB headers
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
//----------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h Wed Mar 22 13:40:07 2017
@@ -16,11 +16,11 @@
// LLDB Headers
#include "lldb/Utility/Flags.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Target/FileAction.h"
#include "lldb/Target/ProcessInfo.h"
+#include "lldb/Utility/FileSpec.h"
namespace lldb_private {
Added: lldb/trunk/include/lldb/Utility/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=298536&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Utility/FileSpec.h (added)
+++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed Mar 22 13:40:07 2017
@@ -0,0 +1,606 @@
+//===-- FileSpec.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FileSpec_h_
+#define liblldb_FileSpec_h_
+
+// C Includes
+// C++ Includes
+#include <functional>
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/Triple.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatVariadic.h"
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class FileSpec FileSpec.h "lldb/Host/FileSpec.h"
+/// @brief A file utility class.
+///
+/// A file specification class that divides paths up into a directory
+/// and basename. These string values of the paths are put into uniqued
+/// string pools for fast comparisons and efficient memory usage.
+///
+/// Another reason the paths are split into the directory and basename
+/// is to allow efficient debugger searching. Often in a debugger the
+/// user types in the basename of the file, for example setting a
+/// breakpoint by file and line, or specifying a module (shared library)
+/// to limit the scope in which to execute a command. The user rarely
+/// types in a full path. When the paths are already split up, it makes
+/// it easy for us to compare only the basenames of a lot of file
+/// specifications without having to split up the file path each time
+/// to get to the basename.
+//----------------------------------------------------------------------
+class FileSpec {
+public:
+ enum PathSyntax {
+ ePathSyntaxPosix,
+ ePathSyntaxWindows,
+ ePathSyntaxHostNative
+ };
+
+ FileSpec();
+
+ //------------------------------------------------------------------
+ /// Constructor with path.
+ ///
+ /// Takes a path to a file which can be just a filename, or a full
+ /// path. If \a path is not nullptr or empty, this function will call
+ /// FileSpec::SetFile (const char *path, bool resolve).
+ ///
+ /// @param[in] path
+ /// The full or partial path to a file.
+ ///
+ /// @param[in] resolve_path
+ /// If \b true, then we resolve the path, removing stray ../.. and so
+ /// forth,
+ /// if \b false we trust the path is in canonical form already.
+ ///
+ /// @see FileSpec::SetFile (const char *path, bool resolve)
+ //------------------------------------------------------------------
+ explicit FileSpec(llvm::StringRef path, bool resolve_path,
+ PathSyntax syntax = ePathSyntaxHostNative);
+
+ explicit FileSpec(llvm::StringRef path, bool resolve_path,
+ const llvm::Triple &Triple);
+
+ //------------------------------------------------------------------
+ /// Copy constructor
+ ///
+ /// Makes a copy of the uniqued directory and filename strings from
+ /// \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object reference to copy.
+ //------------------------------------------------------------------
+ FileSpec(const FileSpec &rhs);
+
+ //------------------------------------------------------------------
+ /// Copy constructor
+ ///
+ /// Makes a copy of the uniqued directory and filename strings from
+ /// \a rhs if it is not nullptr.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object pointer to copy if non-nullptr.
+ //------------------------------------------------------------------
+ FileSpec(const FileSpec *rhs);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~FileSpec();
+
+ bool DirectoryEquals(const FileSpec &other) const;
+
+ bool FileEquals(const FileSpec &other) const;
+
+ //------------------------------------------------------------------
+ /// Assignment operator.
+ ///
+ /// Makes a copy of the uniqued directory and filename strings from
+ /// \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object reference to assign to this object.
+ ///
+ /// @return
+ /// A const reference to this object.
+ //------------------------------------------------------------------
+ const FileSpec &operator=(const FileSpec &rhs);
+
+ //------------------------------------------------------------------
+ /// Equal to operator
+ ///
+ /// Tests if this object is equal to \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// @return
+ /// \b true if this object is equal to \a rhs, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool operator==(const FileSpec &rhs) const;
+
+ //------------------------------------------------------------------
+ /// Not equal to operator
+ ///
+ /// Tests if this object is not equal to \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// @return
+ /// \b true if this object is equal to \a rhs, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool operator!=(const FileSpec &rhs) const;
+
+ //------------------------------------------------------------------
+ /// Less than to operator
+ ///
+ /// Tests if this object is less than \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// @return
+ /// \b true if this object is less than \a rhs, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool operator<(const FileSpec &rhs) const;
+
+ //------------------------------------------------------------------
+ /// Convert to pointer operator.
+ ///
+ /// This allows code to check a FileSpec object to see if it
+ /// contains anything valid using code such as:
+ ///
+ /// @code
+ /// FileSpec file_spec(...);
+ /// if (file_spec)
+ /// { ...
+ /// @endcode
+ ///
+ /// @return
+ /// A pointer to this object if either the directory or filename
+ /// is valid, nullptr otherwise.
+ //------------------------------------------------------------------
+ explicit operator bool() const;
+
+ //------------------------------------------------------------------
+ /// Logical NOT operator.
+ ///
+ /// This allows code to check a FileSpec object to see if it is
+ /// invalid using code such as:
+ ///
+ /// @code
+ /// FileSpec file_spec(...);
+ /// if (!file_spec)
+ /// { ...
+ /// @endcode
+ ///
+ /// @return
+ /// Returns \b true if the object has an empty directory and
+ /// filename, \b false otherwise.
+ //------------------------------------------------------------------
+ bool operator!() const;
+
+ //------------------------------------------------------------------
+ /// Clears the object state.
+ ///
+ /// Clear this object by releasing both the directory and filename
+ /// string values and reverting them to empty strings.
+ //------------------------------------------------------------------
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Compare two FileSpec objects.
+ ///
+ /// If \a full is true, then both the directory and the filename
+ /// must match. If \a full is false, then the directory names for
+ /// \a lhs and \a rhs are only compared if they are both not empty.
+ /// This allows a FileSpec object to only contain a filename
+ /// and it can match FileSpec objects that have matching
+ /// filenames with different paths.
+ ///
+ /// @param[in] lhs
+ /// A const reference to the Left Hand Side object to compare.
+ ///
+ /// @param[in] rhs
+ /// A const reference to the Right Hand Side object to compare.
+ ///
+ /// @param[in] full
+ /// If true, then both the directory and filenames will have to
+ /// match for a compare to return zero (equal to). If false
+ /// and either directory from \a lhs or \a rhs is empty, then
+ /// only the filename will be compared, else a full comparison
+ /// is done.
+ ///
+ /// @return
+ /// @li -1 if \a lhs is less than \a rhs
+ /// @li 0 if \a lhs is equal to \a rhs
+ /// @li 1 if \a lhs is greater than \a rhs
+ //------------------------------------------------------------------
+ static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full);
+
+ static bool Equal(const FileSpec &a, const FileSpec &b, bool full,
+ bool remove_backups = false);
+
+ //------------------------------------------------------------------
+ /// Case sensitivity of path.
+ ///
+ /// @return
+ /// \b true if the file path is case sensitive (POSIX), false
+ /// if case insensitive (Windows).
+ //------------------------------------------------------------------
+ bool IsCaseSensitive() const { return m_syntax != ePathSyntaxWindows; }
+
+ //------------------------------------------------------------------
+ /// Dump this object to a Stream.
+ ///
+ /// Dump the object to the supplied stream \a s. If the object
+ /// contains a valid directory name, it will be displayed followed
+ /// by a directory delimiter, and the filename.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s) const;
+
+ //------------------------------------------------------------------
+ /// Existence test.
+ ///
+ /// @return
+ /// \b true if the file exists on disk, \b false otherwise.
+ //------------------------------------------------------------------
+ bool Exists() const;
+
+ //------------------------------------------------------------------
+ /// Check if a file is readable by the current user
+ ///
+ /// @return
+ /// \b true if the file exists on disk and is readable, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool Readable() const;
+
+ //------------------------------------------------------------------
+ /// Expanded existence test.
+ ///
+ /// Call into the Host to see if it can help find the file (e.g. by
+ /// searching paths set in the environment, etc.).
+ ///
+ /// If found, sets the value of m_directory to the directory where
+ /// the file was found.
+ ///
+ /// @return
+ /// \b true if was able to find the file using expanded search
+ /// methods, \b false otherwise.
+ //------------------------------------------------------------------
+ bool ResolveExecutableLocation();
+
+ //------------------------------------------------------------------
+ /// Canonicalize this file path (basically running the static
+ /// FileSpec::Resolve method on it). Useful if you asked us not to
+ /// resolve the file path when you set the file.
+ //------------------------------------------------------------------
+ bool ResolvePath();
+
+ uint64_t GetByteSize() const;
+
+ PathSyntax GetPathSyntax() const;
+
+ //------------------------------------------------------------------
+ /// Directory string get accessor.
+ ///
+ /// @return
+ /// A reference to the directory string object.
+ //------------------------------------------------------------------
+ ConstString &GetDirectory();
+
+ //------------------------------------------------------------------
+ /// Directory string const get accessor.
+ ///
+ /// @return
+ /// A const reference to the directory string object.
+ //------------------------------------------------------------------
+ const ConstString &GetDirectory() const;
+
+ //------------------------------------------------------------------
+ /// Filename string get accessor.
+ ///
+ /// @return
+ /// A reference to the filename string object.
+ //------------------------------------------------------------------
+ ConstString &GetFilename();
+
+ //------------------------------------------------------------------
+ /// Filename string const get accessor.
+ ///
+ /// @return
+ /// A const reference to the filename string object.
+ //------------------------------------------------------------------
+ const ConstString &GetFilename() const;
+
+ //------------------------------------------------------------------
+ /// Returns true if the filespec represents an implementation source
+ /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
+ /// extension).
+ ///
+ /// @return
+ /// \b true if the filespec represents an implementation source
+ /// file, \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsSourceImplementationFile() const;
+
+ //------------------------------------------------------------------
+ /// Returns true if the filespec represents a relative path.
+ ///
+ /// @return
+ /// \b true if the filespec represents a relative path,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsRelative() const;
+
+ //------------------------------------------------------------------
+ /// Returns true if the filespec represents an absolute path.
+ ///
+ /// @return
+ /// \b true if the filespec represents an absolute path,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ bool IsAbsolute() const;
+
+ //------------------------------------------------------------------
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into a fixed buffer. This is
+ /// needed as the directory and path are stored in separate string
+ /// values.
+ ///
+ /// @param[out] path
+ /// The buffer in which to place the extracted full path.
+ ///
+ /// @param[in] max_path_length
+ /// The maximum length of \a path.
+ ///
+ /// @return
+ /// Returns the number of characters that would be needed to
+ /// properly copy the full path into \a path. If the returned
+ /// number is less than \a max_path_length, then the path is
+ /// properly copied and terminated. If the return value is
+ /// >= \a max_path_length, then the path was truncated (but is
+ /// still NULL terminated).
+ //------------------------------------------------------------------
+ size_t GetPath(char *path, size_t max_path_length,
+ bool denormalize = true) const;
+
+ //------------------------------------------------------------------
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into a std::string, which is returned.
+ ///
+ /// @return
+ /// Returns a std::string with the directory and filename
+ /// concatenated.
+ //------------------------------------------------------------------
+ std::string GetPath(bool denormalize = true) const;
+
+ const char *GetCString(bool denormalize = true) const;
+
+ //------------------------------------------------------------------
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into an llvm::SmallVectorImpl<>
+ ///
+ /// @return
+ /// Returns a std::string with the directory and filename
+ /// concatenated.
+ //------------------------------------------------------------------
+ void GetPath(llvm::SmallVectorImpl<char> &path,
+ bool denormalize = true) const;
+
+ //------------------------------------------------------------------
+ /// Extract the extension of the file.
+ ///
+ /// Returns a ConstString that represents the extension of the filename
+ /// for this FileSpec object. If this object does not represent a file,
+ /// or the filename has no extension, ConstString(nullptr) is returned.
+ /// The dot ('.') character is not returned as part of the extension
+ ///
+ /// @return
+ /// Returns the extension of the file as a ConstString object.
+ //------------------------------------------------------------------
+ ConstString GetFileNameExtension() const;
+
+ //------------------------------------------------------------------
+ /// Return the filename without the extension part
+ ///
+ /// Returns a ConstString that represents the filename of this object
+ /// without the extension part (e.g. for a file named "foo.bar", "foo"
+ /// is returned)
+ ///
+ /// @return
+ /// Returns the filename without extension
+ /// as a ConstString object.
+ //------------------------------------------------------------------
+ ConstString GetFileNameStrippingExtension() const;
+
+ //------------------------------------------------------------------
+ /// Return the current permissions of the path.
+ ///
+ /// Returns a bitmask for the current permissions of the file
+ /// ( zero or more of the permission bits defined in
+ /// File::Permissions).
+ ///
+ /// @return
+ /// Zero if the file doesn't exist or we are unable to get
+ /// information for the file, otherwise one or more permission
+ /// bits from the File::Permissions enumeration.
+ //------------------------------------------------------------------
+ uint32_t GetPermissions() const;
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// Return the size in bytes that this object takes in memory. This
+ /// returns the size in bytes of this object, not any shared string
+ /// values it may refer to.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ ///
+ /// @see ConstString::StaticMemorySize ()
+ //------------------------------------------------------------------
+ size_t MemorySize() const;
+
+ //------------------------------------------------------------------
+ /// Normalize a pathname by collapsing redundant separators and
+ /// up-level references.
+ //------------------------------------------------------------------
+ FileSpec GetNormalizedPath() const;
+
+ //------------------------------------------------------------------
+ /// Change the file specified with a new path.
+ ///
+ /// Update the contents of this object with a new path. The path will
+ /// be split up into a directory and filename and stored as uniqued
+ /// string values for quick comparison and efficient memory usage.
+ ///
+ /// @param[in] path
+ /// A full, partial, or relative path to a file.
+ ///
+ /// @param[in] resolve_path
+ /// If \b true, then we will try to resolve links the path using
+ /// the static FileSpec::Resolve.
+ //------------------------------------------------------------------
+ void SetFile(llvm::StringRef path, bool resolve_path,
+ PathSyntax syntax = ePathSyntaxHostNative);
+
+ void SetFile(llvm::StringRef path, bool resolve_path,
+ const llvm::Triple &Triple);
+
+ bool IsResolved() const { return m_is_resolved; }
+
+ //------------------------------------------------------------------
+ /// Set if the file path has been resolved or not.
+ ///
+ /// If you know a file path is already resolved and avoided passing
+ /// a \b true parameter for any functions that take a "bool
+ /// resolve_path" parameter, you can set the value manually using
+ /// this call to make sure we don't try and resolve it later, or try
+ /// and resolve a path that has already been resolved.
+ ///
+ /// @param[in] is_resolved
+ /// A boolean value that will replace the current value that
+ /// indicates if the paths in this object have been resolved.
+ //------------------------------------------------------------------
+ void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
+
+ //------------------------------------------------------------------
+ /// Resolves user name and links in \a path, and overwrites the input
+ /// argument with the resolved path.
+ ///
+ /// @param[in] path
+ /// Input path to be resolved, in the form of a llvm::SmallString or
+ /// similar.
+ //------------------------------------------------------------------
+ static void Resolve(llvm::SmallVectorImpl<char> &path);
+
+ FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
+ FileSpec CopyByRemovingLastPathComponent() const;
+
+ void PrependPathComponent(llvm::StringRef component);
+ void PrependPathComponent(const FileSpec &new_path);
+
+ void AppendPathComponent(llvm::StringRef component);
+ void AppendPathComponent(const FileSpec &new_path);
+
+ void RemoveLastPathComponent();
+
+ ConstString GetLastPathComponent() const;
+
+ enum EnumerateDirectoryResult {
+ eEnumerateDirectoryResultNext, // Enumerate next entry in the current
+ // directory
+ eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a
+ // directory or symlink, or next if not
+ eEnumerateDirectoryResultQuit // Stop directory enumerations at any level
+ };
+
+ typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
+ void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec);
+
+ static void EnumerateDirectory(llvm::StringRef dir_path,
+ bool find_directories, bool find_files,
+ bool find_other,
+ EnumerateDirectoryCallbackType callback,
+ void *callback_baton);
+
+ typedef std::function<EnumerateDirectoryResult(
+ llvm::sys::fs::file_type file_type, const FileSpec &spec)>
+ DirectoryCallback;
+
+protected:
+ //------------------------------------------------------------------
+ // Member variables
+ //------------------------------------------------------------------
+ ConstString m_directory; ///< The uniqued directory path
+ ConstString m_filename; ///< The uniqued filename path
+ mutable bool m_is_resolved = false; ///< True if this path has been resolved.
+ PathSyntax
+ m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix)
+};
+
+//----------------------------------------------------------------------
+/// Dump a FileSpec object to a stream
+//----------------------------------------------------------------------
+Stream &operator<<(Stream &s, const FileSpec &f);
+
+} // namespace lldb_private
+
+namespace llvm {
+
+/// Implementation of format_provider<T> for FileSpec.
+///
+/// The options string of a FileSpec has the grammar:
+///
+/// file_spec_options :: (empty) | F | D
+///
+/// =======================================================
+/// | style | Meaning | Example |
+/// -------------------------------------------------------
+/// | | | Input | Output |
+/// =======================================================
+/// | F | Only print filename | /foo/bar | bar |
+/// | D | Only print directory | /foo/bar | /foo/ |
+/// | (empty) | Print file and dir | | |
+/// =======================================================
+///
+/// Any other value is considered an invalid format string.
+///
+template <> struct format_provider<lldb_private::FileSpec> {
+ static void format(const lldb_private::FileSpec &F, llvm::raw_ostream &Stream,
+ StringRef Style);
+};
+}
+
+#endif // liblldb_FileSpec_h_
Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Wed Mar 22 13:40:07 2017
@@ -12,8 +12,8 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
Modified: lldb/trunk/source/API/SBFileSpecList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpecList.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpecList.cpp (original)
+++ lldb/trunk/source/API/SBFileSpecList.cpp Wed Mar 22 13:40:07 2017
@@ -13,8 +13,8 @@
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpecList.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Wed Mar 22 13:40:07 2017
@@ -9,12 +9,12 @@
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBError.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostNativeThread.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "llvm/ADT/SmallString.h"
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Mar 22 13:40:07 2017
@@ -42,7 +42,6 @@
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Symbol/ClangASTContext.h"
@@ -59,6 +58,7 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/TargetList.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Wed Mar 22 13:40:07 2017
@@ -22,7 +22,6 @@
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
@@ -32,6 +31,7 @@
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/TildeExpressionResolver.h"
#include "llvm/ADT/SmallString.h"
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Wed Mar 22 13:40:07 2017
@@ -16,7 +16,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -28,6 +27,7 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Wed Mar 22 13:40:07 2017
@@ -18,7 +18,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/SourceManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -31,6 +30,7 @@
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/TargetList.h"
+#include "lldb/Utility/FileSpec.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Wed Mar 22 13:40:07 2017
@@ -25,7 +25,6 @@
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Expression/ExpressionVariable.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -43,6 +42,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/AnsiTerminal.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Wed Mar 22 13:40:07 2017
@@ -22,11 +22,11 @@
// Project includes
#include "lldb/Core/Debugger.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Core/StructuredData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StructuredData.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Core/StructuredData.cpp (original)
+++ lldb/trunk/source/Core/StructuredData.cpp Wed Mar 22 13:40:07 2017
@@ -14,10 +14,10 @@
#include <stdlib.h>
#include "lldb/Host/File.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/JSON.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Wed Mar 22 13:40:07 2017
@@ -6,7 +6,6 @@ endmacro()
add_host_subdirectory(common
common/File.cpp
common/FileCache.cpp
- common/FileSpec.cpp
common/FileSystem.cpp
common/GetOptInc.cpp
common/Host.cpp
Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Wed Mar 22 13:40:07 2017
@@ -13,9 +13,9 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Editline.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/SelectHelper.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Host/common/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Wed Mar 22 13:40:07 2017
@@ -28,9 +28,9 @@
#include "llvm/Support/Process.h" // for llvm::sys::Process::FileDescriptorHasColors()
#include "lldb/Host/Config.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
using namespace lldb;
Removed: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=298535&view=auto
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp (removed)
@@ -1,931 +0,0 @@
-//===-- FileSpec.cpp --------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Host/FileSpec.h"
-#include "lldb/Utility/CleanUp.h"
-#include "lldb/Utility/RegularExpression.h"
-#include "lldb/Utility/Stream.h"
-#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/StringList.h"
-#include "lldb/Utility/TildeExpressionResolver.h"
-
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/ConvertUTF.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/Program.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-namespace {
-
-static constexpr FileSpec::PathSyntax GetNativeSyntax() {
-#if defined(LLVM_ON_WIN32)
- return FileSpec::ePathSyntaxWindows;
-#else
- return FileSpec::ePathSyntaxPosix;
-#endif
-}
-
-bool PathSyntaxIsPosix(FileSpec::PathSyntax syntax) {
- return (syntax == FileSpec::ePathSyntaxPosix ||
- (syntax == FileSpec::ePathSyntaxHostNative &&
- GetNativeSyntax() == FileSpec::ePathSyntaxPosix));
-}
-
-const char *GetPathSeparators(FileSpec::PathSyntax syntax) {
- return PathSyntaxIsPosix(syntax) ? "/" : "\\/";
-}
-
-char GetPreferredPathSeparator(FileSpec::PathSyntax syntax) {
- return GetPathSeparators(syntax)[0];
-}
-
-bool IsPathSeparator(char value, FileSpec::PathSyntax syntax) {
- return value == '/' || (!PathSyntaxIsPosix(syntax) && value == '\\');
-}
-
-void Normalize(llvm::SmallVectorImpl<char> &path, FileSpec::PathSyntax syntax) {
- if (PathSyntaxIsPosix(syntax))
- return;
-
- std::replace(path.begin(), path.end(), '\\', '/');
- // Windows path can have \\ slashes which can be changed by replace
- // call above to //. Here we remove the duplicate.
- auto iter = std::unique(path.begin(), path.end(), [](char &c1, char &c2) {
- return (c1 == '/' && c2 == '/');
- });
- path.erase(iter, path.end());
-}
-
-void Denormalize(llvm::SmallVectorImpl<char> &path,
- FileSpec::PathSyntax syntax) {
- if (PathSyntaxIsPosix(syntax))
- return;
-
- std::replace(path.begin(), path.end(), '/', '\\');
-}
-
-size_t FilenamePos(llvm::StringRef str, FileSpec::PathSyntax syntax) {
- if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
- return 0;
-
- if (str.size() > 0 && IsPathSeparator(str.back(), syntax))
- return str.size() - 1;
-
- size_t pos = str.find_last_of(GetPathSeparators(syntax), str.size() - 1);
-
- if (!PathSyntaxIsPosix(syntax) && pos == llvm::StringRef::npos)
- pos = str.find_last_of(':', str.size() - 2);
-
- if (pos == llvm::StringRef::npos ||
- (pos == 1 && IsPathSeparator(str[0], syntax)))
- return 0;
-
- return pos + 1;
-}
-
-size_t RootDirStart(llvm::StringRef str, FileSpec::PathSyntax syntax) {
- // case "c:/"
- if (!PathSyntaxIsPosix(syntax) &&
- (str.size() > 2 && str[1] == ':' && IsPathSeparator(str[2], syntax)))
- return 2;
-
- // case "//"
- if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
- return llvm::StringRef::npos;
-
- // case "//net"
- if (str.size() > 3 && IsPathSeparator(str[0], syntax) && str[0] == str[1] &&
- !IsPathSeparator(str[2], syntax))
- return str.find_first_of(GetPathSeparators(syntax), 2);
-
- // case "/"
- if (str.size() > 0 && IsPathSeparator(str[0], syntax))
- return 0;
-
- return llvm::StringRef::npos;
-}
-
-size_t ParentPathEnd(llvm::StringRef path, FileSpec::PathSyntax syntax) {
- size_t end_pos = FilenamePos(path, syntax);
-
- bool filename_was_sep =
- path.size() > 0 && IsPathSeparator(path[end_pos], syntax);
-
- // Skip separators except for root dir.
- size_t root_dir_pos = RootDirStart(path.substr(0, end_pos), syntax);
-
- while (end_pos > 0 && (end_pos - 1) != root_dir_pos &&
- IsPathSeparator(path[end_pos - 1], syntax))
- --end_pos;
-
- if (end_pos == 1 && root_dir_pos == 0 && filename_was_sep)
- return llvm::StringRef::npos;
-
- return end_pos;
-}
-
-} // end anonymous namespace
-
-void FileSpec::Resolve(llvm::SmallVectorImpl<char> &path) {
- if (path.empty())
- return;
-
- llvm::SmallString<32> Source(path.begin(), path.end());
- StandardTildeExpressionResolver Resolver;
- Resolver.ResolveFullPath(Source, path);
-
- // Save a copy of the original path that's passed in
- llvm::SmallString<128> original_path(path.begin(), path.end());
-
- llvm::sys::fs::make_absolute(path);
- if (!llvm::sys::fs::exists(path)) {
- path.clear();
- path.append(original_path.begin(), original_path.end());
- }
-}
-
-FileSpec::FileSpec() : m_syntax(GetNativeSyntax()) {}
-
-//------------------------------------------------------------------
-// Default constructor that can take an optional full path to a
-// file on disk.
-//------------------------------------------------------------------
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax)
- : m_syntax(syntax) {
- SetFile(path, resolve_path, syntax);
-}
-
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple)
- : FileSpec{path, resolve_path,
- Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix} {}
-
-//------------------------------------------------------------------
-// Copy constructor
-//------------------------------------------------------------------
-FileSpec::FileSpec(const FileSpec &rhs)
- : m_directory(rhs.m_directory), m_filename(rhs.m_filename),
- m_is_resolved(rhs.m_is_resolved), m_syntax(rhs.m_syntax) {}
-
-//------------------------------------------------------------------
-// Copy constructor
-//------------------------------------------------------------------
-FileSpec::FileSpec(const FileSpec *rhs) : m_directory(), m_filename() {
- if (rhs)
- *this = *rhs;
-}
-
-//------------------------------------------------------------------
-// Virtual destructor in case anyone inherits from this class.
-//------------------------------------------------------------------
-FileSpec::~FileSpec() {}
-
-//------------------------------------------------------------------
-// Assignment operator.
-//------------------------------------------------------------------
-const FileSpec &FileSpec::operator=(const FileSpec &rhs) {
- if (this != &rhs) {
- m_directory = rhs.m_directory;
- m_filename = rhs.m_filename;
- m_is_resolved = rhs.m_is_resolved;
- m_syntax = rhs.m_syntax;
- }
- return *this;
-}
-
-//------------------------------------------------------------------
-// Update the contents of this object with a new path. The path will
-// be split up into a directory and filename and stored as uniqued
-// string values for quick comparison and efficient memory usage.
-//------------------------------------------------------------------
-void FileSpec::SetFile(llvm::StringRef pathname, bool resolve,
- PathSyntax syntax) {
- // CLEANUP: Use StringRef for string handling. This function is kind of a
- // mess and the unclear semantics of RootDirStart and ParentPathEnd make
- // it very difficult to understand this function. There's no reason this
- // function should be particularly complicated or difficult to understand.
- m_filename.Clear();
- m_directory.Clear();
- m_is_resolved = false;
- m_syntax = (syntax == ePathSyntaxHostNative) ? GetNativeSyntax() : syntax;
-
- if (pathname.empty())
- return;
-
- llvm::SmallString<64> resolved(pathname);
-
- if (resolve) {
- FileSpec::Resolve(resolved);
- m_is_resolved = true;
- }
-
- Normalize(resolved, m_syntax);
-
- llvm::StringRef resolve_path_ref(resolved.c_str());
- size_t dir_end = ParentPathEnd(resolve_path_ref, m_syntax);
- if (dir_end == 0) {
- m_filename.SetString(resolve_path_ref);
- return;
- }
-
- m_directory.SetString(resolve_path_ref.substr(0, dir_end));
-
- size_t filename_begin = dir_end;
- size_t root_dir_start = RootDirStart(resolve_path_ref, m_syntax);
- while (filename_begin != llvm::StringRef::npos &&
- filename_begin < resolve_path_ref.size() &&
- filename_begin != root_dir_start &&
- IsPathSeparator(resolve_path_ref[filename_begin], m_syntax))
- ++filename_begin;
- m_filename.SetString((filename_begin == llvm::StringRef::npos ||
- filename_begin >= resolve_path_ref.size())
- ? "."
- : resolve_path_ref.substr(filename_begin));
-}
-
-void FileSpec::SetFile(llvm::StringRef path, bool resolve,
- const llvm::Triple &Triple) {
- return SetFile(path, resolve,
- Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix);
-}
-
-//----------------------------------------------------------------------
-// Convert to pointer operator. This allows code to check any FileSpec
-// objects to see if they contain anything valid using code such as:
-//
-// if (file_spec)
-// {}
-//----------------------------------------------------------------------
-FileSpec::operator bool() const { return m_filename || m_directory; }
-
-//----------------------------------------------------------------------
-// Logical NOT operator. This allows code to check any FileSpec
-// objects to see if they are invalid using code such as:
-//
-// if (!file_spec)
-// {}
-//----------------------------------------------------------------------
-bool FileSpec::operator!() const { return !m_directory && !m_filename; }
-
-bool FileSpec::DirectoryEquals(const FileSpec &rhs) const {
- const bool case_sensitive = IsCaseSensitive() || rhs.IsCaseSensitive();
- return ConstString::Equals(m_directory, rhs.m_directory, case_sensitive);
-}
-
-bool FileSpec::FileEquals(const FileSpec &rhs) const {
- const bool case_sensitive = IsCaseSensitive() || rhs.IsCaseSensitive();
- return ConstString::Equals(m_filename, rhs.m_filename, case_sensitive);
-}
-
-//------------------------------------------------------------------
-// Equal to operator
-//------------------------------------------------------------------
-bool FileSpec::operator==(const FileSpec &rhs) const {
- if (!FileEquals(rhs))
- return false;
- if (DirectoryEquals(rhs))
- return true;
-
- // TODO: determine if we want to keep this code in here.
- // The code below was added to handle a case where we were
- // trying to set a file and line breakpoint and one path
- // was resolved, and the other not and the directory was
- // in a mount point that resolved to a more complete path:
- // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling
- // this out...
- if (IsResolved() && rhs.IsResolved()) {
- // Both paths are resolved, no need to look further...
- return false;
- }
-
- FileSpec resolved_lhs(*this);
-
- // If "this" isn't resolved, resolve it
- if (!IsResolved()) {
- if (resolved_lhs.ResolvePath()) {
- // This path wasn't resolved but now it is. Check if the resolved
- // directory is the same as our unresolved directory, and if so,
- // we can mark this object as resolved to avoid more future resolves
- m_is_resolved = (m_directory == resolved_lhs.m_directory);
- } else
- return false;
- }
-
- FileSpec resolved_rhs(rhs);
- if (!rhs.IsResolved()) {
- if (resolved_rhs.ResolvePath()) {
- // rhs's path wasn't resolved but now it is. Check if the resolved
- // directory is the same as rhs's unresolved directory, and if so,
- // we can mark this object as resolved to avoid more future resolves
- rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory);
- } else
- return false;
- }
-
- // If we reach this point in the code we were able to resolve both paths
- // and since we only resolve the paths if the basenames are equal, then
- // we can just check if both directories are equal...
- return DirectoryEquals(rhs);
-}
-
-//------------------------------------------------------------------
-// Not equal to operator
-//------------------------------------------------------------------
-bool FileSpec::operator!=(const FileSpec &rhs) const { return !(*this == rhs); }
-
-//------------------------------------------------------------------
-// Less than operator
-//------------------------------------------------------------------
-bool FileSpec::operator<(const FileSpec &rhs) const {
- return FileSpec::Compare(*this, rhs, true) < 0;
-}
-
-//------------------------------------------------------------------
-// Dump a FileSpec object to a stream
-//------------------------------------------------------------------
-Stream &lldb_private::operator<<(Stream &s, const FileSpec &f) {
- f.Dump(&s);
- return s;
-}
-
-//------------------------------------------------------------------
-// Clear this object by releasing both the directory and filename
-// string values and making them both the empty string.
-//------------------------------------------------------------------
-void FileSpec::Clear() {
- m_directory.Clear();
- m_filename.Clear();
-}
-
-//------------------------------------------------------------------
-// Compare two FileSpec objects. If "full" is true, then both
-// the directory and the filename must match. If "full" is false,
-// then the directory names for "a" and "b" are only compared if
-// they are both non-empty. This allows a FileSpec object to only
-// contain a filename and it can match FileSpec objects that have
-// matching filenames with different paths.
-//
-// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b"
-// and "1" if "a" is greater than "b".
-//------------------------------------------------------------------
-int FileSpec::Compare(const FileSpec &a, const FileSpec &b, bool full) {
- int result = 0;
-
- // case sensitivity of compare
- const bool case_sensitive = a.IsCaseSensitive() || b.IsCaseSensitive();
-
- // If full is true, then we must compare both the directory and filename.
-
- // If full is false, then if either directory is empty, then we match on
- // the basename only, and if both directories have valid values, we still
- // do a full compare. This allows for matching when we just have a filename
- // in one of the FileSpec objects.
-
- if (full || (a.m_directory && b.m_directory)) {
- result = ConstString::Compare(a.m_directory, b.m_directory, case_sensitive);
- if (result)
- return result;
- }
- return ConstString::Compare(a.m_filename, b.m_filename, case_sensitive);
-}
-
-bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full,
- bool remove_backups) {
- // case sensitivity of equality test
- const bool case_sensitive = a.IsCaseSensitive() || b.IsCaseSensitive();
-
- if (!full && (a.GetDirectory().IsEmpty() || b.GetDirectory().IsEmpty()))
- return ConstString::Equals(a.m_filename, b.m_filename, case_sensitive);
-
- if (remove_backups == false)
- return a == b;
-
- if (a == b)
- return true;
-
- return Equal(a.GetNormalizedPath(), b.GetNormalizedPath(), full, false);
-}
-
-FileSpec FileSpec::GetNormalizedPath() const {
- // Fast path. Do nothing if the path is not interesting.
- if (!m_directory.GetStringRef().contains(".") &&
- !m_directory.GetStringRef().contains("//") &&
- m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != ".")
- return *this;
-
- llvm::SmallString<64> path, result;
- const bool normalize = false;
- GetPath(path, normalize);
- llvm::StringRef rest(path);
-
- // We will not go below root dir.
- size_t root_dir_start = RootDirStart(path, m_syntax);
- const bool absolute = root_dir_start != llvm::StringRef::npos;
- if (absolute) {
- result += rest.take_front(root_dir_start + 1);
- rest = rest.drop_front(root_dir_start + 1);
- } else {
- if (m_syntax == ePathSyntaxWindows && path.size() > 2 && path[1] == ':') {
- result += rest.take_front(2);
- rest = rest.drop_front(2);
- }
- }
-
- bool anything_added = false;
- llvm::SmallVector<llvm::StringRef, 0> components, processed;
- rest.split(components, '/', -1, false);
- processed.reserve(components.size());
- for (auto component : components) {
- if (component == ".")
- continue; // Skip these.
- if (component != "..") {
- processed.push_back(component);
- continue; // Regular file name.
- }
- if (!processed.empty()) {
- processed.pop_back();
- continue; // Dots. Go one level up if we can.
- }
- if (absolute)
- continue; // We're at the top level. Cannot go higher than that. Skip.
-
- result += component; // We're a relative path. We need to keep these.
- result += '/';
- anything_added = true;
- }
- for (auto component : processed) {
- result += component;
- result += '/';
- anything_added = true;
- }
- if (anything_added)
- result.pop_back(); // Pop last '/'.
- else if (result.empty())
- result = ".";
-
- return FileSpec(result, false, m_syntax);
-}
-
-//------------------------------------------------------------------
-// Dump the object to the supplied stream. If the object contains
-// a valid directory name, it will be displayed followed by a
-// directory delimiter, and the filename.
-//------------------------------------------------------------------
-void FileSpec::Dump(Stream *s) const {
- if (s) {
- std::string path{GetPath(true)};
- s->PutCString(path);
- char path_separator = GetPreferredPathSeparator(m_syntax);
- if (!m_filename && !path.empty() && path.back() != path_separator)
- s->PutChar(path_separator);
- }
-}
-
-//------------------------------------------------------------------
-// Returns true if the file exists.
-//------------------------------------------------------------------
-bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); }
-
-bool FileSpec::Readable() const {
- return GetPermissions() & llvm::sys::fs::perms::all_read;
-}
-
-bool FileSpec::ResolveExecutableLocation() {
- // CLEANUP: Use StringRef for string handling.
- if (!m_directory) {
- const char *file_cstr = m_filename.GetCString();
- if (file_cstr) {
- const std::string file_str(file_cstr);
- llvm::ErrorOr<std::string> error_or_path =
- llvm::sys::findProgramByName(file_str);
- if (!error_or_path)
- return false;
- std::string path = error_or_path.get();
- llvm::StringRef dir_ref = llvm::sys::path::parent_path(path);
- if (!dir_ref.empty()) {
- // FindProgramByName returns "." if it can't find the file.
- if (strcmp(".", dir_ref.data()) == 0)
- return false;
-
- m_directory.SetCString(dir_ref.data());
- if (Exists())
- return true;
- else {
- // If FindProgramByName found the file, it returns the directory +
- // filename in its return results.
- // We need to separate them.
- FileSpec tmp_file(dir_ref.data(), false);
- if (tmp_file.Exists()) {
- m_directory = tmp_file.m_directory;
- return true;
- }
- }
- }
- }
- }
-
- return false;
-}
-
-bool FileSpec::ResolvePath() {
- if (m_is_resolved)
- return true; // We have already resolved this path
-
- // SetFile(...) will set m_is_resolved correctly if it can resolve the path
- SetFile(GetPath(false), true);
- return m_is_resolved;
-}
-
-uint64_t FileSpec::GetByteSize() const {
- uint64_t Size = 0;
- if (llvm::sys::fs::file_size(GetPath(), Size))
- return 0;
- return Size;
-}
-
-FileSpec::PathSyntax FileSpec::GetPathSyntax() const { return m_syntax; }
-
-uint32_t FileSpec::GetPermissions() const {
- namespace fs = llvm::sys::fs;
- fs::file_status st;
- if (fs::status(GetPath(), st, false))
- return fs::perms::perms_not_known;
-
- return st.permissions();
-}
-
-//------------------------------------------------------------------
-// Directory string get accessor.
-//------------------------------------------------------------------
-ConstString &FileSpec::GetDirectory() { return m_directory; }
-
-//------------------------------------------------------------------
-// Directory string const get accessor.
-//------------------------------------------------------------------
-const ConstString &FileSpec::GetDirectory() const { return m_directory; }
-
-//------------------------------------------------------------------
-// Filename string get accessor.
-//------------------------------------------------------------------
-ConstString &FileSpec::GetFilename() { return m_filename; }
-
-//------------------------------------------------------------------
-// Filename string const get accessor.
-//------------------------------------------------------------------
-const ConstString &FileSpec::GetFilename() const { return m_filename; }
-
-//------------------------------------------------------------------
-// Extract the directory and path into a fixed buffer. This is
-// needed as the directory and path are stored in separate string
-// values.
-//------------------------------------------------------------------
-size_t FileSpec::GetPath(char *path, size_t path_max_len,
- bool denormalize) const {
- if (!path)
- return 0;
-
- std::string result = GetPath(denormalize);
- ::snprintf(path, path_max_len, "%s", result.c_str());
- return std::min(path_max_len - 1, result.length());
-}
-
-std::string FileSpec::GetPath(bool denormalize) const {
- llvm::SmallString<64> result;
- GetPath(result, denormalize);
- return std::string(result.begin(), result.end());
-}
-
-const char *FileSpec::GetCString(bool denormalize) const {
- return ConstString{GetPath(denormalize)}.AsCString(NULL);
-}
-
-void FileSpec::GetPath(llvm::SmallVectorImpl<char> &path,
- bool denormalize) const {
- path.append(m_directory.GetStringRef().begin(),
- m_directory.GetStringRef().end());
- if (m_directory && m_filename &&
- !IsPathSeparator(m_directory.GetStringRef().back(), m_syntax))
- path.insert(path.end(), GetPreferredPathSeparator(m_syntax));
- path.append(m_filename.GetStringRef().begin(),
- m_filename.GetStringRef().end());
- Normalize(path, m_syntax);
- if (denormalize && !path.empty())
- Denormalize(path, m_syntax);
-}
-
-ConstString FileSpec::GetFileNameExtension() const {
- if (m_filename) {
- const char *filename = m_filename.GetCString();
- const char *dot_pos = strrchr(filename, '.');
- if (dot_pos && dot_pos[1] != '\0')
- return ConstString(dot_pos + 1);
- }
- return ConstString();
-}
-
-ConstString FileSpec::GetFileNameStrippingExtension() const {
- const char *filename = m_filename.GetCString();
- if (filename == NULL)
- return ConstString();
-
- const char *dot_pos = strrchr(filename, '.');
- if (dot_pos == NULL)
- return m_filename;
-
- return ConstString(filename, dot_pos - filename);
-}
-
-//------------------------------------------------------------------
-// Return the size in bytes that this object takes in memory. This
-// returns the size in bytes of this object, not any shared string
-// values it may refer to.
-//------------------------------------------------------------------
-size_t FileSpec::MemorySize() const {
- return m_filename.MemorySize() + m_directory.MemorySize();
-}
-
-void FileSpec::EnumerateDirectory(llvm::StringRef dir_path,
- bool find_directories, bool find_files,
- bool find_other,
- EnumerateDirectoryCallbackType callback,
- void *callback_baton) {
- namespace fs = llvm::sys::fs;
- std::error_code EC;
- fs::recursive_directory_iterator Iter(dir_path, EC);
- fs::recursive_directory_iterator End;
- for (; Iter != End && !EC; Iter.increment(EC)) {
- const auto &Item = *Iter;
- fs::file_status Status;
- if ((EC = Item.status(Status)))
- break;
- if (!find_files && fs::is_regular_file(Status))
- continue;
- if (!find_directories && fs::is_directory(Status))
- continue;
- if (!find_other && fs::is_other(Status))
- continue;
-
- FileSpec Spec(Item.path(), false);
- auto Result = callback(callback_baton, Status.type(), Spec);
- if (Result == eEnumerateDirectoryResultQuit)
- return;
- if (Result == eEnumerateDirectoryResultNext) {
- // Default behavior is to recurse. Opt out if the callback doesn't want
- // this behavior.
- Iter.no_push();
- }
- }
-}
-
-FileSpec
-FileSpec::CopyByAppendingPathComponent(llvm::StringRef component) const {
- FileSpec ret = *this;
- ret.AppendPathComponent(component);
- return ret;
-}
-
-FileSpec FileSpec::CopyByRemovingLastPathComponent() const {
- // CLEANUP: Use StringRef for string handling.
- const bool resolve = false;
- if (m_filename.IsEmpty() && m_directory.IsEmpty())
- return FileSpec("", resolve);
- if (m_directory.IsEmpty())
- return FileSpec("", resolve);
- if (m_filename.IsEmpty()) {
- const char *dir_cstr = m_directory.GetCString();
- const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
-
- // check for obvious cases before doing the full thing
- if (!last_slash_ptr)
- return FileSpec("", resolve);
- if (last_slash_ptr == dir_cstr)
- return FileSpec("/", resolve);
-
- size_t last_slash_pos = last_slash_ptr - dir_cstr + 1;
- ConstString new_path(dir_cstr, last_slash_pos);
- return FileSpec(new_path.GetCString(), resolve);
- } else
- return FileSpec(m_directory.GetCString(), resolve);
-}
-
-ConstString FileSpec::GetLastPathComponent() const {
- // CLEANUP: Use StringRef for string handling.
- if (m_filename)
- return m_filename;
- if (m_directory) {
- const char *dir_cstr = m_directory.GetCString();
- const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
- if (last_slash_ptr == NULL)
- return m_directory;
- if (last_slash_ptr == dir_cstr) {
- if (last_slash_ptr[1] == 0)
- return ConstString(last_slash_ptr);
- else
- return ConstString(last_slash_ptr + 1);
- }
- if (last_slash_ptr[1] != 0)
- return ConstString(last_slash_ptr + 1);
- const char *penultimate_slash_ptr = last_slash_ptr;
- while (*penultimate_slash_ptr) {
- --penultimate_slash_ptr;
- if (penultimate_slash_ptr == dir_cstr)
- break;
- if (*penultimate_slash_ptr == '/')
- break;
- }
- ConstString result(penultimate_slash_ptr + 1,
- last_slash_ptr - penultimate_slash_ptr);
- return result;
- }
- return ConstString();
-}
-
-static std::string
-join_path_components(FileSpec::PathSyntax syntax,
- const std::vector<llvm::StringRef> components) {
- std::string result;
- for (size_t i = 0; i < components.size(); ++i) {
- if (components[i].empty())
- continue;
- result += components[i];
- if (i != components.size() - 1 &&
- !IsPathSeparator(components[i].back(), syntax))
- result += GetPreferredPathSeparator(syntax);
- }
-
- return result;
-}
-
-void FileSpec::PrependPathComponent(llvm::StringRef component) {
- if (component.empty())
- return;
-
- const bool resolve = false;
- if (m_filename.IsEmpty() && m_directory.IsEmpty()) {
- SetFile(component, resolve);
- return;
- }
-
- std::string result =
- join_path_components(m_syntax, {component, m_directory.GetStringRef(),
- m_filename.GetStringRef()});
- SetFile(result, resolve, m_syntax);
-}
-
-void FileSpec::PrependPathComponent(const FileSpec &new_path) {
- return PrependPathComponent(new_path.GetPath(false));
-}
-
-void FileSpec::AppendPathComponent(llvm::StringRef component) {
- if (component.empty())
- return;
-
- component = component.drop_while(
- [this](char c) { return IsPathSeparator(c, m_syntax); });
-
- std::string result =
- join_path_components(m_syntax, {m_directory.GetStringRef(),
- m_filename.GetStringRef(), component});
-
- SetFile(result, false, m_syntax);
-}
-
-void FileSpec::AppendPathComponent(const FileSpec &new_path) {
- return AppendPathComponent(new_path.GetPath(false));
-}
-
-void FileSpec::RemoveLastPathComponent() {
- // CLEANUP: Use StringRef for string handling.
-
- const bool resolve = false;
- if (m_filename.IsEmpty() && m_directory.IsEmpty()) {
- SetFile("", resolve);
- return;
- }
- if (m_directory.IsEmpty()) {
- SetFile("", resolve);
- return;
- }
- if (m_filename.IsEmpty()) {
- const char *dir_cstr = m_directory.GetCString();
- const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
-
- // check for obvious cases before doing the full thing
- if (!last_slash_ptr) {
- SetFile("", resolve);
- return;
- }
- if (last_slash_ptr == dir_cstr) {
- SetFile("/", resolve);
- return;
- }
- size_t last_slash_pos = last_slash_ptr - dir_cstr + 1;
- ConstString new_path(dir_cstr, last_slash_pos);
- SetFile(new_path.GetCString(), resolve);
- } else
- SetFile(m_directory.GetCString(), resolve);
-}
-//------------------------------------------------------------------
-/// Returns true if the filespec represents an implementation source
-/// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
-/// extension).
-///
-/// @return
-/// \b true if the filespec represents an implementation source
-/// file, \b false otherwise.
-//------------------------------------------------------------------
-bool FileSpec::IsSourceImplementationFile() const {
- ConstString extension(GetFileNameExtension());
- if (!extension)
- return false;
-
- static RegularExpression g_source_file_regex(llvm::StringRef(
- "^([cC]|[mM]|[mM][mM]|[cC][pP][pP]|[cC]\\+\\+|[cC][xX][xX]|[cC][cC]|["
- "cC][pP]|[sS]|[aA][sS][mM]|[fF]|[fF]77|[fF]90|[fF]95|[fF]03|[fF][oO]["
- "rR]|[fF][tT][nN]|[fF][pP][pP]|[aA][dD][aA]|[aA][dD][bB]|[aA][dD][sS])"
- "$"));
- return g_source_file_regex.Execute(extension.GetStringRef());
-}
-
-bool FileSpec::IsRelative() const {
- const char *dir = m_directory.GetCString();
- llvm::StringRef directory(dir ? dir : "");
-
- if (directory.size() > 0) {
- if (PathSyntaxIsPosix(m_syntax)) {
- // If the path doesn't start with '/' or '~', return true
- switch (directory[0]) {
- case '/':
- case '~':
- return false;
- default:
- return true;
- }
- } else {
- if (directory.size() >= 2 && directory[1] == ':')
- return false;
- if (directory[0] == '/')
- return false;
- return true;
- }
- } else if (m_filename) {
- // No directory, just a basename, return true
- return true;
- }
- return false;
-}
-
-bool FileSpec::IsAbsolute() const { return !FileSpec::IsRelative(); }
-
-void llvm::format_provider<FileSpec>::format(const FileSpec &F,
- raw_ostream &Stream,
- StringRef Style) {
- assert(
- (Style.empty() || Style.equals_lower("F") || Style.equals_lower("D")) &&
- "Invalid FileSpec style!");
-
- StringRef dir = F.GetDirectory().GetStringRef();
- StringRef file = F.GetFilename().GetStringRef();
-
- if (dir.empty() && file.empty()) {
- Stream << "(empty)";
- return;
- }
-
- if (Style.equals_lower("F")) {
- Stream << (file.empty() ? "(empty)" : file);
- return;
- }
-
- // Style is either D or empty, either way we need to print the directory.
- if (!dir.empty()) {
- // Directory is stored in normalized form, which might be different
- // than preferred form. In order to handle this, we need to cut off
- // the filename, then denormalize, then write the entire denorm'ed
- // directory.
- llvm::SmallString<64> denormalized_dir = dir;
- Denormalize(denormalized_dir, F.GetPathSyntax());
- Stream << denormalized_dir;
- Stream << GetPreferredPathSeparator(F.GetPathSyntax());
- }
-
- if (Style.equals_lower("D")) {
- // We only want to print the directory, so now just exit.
- if (dir.empty())
- Stream << "(empty)";
- return;
- }
-
- if (!file.empty())
- Stream << file;
-}
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Mar 22 13:40:07 2017
@@ -50,7 +50,6 @@
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostProcess.h"
@@ -64,6 +63,7 @@
#include "lldb/Utility/CleanUp.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/lldb-private-forward.h"
#include "llvm/ADT/SmallString.h"
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Wed Mar 22 13:40:07 2017
@@ -61,7 +61,6 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Target/Platform.h"
@@ -70,6 +69,7 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp (original)
+++ lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp Wed Mar 22 13:40:07 2017
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostProcess.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Target/ProcessLaunchInfo.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include <limits.h>
Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Wed Mar 22 13:40:07 2017
@@ -8,10 +8,10 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/windows/HostProcessWindows.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ConvertUTF.h"
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Wed Mar 22 13:40:07 2017
@@ -24,9 +24,9 @@
// FIXME: Make a separate file for the completers.
#include "lldb/Core/FileSpecList.h"
#include "lldb/DataFormatters/FormatManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Target/Language.h"
Modified: lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp Wed Mar 22 13:40:07 2017
@@ -13,9 +13,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
using namespace lldb;
Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Wed Mar 22 13:40:07 2017
@@ -18,10 +18,10 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader {
public:
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h Wed Mar 22 13:40:07 2017
@@ -19,11 +19,11 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StructuredData.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/UUID.h"
#include "llvm/ADT/Triple.h"
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h Wed Mar 22 13:40:07 2017
@@ -26,11 +26,11 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StructuredData.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/UUID.h"
#include "DynamicLoaderDarwin.h"
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h Wed Mar 22 13:40:07 2017
@@ -29,11 +29,11 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StructuredData.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/UUID.h"
#include "DynamicLoaderDarwin.h"
Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h Wed Mar 22 13:40:07 2017
@@ -16,7 +16,7 @@
#include <string>
// Other libraries and framework includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
Modified: lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h Wed Mar 22 13:40:07 2017
@@ -14,10 +14,10 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
class DynamicLoaderStatic : public lldb_private::DynamicLoader {
public:
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Wed Mar 22 13:40:07 2017
@@ -27,11 +27,11 @@
// Project includes
#include "ClangModulesDeclVendor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Wed Mar 22 13:40:07 2017
@@ -25,7 +25,6 @@
#include "lldb/Expression/FunctionCaller.h"
#include "lldb/Expression/UserExpression.h"
#include "lldb/Expression/UtilityFunction.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ABI.h"
@@ -37,6 +36,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "llvm/ADT/STLExtras.h"
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Wed Mar 22 13:40:07 2017
@@ -13,9 +13,9 @@
// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UniqueCStringMap.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
// Other libraries and framework includes
#include "llvm/Support/Chrono.h"
Modified: lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h Wed Mar 22 13:40:07 2017
@@ -14,8 +14,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ObjectContainer.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
class ObjectContainerUniversalMachO : public lldb_private::ObjectContainer {
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Wed Mar 22 13:40:07 2017
@@ -20,9 +20,9 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
#include "lldb/lldb-private.h"
#include "ELFHeader.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Wed Mar 22 13:40:07 2017
@@ -21,7 +21,6 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Platform.h"
@@ -30,6 +29,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/UUID.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Mar 22 13:40:07 2017
@@ -27,7 +27,6 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -41,6 +40,7 @@
#include "lldb/Target/ThreadList.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/UUID.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Wed Mar 22 13:40:07 2017
@@ -17,8 +17,8 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/RangeMap.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Wed Mar 22 13:40:07 2017
@@ -20,13 +20,13 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/UUID.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp Wed Mar 22 13:40:07 2017
@@ -11,7 +11,7 @@
// collisions with WinAPI preprocessor macros.
#include "WindowsMiniDump.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/ConvertUTF.h"
#ifdef _WIN32
Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Wed Mar 22 13:40:07 2017
@@ -16,13 +16,13 @@
#include "llvm/Support/FileUtilities.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataEncoder.h"
#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
#include <limits.h>
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Mar 22 13:40:07 2017
@@ -24,11 +24,11 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp Wed Mar 22 13:40:07 2017
@@ -19,11 +19,11 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
using namespace lldb;
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Wed Mar 22 13:40:07 2017
@@ -22,11 +22,11 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h Wed Mar 22 13:40:07 2017
@@ -18,7 +18,7 @@
// Project includes
#include "PlatformDarwin.h"
#include "PlatformiOSSimulatorCoreSimulatorSupport.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/Optional.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Wed Mar 22 13:40:07 2017
@@ -19,12 +19,12 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Wed Mar 22 13:40:07 2017
@@ -19,12 +19,12 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h Wed Mar 22 13:40:07 2017
@@ -16,7 +16,7 @@
// Other libraries and framework includes
// Project includes
#include "Plugins/Platform/POSIX/PlatformPOSIX.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Wed Mar 22 13:40:07 2017
@@ -23,7 +23,6 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
@@ -33,6 +32,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Wed Mar 22 13:40:07 2017
@@ -18,7 +18,7 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Wed Mar 22 13:40:07 2017
@@ -21,7 +21,6 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -29,6 +28,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Wed Mar 22 13:40:07 2017
@@ -22,11 +22,11 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h Wed Mar 22 13:40:07 2017
@@ -16,7 +16,7 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp Wed Mar 22 13:40:07 2017
@@ -22,11 +22,11 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h Wed Mar 22 13:40:07 2017
@@ -17,7 +17,7 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "PlatformDarwin.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Wed Mar 22 13:40:07 2017
@@ -19,11 +19,11 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Wed Mar 22 13:40:07 2017
@@ -17,7 +17,7 @@
// Other libraries and framework includes
// Project includes
#include "PlatformDarwin.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Wed Mar 22 13:40:07 2017
@@ -20,12 +20,12 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Mar 22 13:40:07 2017
@@ -22,11 +22,11 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Wed Mar 22 13:40:07 2017
@@ -21,7 +21,6 @@
#include "lldb/Expression/UserExpression.h"
#include "lldb/Host/File.h"
#include "lldb/Host/FileCache.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
@@ -31,6 +30,7 @@
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Wed Mar 22 13:40:07 2017
@@ -21,13 +21,13 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/UriParser.h"
Modified: lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.h (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.h Wed Mar 22 13:40:07 2017
@@ -24,11 +24,11 @@
// Other libraries and framework includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/Debug.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
#include "LaunchFlavor.h"
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Wed Mar 22 13:40:07 2017
@@ -44,13 +44,13 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Host/posix/Fcntl.h"
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Wed Mar 22 13:40:07 2017
@@ -18,8 +18,8 @@
#include <mutex>
// Other libraries and framework includes
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostThread.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
namespace lldb_private {
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Wed Mar 22 13:40:07 2017
@@ -16,10 +16,10 @@
// Other libraries and framework includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Host/Debug.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/linux/Support.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
#include "NativeThreadLinux.h"
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Wed Mar 22 13:40:07 2017
@@ -19,11 +19,11 @@
// Other libraries and framework includes
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/State.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/UUID.h"
Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h Wed Mar 22 13:40:07 2017
@@ -15,8 +15,8 @@
// Other libraries and framework includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/FileSpec.h"
#include "NativeThreadNetBSD.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Wed Mar 22 13:40:07 2017
@@ -12,7 +12,6 @@
#include "IDebugDelegate.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Predicate.h"
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Host/windows/HostProcessWindows.h"
@@ -21,6 +20,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "Plugins/Process/Windows/Common/ProcessWindowsLog.h"
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed Mar 22 13:40:07 2017
@@ -18,7 +18,6 @@
// Other libraries and framework includes
#include "lldb/Core/StreamFile.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Pipe.h"
@@ -27,6 +26,7 @@
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Mar 22 13:40:07 2017
@@ -39,7 +39,6 @@
#include "lldb/Core/Value.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/PseudoTerminal.h"
@@ -65,6 +64,7 @@
#include "lldb/Target/TargetList.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
// Project includes
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Wed Mar 22 13:40:07 2017
@@ -13,7 +13,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -25,6 +24,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h Wed Mar 22 13:40:07 2017
@@ -20,12 +20,12 @@
// Project includes
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/StructuredData.h"
-#include "lldb/Utility/UUID.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
#include "AppleGetItemInfoHandler.h"
#include "AppleGetPendingItemsHandler.h"
Modified: lldb/trunk/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Target/PathMappingList.cpp (original)
+++ lldb/trunk/source/Target/PathMappingList.cpp Wed Mar 22 13:40:07 2017
@@ -14,10 +14,10 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
using namespace lldb;
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Wed Mar 22 13:40:07 2017
@@ -26,7 +26,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredData.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
@@ -40,6 +39,7 @@
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Mar 22 13:40:07 2017
@@ -34,7 +34,6 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/REPL.h"
#include "lldb/Expression/UserExpression.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -55,6 +54,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Wed Mar 22 13:40:07 2017
@@ -7,6 +7,7 @@ add_lldb_library(lldbUtility
DataExtractor.cpp
Error.cpp
FastDemangle.cpp
+ FileSpec.cpp
History.cpp
JSON.cpp
LLDBAssert.cpp
Added: lldb/trunk/source/Utility/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=298536&view=auto
==============================================================================
--- lldb/trunk/source/Utility/FileSpec.cpp (added)
+++ lldb/trunk/source/Utility/FileSpec.cpp Wed Mar 22 13:40:07 2017
@@ -0,0 +1,931 @@
+//===-- FileSpec.cpp --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/TildeExpressionResolver.h"
+
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+
+static constexpr FileSpec::PathSyntax GetNativeSyntax() {
+#if defined(LLVM_ON_WIN32)
+ return FileSpec::ePathSyntaxWindows;
+#else
+ return FileSpec::ePathSyntaxPosix;
+#endif
+}
+
+bool PathSyntaxIsPosix(FileSpec::PathSyntax syntax) {
+ return (syntax == FileSpec::ePathSyntaxPosix ||
+ (syntax == FileSpec::ePathSyntaxHostNative &&
+ GetNativeSyntax() == FileSpec::ePathSyntaxPosix));
+}
+
+const char *GetPathSeparators(FileSpec::PathSyntax syntax) {
+ return PathSyntaxIsPosix(syntax) ? "/" : "\\/";
+}
+
+char GetPreferredPathSeparator(FileSpec::PathSyntax syntax) {
+ return GetPathSeparators(syntax)[0];
+}
+
+bool IsPathSeparator(char value, FileSpec::PathSyntax syntax) {
+ return value == '/' || (!PathSyntaxIsPosix(syntax) && value == '\\');
+}
+
+void Normalize(llvm::SmallVectorImpl<char> &path, FileSpec::PathSyntax syntax) {
+ if (PathSyntaxIsPosix(syntax))
+ return;
+
+ std::replace(path.begin(), path.end(), '\\', '/');
+ // Windows path can have \\ slashes which can be changed by replace
+ // call above to //. Here we remove the duplicate.
+ auto iter = std::unique(path.begin(), path.end(), [](char &c1, char &c2) {
+ return (c1 == '/' && c2 == '/');
+ });
+ path.erase(iter, path.end());
+}
+
+void Denormalize(llvm::SmallVectorImpl<char> &path,
+ FileSpec::PathSyntax syntax) {
+ if (PathSyntaxIsPosix(syntax))
+ return;
+
+ std::replace(path.begin(), path.end(), '/', '\\');
+}
+
+size_t FilenamePos(llvm::StringRef str, FileSpec::PathSyntax syntax) {
+ if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
+ return 0;
+
+ if (str.size() > 0 && IsPathSeparator(str.back(), syntax))
+ return str.size() - 1;
+
+ size_t pos = str.find_last_of(GetPathSeparators(syntax), str.size() - 1);
+
+ if (!PathSyntaxIsPosix(syntax) && pos == llvm::StringRef::npos)
+ pos = str.find_last_of(':', str.size() - 2);
+
+ if (pos == llvm::StringRef::npos ||
+ (pos == 1 && IsPathSeparator(str[0], syntax)))
+ return 0;
+
+ return pos + 1;
+}
+
+size_t RootDirStart(llvm::StringRef str, FileSpec::PathSyntax syntax) {
+ // case "c:/"
+ if (!PathSyntaxIsPosix(syntax) &&
+ (str.size() > 2 && str[1] == ':' && IsPathSeparator(str[2], syntax)))
+ return 2;
+
+ // case "//"
+ if (str.size() == 2 && IsPathSeparator(str[0], syntax) && str[0] == str[1])
+ return llvm::StringRef::npos;
+
+ // case "//net"
+ if (str.size() > 3 && IsPathSeparator(str[0], syntax) && str[0] == str[1] &&
+ !IsPathSeparator(str[2], syntax))
+ return str.find_first_of(GetPathSeparators(syntax), 2);
+
+ // case "/"
+ if (str.size() > 0 && IsPathSeparator(str[0], syntax))
+ return 0;
+
+ return llvm::StringRef::npos;
+}
+
+size_t ParentPathEnd(llvm::StringRef path, FileSpec::PathSyntax syntax) {
+ size_t end_pos = FilenamePos(path, syntax);
+
+ bool filename_was_sep =
+ path.size() > 0 && IsPathSeparator(path[end_pos], syntax);
+
+ // Skip separators except for root dir.
+ size_t root_dir_pos = RootDirStart(path.substr(0, end_pos), syntax);
+
+ while (end_pos > 0 && (end_pos - 1) != root_dir_pos &&
+ IsPathSeparator(path[end_pos - 1], syntax))
+ --end_pos;
+
+ if (end_pos == 1 && root_dir_pos == 0 && filename_was_sep)
+ return llvm::StringRef::npos;
+
+ return end_pos;
+}
+
+} // end anonymous namespace
+
+void FileSpec::Resolve(llvm::SmallVectorImpl<char> &path) {
+ if (path.empty())
+ return;
+
+ llvm::SmallString<32> Source(path.begin(), path.end());
+ StandardTildeExpressionResolver Resolver;
+ Resolver.ResolveFullPath(Source, path);
+
+ // Save a copy of the original path that's passed in
+ llvm::SmallString<128> original_path(path.begin(), path.end());
+
+ llvm::sys::fs::make_absolute(path);
+ if (!llvm::sys::fs::exists(path)) {
+ path.clear();
+ path.append(original_path.begin(), original_path.end());
+ }
+}
+
+FileSpec::FileSpec() : m_syntax(GetNativeSyntax()) {}
+
+//------------------------------------------------------------------
+// Default constructor that can take an optional full path to a
+// file on disk.
+//------------------------------------------------------------------
+FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax)
+ : m_syntax(syntax) {
+ SetFile(path, resolve_path, syntax);
+}
+
+FileSpec::FileSpec(llvm::StringRef path, bool resolve_path,
+ const llvm::Triple &Triple)
+ : FileSpec{path, resolve_path,
+ Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix} {}
+
+//------------------------------------------------------------------
+// Copy constructor
+//------------------------------------------------------------------
+FileSpec::FileSpec(const FileSpec &rhs)
+ : m_directory(rhs.m_directory), m_filename(rhs.m_filename),
+ m_is_resolved(rhs.m_is_resolved), m_syntax(rhs.m_syntax) {}
+
+//------------------------------------------------------------------
+// Copy constructor
+//------------------------------------------------------------------
+FileSpec::FileSpec(const FileSpec *rhs) : m_directory(), m_filename() {
+ if (rhs)
+ *this = *rhs;
+}
+
+//------------------------------------------------------------------
+// Virtual destructor in case anyone inherits from this class.
+//------------------------------------------------------------------
+FileSpec::~FileSpec() {}
+
+//------------------------------------------------------------------
+// Assignment operator.
+//------------------------------------------------------------------
+const FileSpec &FileSpec::operator=(const FileSpec &rhs) {
+ if (this != &rhs) {
+ m_directory = rhs.m_directory;
+ m_filename = rhs.m_filename;
+ m_is_resolved = rhs.m_is_resolved;
+ m_syntax = rhs.m_syntax;
+ }
+ return *this;
+}
+
+//------------------------------------------------------------------
+// Update the contents of this object with a new path. The path will
+// be split up into a directory and filename and stored as uniqued
+// string values for quick comparison and efficient memory usage.
+//------------------------------------------------------------------
+void FileSpec::SetFile(llvm::StringRef pathname, bool resolve,
+ PathSyntax syntax) {
+ // CLEANUP: Use StringRef for string handling. This function is kind of a
+ // mess and the unclear semantics of RootDirStart and ParentPathEnd make
+ // it very difficult to understand this function. There's no reason this
+ // function should be particularly complicated or difficult to understand.
+ m_filename.Clear();
+ m_directory.Clear();
+ m_is_resolved = false;
+ m_syntax = (syntax == ePathSyntaxHostNative) ? GetNativeSyntax() : syntax;
+
+ if (pathname.empty())
+ return;
+
+ llvm::SmallString<64> resolved(pathname);
+
+ if (resolve) {
+ FileSpec::Resolve(resolved);
+ m_is_resolved = true;
+ }
+
+ Normalize(resolved, m_syntax);
+
+ llvm::StringRef resolve_path_ref(resolved.c_str());
+ size_t dir_end = ParentPathEnd(resolve_path_ref, m_syntax);
+ if (dir_end == 0) {
+ m_filename.SetString(resolve_path_ref);
+ return;
+ }
+
+ m_directory.SetString(resolve_path_ref.substr(0, dir_end));
+
+ size_t filename_begin = dir_end;
+ size_t root_dir_start = RootDirStart(resolve_path_ref, m_syntax);
+ while (filename_begin != llvm::StringRef::npos &&
+ filename_begin < resolve_path_ref.size() &&
+ filename_begin != root_dir_start &&
+ IsPathSeparator(resolve_path_ref[filename_begin], m_syntax))
+ ++filename_begin;
+ m_filename.SetString((filename_begin == llvm::StringRef::npos ||
+ filename_begin >= resolve_path_ref.size())
+ ? "."
+ : resolve_path_ref.substr(filename_begin));
+}
+
+void FileSpec::SetFile(llvm::StringRef path, bool resolve,
+ const llvm::Triple &Triple) {
+ return SetFile(path, resolve,
+ Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix);
+}
+
+//----------------------------------------------------------------------
+// Convert to pointer operator. This allows code to check any FileSpec
+// objects to see if they contain anything valid using code such as:
+//
+// if (file_spec)
+// {}
+//----------------------------------------------------------------------
+FileSpec::operator bool() const { return m_filename || m_directory; }
+
+//----------------------------------------------------------------------
+// Logical NOT operator. This allows code to check any FileSpec
+// objects to see if they are invalid using code such as:
+//
+// if (!file_spec)
+// {}
+//----------------------------------------------------------------------
+bool FileSpec::operator!() const { return !m_directory && !m_filename; }
+
+bool FileSpec::DirectoryEquals(const FileSpec &rhs) const {
+ const bool case_sensitive = IsCaseSensitive() || rhs.IsCaseSensitive();
+ return ConstString::Equals(m_directory, rhs.m_directory, case_sensitive);
+}
+
+bool FileSpec::FileEquals(const FileSpec &rhs) const {
+ const bool case_sensitive = IsCaseSensitive() || rhs.IsCaseSensitive();
+ return ConstString::Equals(m_filename, rhs.m_filename, case_sensitive);
+}
+
+//------------------------------------------------------------------
+// Equal to operator
+//------------------------------------------------------------------
+bool FileSpec::operator==(const FileSpec &rhs) const {
+ if (!FileEquals(rhs))
+ return false;
+ if (DirectoryEquals(rhs))
+ return true;
+
+ // TODO: determine if we want to keep this code in here.
+ // The code below was added to handle a case where we were
+ // trying to set a file and line breakpoint and one path
+ // was resolved, and the other not and the directory was
+ // in a mount point that resolved to a more complete path:
+ // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling
+ // this out...
+ if (IsResolved() && rhs.IsResolved()) {
+ // Both paths are resolved, no need to look further...
+ return false;
+ }
+
+ FileSpec resolved_lhs(*this);
+
+ // If "this" isn't resolved, resolve it
+ if (!IsResolved()) {
+ if (resolved_lhs.ResolvePath()) {
+ // This path wasn't resolved but now it is. Check if the resolved
+ // directory is the same as our unresolved directory, and if so,
+ // we can mark this object as resolved to avoid more future resolves
+ m_is_resolved = (m_directory == resolved_lhs.m_directory);
+ } else
+ return false;
+ }
+
+ FileSpec resolved_rhs(rhs);
+ if (!rhs.IsResolved()) {
+ if (resolved_rhs.ResolvePath()) {
+ // rhs's path wasn't resolved but now it is. Check if the resolved
+ // directory is the same as rhs's unresolved directory, and if so,
+ // we can mark this object as resolved to avoid more future resolves
+ rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory);
+ } else
+ return false;
+ }
+
+ // If we reach this point in the code we were able to resolve both paths
+ // and since we only resolve the paths if the basenames are equal, then
+ // we can just check if both directories are equal...
+ return DirectoryEquals(rhs);
+}
+
+//------------------------------------------------------------------
+// Not equal to operator
+//------------------------------------------------------------------
+bool FileSpec::operator!=(const FileSpec &rhs) const { return !(*this == rhs); }
+
+//------------------------------------------------------------------
+// Less than operator
+//------------------------------------------------------------------
+bool FileSpec::operator<(const FileSpec &rhs) const {
+ return FileSpec::Compare(*this, rhs, true) < 0;
+}
+
+//------------------------------------------------------------------
+// Dump a FileSpec object to a stream
+//------------------------------------------------------------------
+Stream &lldb_private::operator<<(Stream &s, const FileSpec &f) {
+ f.Dump(&s);
+ return s;
+}
+
+//------------------------------------------------------------------
+// Clear this object by releasing both the directory and filename
+// string values and making them both the empty string.
+//------------------------------------------------------------------
+void FileSpec::Clear() {
+ m_directory.Clear();
+ m_filename.Clear();
+}
+
+//------------------------------------------------------------------
+// Compare two FileSpec objects. If "full" is true, then both
+// the directory and the filename must match. If "full" is false,
+// then the directory names for "a" and "b" are only compared if
+// they are both non-empty. This allows a FileSpec object to only
+// contain a filename and it can match FileSpec objects that have
+// matching filenames with different paths.
+//
+// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b"
+// and "1" if "a" is greater than "b".
+//------------------------------------------------------------------
+int FileSpec::Compare(const FileSpec &a, const FileSpec &b, bool full) {
+ int result = 0;
+
+ // case sensitivity of compare
+ const bool case_sensitive = a.IsCaseSensitive() || b.IsCaseSensitive();
+
+ // If full is true, then we must compare both the directory and filename.
+
+ // If full is false, then if either directory is empty, then we match on
+ // the basename only, and if both directories have valid values, we still
+ // do a full compare. This allows for matching when we just have a filename
+ // in one of the FileSpec objects.
+
+ if (full || (a.m_directory && b.m_directory)) {
+ result = ConstString::Compare(a.m_directory, b.m_directory, case_sensitive);
+ if (result)
+ return result;
+ }
+ return ConstString::Compare(a.m_filename, b.m_filename, case_sensitive);
+}
+
+bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full,
+ bool remove_backups) {
+ // case sensitivity of equality test
+ const bool case_sensitive = a.IsCaseSensitive() || b.IsCaseSensitive();
+
+ if (!full && (a.GetDirectory().IsEmpty() || b.GetDirectory().IsEmpty()))
+ return ConstString::Equals(a.m_filename, b.m_filename, case_sensitive);
+
+ if (remove_backups == false)
+ return a == b;
+
+ if (a == b)
+ return true;
+
+ return Equal(a.GetNormalizedPath(), b.GetNormalizedPath(), full, false);
+}
+
+FileSpec FileSpec::GetNormalizedPath() const {
+ // Fast path. Do nothing if the path is not interesting.
+ if (!m_directory.GetStringRef().contains(".") &&
+ !m_directory.GetStringRef().contains("//") &&
+ m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != ".")
+ return *this;
+
+ llvm::SmallString<64> path, result;
+ const bool normalize = false;
+ GetPath(path, normalize);
+ llvm::StringRef rest(path);
+
+ // We will not go below root dir.
+ size_t root_dir_start = RootDirStart(path, m_syntax);
+ const bool absolute = root_dir_start != llvm::StringRef::npos;
+ if (absolute) {
+ result += rest.take_front(root_dir_start + 1);
+ rest = rest.drop_front(root_dir_start + 1);
+ } else {
+ if (m_syntax == ePathSyntaxWindows && path.size() > 2 && path[1] == ':') {
+ result += rest.take_front(2);
+ rest = rest.drop_front(2);
+ }
+ }
+
+ bool anything_added = false;
+ llvm::SmallVector<llvm::StringRef, 0> components, processed;
+ rest.split(components, '/', -1, false);
+ processed.reserve(components.size());
+ for (auto component : components) {
+ if (component == ".")
+ continue; // Skip these.
+ if (component != "..") {
+ processed.push_back(component);
+ continue; // Regular file name.
+ }
+ if (!processed.empty()) {
+ processed.pop_back();
+ continue; // Dots. Go one level up if we can.
+ }
+ if (absolute)
+ continue; // We're at the top level. Cannot go higher than that. Skip.
+
+ result += component; // We're a relative path. We need to keep these.
+ result += '/';
+ anything_added = true;
+ }
+ for (auto component : processed) {
+ result += component;
+ result += '/';
+ anything_added = true;
+ }
+ if (anything_added)
+ result.pop_back(); // Pop last '/'.
+ else if (result.empty())
+ result = ".";
+
+ return FileSpec(result, false, m_syntax);
+}
+
+//------------------------------------------------------------------
+// Dump the object to the supplied stream. If the object contains
+// a valid directory name, it will be displayed followed by a
+// directory delimiter, and the filename.
+//------------------------------------------------------------------
+void FileSpec::Dump(Stream *s) const {
+ if (s) {
+ std::string path{GetPath(true)};
+ s->PutCString(path);
+ char path_separator = GetPreferredPathSeparator(m_syntax);
+ if (!m_filename && !path.empty() && path.back() != path_separator)
+ s->PutChar(path_separator);
+ }
+}
+
+//------------------------------------------------------------------
+// Returns true if the file exists.
+//------------------------------------------------------------------
+bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); }
+
+bool FileSpec::Readable() const {
+ return GetPermissions() & llvm::sys::fs::perms::all_read;
+}
+
+bool FileSpec::ResolveExecutableLocation() {
+ // CLEANUP: Use StringRef for string handling.
+ if (!m_directory) {
+ const char *file_cstr = m_filename.GetCString();
+ if (file_cstr) {
+ const std::string file_str(file_cstr);
+ llvm::ErrorOr<std::string> error_or_path =
+ llvm::sys::findProgramByName(file_str);
+ if (!error_or_path)
+ return false;
+ std::string path = error_or_path.get();
+ llvm::StringRef dir_ref = llvm::sys::path::parent_path(path);
+ if (!dir_ref.empty()) {
+ // FindProgramByName returns "." if it can't find the file.
+ if (strcmp(".", dir_ref.data()) == 0)
+ return false;
+
+ m_directory.SetCString(dir_ref.data());
+ if (Exists())
+ return true;
+ else {
+ // If FindProgramByName found the file, it returns the directory +
+ // filename in its return results.
+ // We need to separate them.
+ FileSpec tmp_file(dir_ref.data(), false);
+ if (tmp_file.Exists()) {
+ m_directory = tmp_file.m_directory;
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool FileSpec::ResolvePath() {
+ if (m_is_resolved)
+ return true; // We have already resolved this path
+
+ // SetFile(...) will set m_is_resolved correctly if it can resolve the path
+ SetFile(GetPath(false), true);
+ return m_is_resolved;
+}
+
+uint64_t FileSpec::GetByteSize() const {
+ uint64_t Size = 0;
+ if (llvm::sys::fs::file_size(GetPath(), Size))
+ return 0;
+ return Size;
+}
+
+FileSpec::PathSyntax FileSpec::GetPathSyntax() const { return m_syntax; }
+
+uint32_t FileSpec::GetPermissions() const {
+ namespace fs = llvm::sys::fs;
+ fs::file_status st;
+ if (fs::status(GetPath(), st, false))
+ return fs::perms::perms_not_known;
+
+ return st.permissions();
+}
+
+//------------------------------------------------------------------
+// Directory string get accessor.
+//------------------------------------------------------------------
+ConstString &FileSpec::GetDirectory() { return m_directory; }
+
+//------------------------------------------------------------------
+// Directory string const get accessor.
+//------------------------------------------------------------------
+const ConstString &FileSpec::GetDirectory() const { return m_directory; }
+
+//------------------------------------------------------------------
+// Filename string get accessor.
+//------------------------------------------------------------------
+ConstString &FileSpec::GetFilename() { return m_filename; }
+
+//------------------------------------------------------------------
+// Filename string const get accessor.
+//------------------------------------------------------------------
+const ConstString &FileSpec::GetFilename() const { return m_filename; }
+
+//------------------------------------------------------------------
+// Extract the directory and path into a fixed buffer. This is
+// needed as the directory and path are stored in separate string
+// values.
+//------------------------------------------------------------------
+size_t FileSpec::GetPath(char *path, size_t path_max_len,
+ bool denormalize) const {
+ if (!path)
+ return 0;
+
+ std::string result = GetPath(denormalize);
+ ::snprintf(path, path_max_len, "%s", result.c_str());
+ return std::min(path_max_len - 1, result.length());
+}
+
+std::string FileSpec::GetPath(bool denormalize) const {
+ llvm::SmallString<64> result;
+ GetPath(result, denormalize);
+ return std::string(result.begin(), result.end());
+}
+
+const char *FileSpec::GetCString(bool denormalize) const {
+ return ConstString{GetPath(denormalize)}.AsCString(NULL);
+}
+
+void FileSpec::GetPath(llvm::SmallVectorImpl<char> &path,
+ bool denormalize) const {
+ path.append(m_directory.GetStringRef().begin(),
+ m_directory.GetStringRef().end());
+ if (m_directory && m_filename &&
+ !IsPathSeparator(m_directory.GetStringRef().back(), m_syntax))
+ path.insert(path.end(), GetPreferredPathSeparator(m_syntax));
+ path.append(m_filename.GetStringRef().begin(),
+ m_filename.GetStringRef().end());
+ Normalize(path, m_syntax);
+ if (denormalize && !path.empty())
+ Denormalize(path, m_syntax);
+}
+
+ConstString FileSpec::GetFileNameExtension() const {
+ if (m_filename) {
+ const char *filename = m_filename.GetCString();
+ const char *dot_pos = strrchr(filename, '.');
+ if (dot_pos && dot_pos[1] != '\0')
+ return ConstString(dot_pos + 1);
+ }
+ return ConstString();
+}
+
+ConstString FileSpec::GetFileNameStrippingExtension() const {
+ const char *filename = m_filename.GetCString();
+ if (filename == NULL)
+ return ConstString();
+
+ const char *dot_pos = strrchr(filename, '.');
+ if (dot_pos == NULL)
+ return m_filename;
+
+ return ConstString(filename, dot_pos - filename);
+}
+
+//------------------------------------------------------------------
+// Return the size in bytes that this object takes in memory. This
+// returns the size in bytes of this object, not any shared string
+// values it may refer to.
+//------------------------------------------------------------------
+size_t FileSpec::MemorySize() const {
+ return m_filename.MemorySize() + m_directory.MemorySize();
+}
+
+void FileSpec::EnumerateDirectory(llvm::StringRef dir_path,
+ bool find_directories, bool find_files,
+ bool find_other,
+ EnumerateDirectoryCallbackType callback,
+ void *callback_baton) {
+ namespace fs = llvm::sys::fs;
+ std::error_code EC;
+ fs::recursive_directory_iterator Iter(dir_path, EC);
+ fs::recursive_directory_iterator End;
+ for (; Iter != End && !EC; Iter.increment(EC)) {
+ const auto &Item = *Iter;
+ fs::file_status Status;
+ if ((EC = Item.status(Status)))
+ break;
+ if (!find_files && fs::is_regular_file(Status))
+ continue;
+ if (!find_directories && fs::is_directory(Status))
+ continue;
+ if (!find_other && fs::is_other(Status))
+ continue;
+
+ FileSpec Spec(Item.path(), false);
+ auto Result = callback(callback_baton, Status.type(), Spec);
+ if (Result == eEnumerateDirectoryResultQuit)
+ return;
+ if (Result == eEnumerateDirectoryResultNext) {
+ // Default behavior is to recurse. Opt out if the callback doesn't want
+ // this behavior.
+ Iter.no_push();
+ }
+ }
+}
+
+FileSpec
+FileSpec::CopyByAppendingPathComponent(llvm::StringRef component) const {
+ FileSpec ret = *this;
+ ret.AppendPathComponent(component);
+ return ret;
+}
+
+FileSpec FileSpec::CopyByRemovingLastPathComponent() const {
+ // CLEANUP: Use StringRef for string handling.
+ const bool resolve = false;
+ if (m_filename.IsEmpty() && m_directory.IsEmpty())
+ return FileSpec("", resolve);
+ if (m_directory.IsEmpty())
+ return FileSpec("", resolve);
+ if (m_filename.IsEmpty()) {
+ const char *dir_cstr = m_directory.GetCString();
+ const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
+
+ // check for obvious cases before doing the full thing
+ if (!last_slash_ptr)
+ return FileSpec("", resolve);
+ if (last_slash_ptr == dir_cstr)
+ return FileSpec("/", resolve);
+
+ size_t last_slash_pos = last_slash_ptr - dir_cstr + 1;
+ ConstString new_path(dir_cstr, last_slash_pos);
+ return FileSpec(new_path.GetCString(), resolve);
+ } else
+ return FileSpec(m_directory.GetCString(), resolve);
+}
+
+ConstString FileSpec::GetLastPathComponent() const {
+ // CLEANUP: Use StringRef for string handling.
+ if (m_filename)
+ return m_filename;
+ if (m_directory) {
+ const char *dir_cstr = m_directory.GetCString();
+ const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
+ if (last_slash_ptr == NULL)
+ return m_directory;
+ if (last_slash_ptr == dir_cstr) {
+ if (last_slash_ptr[1] == 0)
+ return ConstString(last_slash_ptr);
+ else
+ return ConstString(last_slash_ptr + 1);
+ }
+ if (last_slash_ptr[1] != 0)
+ return ConstString(last_slash_ptr + 1);
+ const char *penultimate_slash_ptr = last_slash_ptr;
+ while (*penultimate_slash_ptr) {
+ --penultimate_slash_ptr;
+ if (penultimate_slash_ptr == dir_cstr)
+ break;
+ if (*penultimate_slash_ptr == '/')
+ break;
+ }
+ ConstString result(penultimate_slash_ptr + 1,
+ last_slash_ptr - penultimate_slash_ptr);
+ return result;
+ }
+ return ConstString();
+}
+
+static std::string
+join_path_components(FileSpec::PathSyntax syntax,
+ const std::vector<llvm::StringRef> components) {
+ std::string result;
+ for (size_t i = 0; i < components.size(); ++i) {
+ if (components[i].empty())
+ continue;
+ result += components[i];
+ if (i != components.size() - 1 &&
+ !IsPathSeparator(components[i].back(), syntax))
+ result += GetPreferredPathSeparator(syntax);
+ }
+
+ return result;
+}
+
+void FileSpec::PrependPathComponent(llvm::StringRef component) {
+ if (component.empty())
+ return;
+
+ const bool resolve = false;
+ if (m_filename.IsEmpty() && m_directory.IsEmpty()) {
+ SetFile(component, resolve);
+ return;
+ }
+
+ std::string result =
+ join_path_components(m_syntax, {component, m_directory.GetStringRef(),
+ m_filename.GetStringRef()});
+ SetFile(result, resolve, m_syntax);
+}
+
+void FileSpec::PrependPathComponent(const FileSpec &new_path) {
+ return PrependPathComponent(new_path.GetPath(false));
+}
+
+void FileSpec::AppendPathComponent(llvm::StringRef component) {
+ if (component.empty())
+ return;
+
+ component = component.drop_while(
+ [this](char c) { return IsPathSeparator(c, m_syntax); });
+
+ std::string result =
+ join_path_components(m_syntax, {m_directory.GetStringRef(),
+ m_filename.GetStringRef(), component});
+
+ SetFile(result, false, m_syntax);
+}
+
+void FileSpec::AppendPathComponent(const FileSpec &new_path) {
+ return AppendPathComponent(new_path.GetPath(false));
+}
+
+void FileSpec::RemoveLastPathComponent() {
+ // CLEANUP: Use StringRef for string handling.
+
+ const bool resolve = false;
+ if (m_filename.IsEmpty() && m_directory.IsEmpty()) {
+ SetFile("", resolve);
+ return;
+ }
+ if (m_directory.IsEmpty()) {
+ SetFile("", resolve);
+ return;
+ }
+ if (m_filename.IsEmpty()) {
+ const char *dir_cstr = m_directory.GetCString();
+ const char *last_slash_ptr = ::strrchr(dir_cstr, '/');
+
+ // check for obvious cases before doing the full thing
+ if (!last_slash_ptr) {
+ SetFile("", resolve);
+ return;
+ }
+ if (last_slash_ptr == dir_cstr) {
+ SetFile("/", resolve);
+ return;
+ }
+ size_t last_slash_pos = last_slash_ptr - dir_cstr + 1;
+ ConstString new_path(dir_cstr, last_slash_pos);
+ SetFile(new_path.GetCString(), resolve);
+ } else
+ SetFile(m_directory.GetCString(), resolve);
+}
+//------------------------------------------------------------------
+/// Returns true if the filespec represents an implementation source
+/// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
+/// extension).
+///
+/// @return
+/// \b true if the filespec represents an implementation source
+/// file, \b false otherwise.
+//------------------------------------------------------------------
+bool FileSpec::IsSourceImplementationFile() const {
+ ConstString extension(GetFileNameExtension());
+ if (!extension)
+ return false;
+
+ static RegularExpression g_source_file_regex(llvm::StringRef(
+ "^([cC]|[mM]|[mM][mM]|[cC][pP][pP]|[cC]\\+\\+|[cC][xX][xX]|[cC][cC]|["
+ "cC][pP]|[sS]|[aA][sS][mM]|[fF]|[fF]77|[fF]90|[fF]95|[fF]03|[fF][oO]["
+ "rR]|[fF][tT][nN]|[fF][pP][pP]|[aA][dD][aA]|[aA][dD][bB]|[aA][dD][sS])"
+ "$"));
+ return g_source_file_regex.Execute(extension.GetStringRef());
+}
+
+bool FileSpec::IsRelative() const {
+ const char *dir = m_directory.GetCString();
+ llvm::StringRef directory(dir ? dir : "");
+
+ if (directory.size() > 0) {
+ if (PathSyntaxIsPosix(m_syntax)) {
+ // If the path doesn't start with '/' or '~', return true
+ switch (directory[0]) {
+ case '/':
+ case '~':
+ return false;
+ default:
+ return true;
+ }
+ } else {
+ if (directory.size() >= 2 && directory[1] == ':')
+ return false;
+ if (directory[0] == '/')
+ return false;
+ return true;
+ }
+ } else if (m_filename) {
+ // No directory, just a basename, return true
+ return true;
+ }
+ return false;
+}
+
+bool FileSpec::IsAbsolute() const { return !FileSpec::IsRelative(); }
+
+void llvm::format_provider<FileSpec>::format(const FileSpec &F,
+ raw_ostream &Stream,
+ StringRef Style) {
+ assert(
+ (Style.empty() || Style.equals_lower("F") || Style.equals_lower("D")) &&
+ "Invalid FileSpec style!");
+
+ StringRef dir = F.GetDirectory().GetStringRef();
+ StringRef file = F.GetFilename().GetStringRef();
+
+ if (dir.empty() && file.empty()) {
+ Stream << "(empty)";
+ return;
+ }
+
+ if (Style.equals_lower("F")) {
+ Stream << (file.empty() ? "(empty)" : file);
+ return;
+ }
+
+ // Style is either D or empty, either way we need to print the directory.
+ if (!dir.empty()) {
+ // Directory is stored in normalized form, which might be different
+ // than preferred form. In order to handle this, we need to cut off
+ // the filename, then denormalize, then write the entire denorm'ed
+ // directory.
+ llvm::SmallString<64> denormalized_dir = dir;
+ Denormalize(denormalized_dir, F.GetPathSyntax());
+ Stream << denormalized_dir;
+ Stream << GetPreferredPathSeparator(F.GetPathSyntax());
+ }
+
+ if (Style.equals_lower("D")) {
+ // We only want to print the directory, so now just exit.
+ if (dir.empty())
+ Stream << "(empty)";
+ return;
+ }
+
+ if (!file.empty())
+ Stream << file;
+}
Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Wed Mar 22 13:40:07 2017
@@ -31,11 +31,11 @@
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostGetOpt.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/FileSpec.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/unittests/Host/FileSpecTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSpecTest.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/unittests/Host/FileSpecTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSpecTest.cpp Wed Mar 22 13:40:07 2017
@@ -9,7 +9,7 @@
#include "gtest/gtest.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Utility/FileSpec.h"
using namespace lldb_private;
Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Wed Mar 22 13:40:07 2017
@@ -19,10 +19,10 @@
#include "gtest/gtest.h"
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
Modified: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Wed Mar 22 13:40:07 2017
@@ -19,12 +19,12 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/FileSpec.h"
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=298536&r1=298535&r2=298536&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Wed Mar 22 13:40:07 2017
@@ -19,12 +19,12 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/FileSpec.h"
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
More information about the lldb-commits
mailing list