/// platform independent and eliminates many of the unix-specific fields.
/// However, to support llvm-ar, the mode, user, and group fields are
/// retained. These pertain to unix security and may not have a meaningful
- /// value on non-Unix platforms. However, the other fields fields should
+ /// value on non-Unix platforms. However, the other fields should
/// always be applicable on all platforms. The structure is filled in by
/// the PathWithStatus class.
/// @brief File status structure
/// GetMainExecutable - Return the path to the main executable, given the
/// value of argv[0] from program startup and the address of main itself.
+ /// In extremis, this function may fail and return an empty path.
static Path GetMainExecutable(const char *argv0, void *MainAddr);
/// This is one of the very few ways in which a path can be constructed
}
/// Makes a copy of \p that to \p this.
- /// @param \p that A StringRef denoting the path
+ /// @param that A StringRef denoting the path
/// @returns \p this
/// @brief Assignment Operator
Path &operator=(StringRef that);
/// @name Disk Accessors
/// @{
public:
- /// This function determines if the path name in this object references
- /// the root (top level directory) of the file system. The details of what
- /// is considered the "root" may vary from system to system so this method
- /// will do the necessary checking.
- /// @returns true iff the path name references the root directory.
- /// @brief Determines if the path references the root directory.
- bool isRootDirectory() const;
-
/// This function determines if the path name is absolute, as opposed to
/// relative.
/// @brief Determine if the path is absolute.
/// native Dynamic Library (shared library, shared object) by looking at
/// the file's magic number. The Path object must reference a file, not a
/// directory.
- /// @return strue if the file starts with the magid number for a native
+ /// @returns true if the file starts with the magic number for a native
/// shared library.
- /// @brief Determine if the path reference a dynamic library.
+ /// @brief Determine if the path references a dynamic library.
bool isDynamicLibrary() const;
+ /// This function determines if the path name in the object references a
+ /// native object file by looking at it's magic number. The term object
+ /// file is defined as "an organized collection of separate, named
+ /// sequences of binary data." This covers the obvious file formats such
+ /// as COFF and ELF, but it also includes llvm ir bitcode, archives,
+ /// libraries, etc...
+ /// @returns true if the file starts with the magic number for an object
+ /// file.
+ /// @brief Determine if the path references an object file.
+ bool isObjectFile() const;
+
/// This function determines if the path name references an existing file
/// or directory in the file system.
/// @returns true if the pathname references an existing file or
/// in the file system.
bool canWrite() const;
- /// This function checks that what we're trying to work only on a regular file.
- /// Check for things like /dev/null, any block special file,
- /// or other things that aren't "regular" regular files.
+ /// This function checks that what we're trying to work only on a regular
+ /// file. Check for things like /dev/null, any block special file, or
+ /// other things that aren't "regular" regular files.
/// @returns true if the file is S_ISREG.
/// @brief Determines if the file is a regular file
bool isRegularFile() const;