Go to the documentation of this file.
9 #ifndef LLDB_UTILITY_FILESPEC_H
10 #define LLDB_UTILITY_FILESPEC_H
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/FileSystem.h"
19 #include "llvm/Support/FormatVariadic.h"
20 #include "llvm/Support/Path.h"
21 #include "llvm/Support/YAMLTraits.h"
36 template <
typename T>
class SmallVectorImpl;
58 using Style = llvm::sys::path::Style;
75 explicit FileSpec(llvm::StringRef path,
Style style = Style::native);
77 explicit FileSpec(llvm::StringRef path,
const llvm::Triple &triple);
136 explicit operator bool()
const;
198 static llvm::Optional<Style>
GuessPathStyle(llvm::StringRef absolute_path);
215 void Dump(llvm::raw_ostream &s)
const;
290 size_t GetPath(
char *path,
size_t max_path_length,
291 bool denormalize =
true)
const;
302 const char *
GetCString(
bool denormalize =
true)
const;
308 bool denormalize =
true)
const;
363 void SetFile(llvm::StringRef path,
const llvm::Triple &triple);
402 void SetFile(llvm::StringRef path);
444 template <>
struct ScalarEnumerationTraits<
lldb_private::FileSpecStyle> {
445 static void enumeration(IO &io, lldb_private::FileSpecStyle &style);
454 #endif // LLDB_UTILITY_FILESPEC_H
ConstString GetLastPathComponent() const
ConstString m_filename
The uniqued filename path.
bool operator!() const
Logical NOT operator.
size_t MemorySize() const
Get the memory cost of this object.
Style GetPathStyle() const
void MakeAbsolute(const FileSpec &dir)
Make the FileSpec absolute by treating it relative to dir.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
FileSpec CopyByRemovingLastPathComponent() const
void PrependPathComponent(llvm::StringRef component)
bool operator!=(const FileSpec &rhs) const
Not equal to operator.
const char * GetCString(bool denormalize=true) const
static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full)
Compare two FileSpec objects.
bool operator<(const FileSpec &rhs) const
Less than to operator.
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
void SetIsResolved(bool is_resolved)
Set if the file path has been resolved or not.
ConstString m_directory
The uniqued directory path.
bool DirectoryEquals(const FileSpec &other) const
bool IsSourceImplementationFile() const
Returns true if the filespec represents an implementation source file (files with a "....
string(SUBSTRING ${p} 10 -1 pStripped) if($
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const
static llvm::Optional< Style > GuessPathStyle(llvm::StringRef absolute_path)
Attempt to guess path style for a given path string.
bool IsAbsolute() const
Returns true if the filespec represents an absolute path.
void Clear()
Clears the object state.
llvm::sys::path::Style Style
bool FileEquals(const FileSpec &other) const
bool IsRelative() const
Returns true if the filespec represents a relative path.
Stream & operator<<(Stream &s, const SourceLocationSpec &loc)
Dump a SourceLocationSpec object to a stream.
bool RemoveLastPathComponent()
Removes the last path component by replacing the current path with its parent.
void Dump(llvm::raw_ostream &s) const
Dump this object to a Stream.
bool IsCaseSensitive() const
Case sensitivity of path.
bool m_is_resolved
True if this path has been resolved.
void AppendPathComponent(llvm::StringRef component)
A class that represents a running process on the host machine.
ConstString & GetDirectory()
Directory string get accessor.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
ConstString GetFileNameExtension() const
Extract the extension of the file.
ConstString & GetFilename()
Filename string get accessor.
static bool Equal(const FileSpec &a, const FileSpec &b, bool full)
bool operator==(const FileSpec &rhs) const
Equal to operator.
Style m_style
The syntax that this path uses (e.g. Windows / Posix)
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.