1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Stop propagating method names that violate the coding standard

llvm-svn: 17498
This commit is contained in:
Reid Spencer 2004-11-05 22:15:36 +00:00
parent a23368c9ec
commit 7090e6a875
21 changed files with 252 additions and 241 deletions

View File

@ -34,8 +34,8 @@ namespace sys {
/// one invalid Path which is the empty path. The class should never allow any
/// other syntactically invalid non-empty path name to be assigned. Empty
/// paths are required in order to indicate an error result. If the path is
/// empty, the is_valid operation will return false. All operations will fail
/// if is_valid is false. Operations that change the path will either return
/// empty, the isValid operation will return false. All operations will fail
/// if isValid is false. Operations that change the path will either return
/// false if it would cause a syntactically invalid path name (in which case
/// the Path object is left unchanged) or throw an std::string exception
/// indicating the error.
@ -138,7 +138,7 @@ namespace sys {
/// the program. However, if the path is not valid, the Path object will
/// be set to an empty string and an exception will be thrown.
/// @throws std::string if the path string is not legal.
/// @param unvalidated_path The path to verify and assign.
/// @param unverified_path The path to verify and assign.
/// @brief Construct a Path from a string.
explicit Path(std::string unverified_path);
@ -193,13 +193,13 @@ namespace sys {
/// @returns true iff the path name is syntactically legal for the
/// host operating system.
/// @brief Determine if a path is syntactically valid or not.
bool is_valid() const;
bool isValid() const;
/// This function determines if the contents of the path name are
/// empty. That is, the path has a zero length.
/// @returns true iff the path is empty.
/// @brief Determines if the path name is empty (invalid).
bool is_empty() const { return path.empty(); }
bool isEmpty() const { return path.empty(); }
/// This function determines if the path name in this object is intended
/// to reference a legal file name (as opposed to a directory name). This
@ -207,7 +207,7 @@ namespace sys {
/// determines if the syntax of the path represents a file name or not.
/// @returns true if this path name references a file.
/// @brief Determines if the path name references a file.
bool is_file() const;
bool isFile() const;
/// This function determines if the path name in this object is intended
/// to reference a legal directory name (as opposed to a file name). This
@ -216,7 +216,7 @@ namespace sys {
/// not.
/// @returns true if the path name references a directory
/// @brief Determines if the path name references a directory.
bool is_directory() const;
bool isDirectory() const;
/// This function determines if the path name in this object references
/// the root (top level directory) of the file system. The details of what
@ -224,7 +224,7 @@ namespace sys {
/// 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 is_root_directory() const;
bool isRootDirectory() const;
/// This function opens the file associated with the path name provided by
/// the Path object and reads its magic number. If the magic number at the
@ -232,24 +232,24 @@ namespace sys {
/// cases (file not found, file not accessible, etc.) it returns false.
/// @returns true if the magic number of the file matches \p magic.
/// @brief Determine if file has a specific magic number
bool has_magic_number(const std::string& magic) const;
bool hasMagicNumber(const std::string& magic) const;
/// This function determines if the path name in the object references an
/// archive file by looking at its magic number.
/// @returns true if the file starts with the magic number for an archive
/// file.
/// @brief Determine if the path references an archive file.
bool is_archive() const;
bool isArchive() const;
/// This function determines if the path name in the object references an
/// LLVM Bytecode file by looking at its magic number.
/// @returns true if the file starts with the magic number for LLVM
/// bytecode files.
/// @brief Determine if the path references a bytecode file.
bool is_bytecode_file() const;
bool isBytecodeFile() const;
/// This function determines if the path name references an existing file
/// or directory in the file system. Unlike is_file and is_directory, this
/// or directory in the file system. Unlike isFile and isDirectory, this
/// function actually checks for the existence of the file or directory.
/// @returns true if the pathname references an existing file.
/// @brief Determines if the path is a file or directory in
@ -257,7 +257,7 @@ namespace sys {
bool exists() const;
/// This function determines if the path name references a readable file
/// or directory in the file system. Unlike is_file and is_directory, this
/// or directory in the file system. Unlike isFile and isDirectory, this
/// function actually checks for the existence and readability (by the
/// current program) of the file or directory.
/// @returns true if the pathname references a readable file.
@ -266,7 +266,7 @@ namespace sys {
bool readable() const;
/// This function determines if the path name references a writable file
/// or directory in the file system. Unlike is_file and is_directory, this
/// or directory in the file system. Unlike isFile and isDirectory, this
/// function actually checks for the existence and writability (by the
/// current program) of the file or directory.
/// @returns true if the pathname references a writable file.
@ -275,7 +275,7 @@ namespace sys {
bool writable() const;
/// This function determines if the path name references an executable
/// file in the file system. Unlike is_file and is_directory, this
/// file in the file system. Unlike isFile and isDirectory, this
/// function actually checks for the existence and executability (by
/// the current program) of the file.
/// @returns true if the pathname references an executable file.
@ -291,8 +291,8 @@ namespace sys {
std::string get() const { return path; }
/// This function returns the last component of the path name. If the
/// is_directory() function would return true then this returns the name
/// of the last directory in the path. If the is_file() function would
/// isDirectory() function would return true then this returns the name
/// of the last directory in the path. If the isFile() function would
/// return true then this function returns the name of the file without
/// any of the preceding directories.
/// @returns std::string containing the last component of the path name.
@ -304,7 +304,7 @@ namespace sys {
/// @returns std::string containing the basename of the path
/// @throws nothing
/// @brief Get the base name of the path
std::string get_basename() const;
std::string getBasename() const;
/// @returns a c string containing the path name.
/// @brief Returns the path as a C string.
@ -329,7 +329,7 @@ namespace sys {
/// @param unverified_path The path to be set in Path object.
/// @throws nothing
/// @brief Set a full path from a std::string
bool set_directory(const std::string& unverified_path);
bool setDirectory(const std::string& unverified_path);
/// This method attempts to set the Path object to \p unverified_path
/// and interpret the name as a file name. The \p unverified_path
@ -340,54 +340,54 @@ namespace sys {
/// @param unverified_path The path to be set in Path object.
/// @throws nothing
/// @brief Set a full path from a std::string
bool set_file(const std::string& unverified_path);
bool setFile(const std::string& unverified_path);
/// The \p dirname is added to the end of the Path if it is a legal
/// directory name for the operating system. The precondition for this
/// function is that the Path must reference a directory name (i.e.
/// is_directory() returns true).
/// isDirectory() returns true).
/// @param dirname A string providing the directory name to
/// be added to the end of the path.
/// @returns false if the directory name could not be added
/// @throws nothing
/// @brief Adds the name of a directory to a Path.
bool append_directory( const std::string& dirname );
bool appendDirectory( const std::string& dirname );
/// One directory component is removed from the Path name. The Path must
/// refer to a non-root directory name (i.e. is_directory() returns true
/// but is_root_directory() returns false). Upon exit, the Path will
/// refer to a non-root directory name (i.e. isDirectory() returns true
/// but isRootDirectory() returns false). Upon exit, the Path will
/// refer to the directory above it.
/// @throws nothing
/// @returns false if the directory name could not be removed.
/// @brief Removes the last directory component of the Path.
bool elide_directory();
bool elideDirectory();
/// The \p filename is added to the end of the Path if it is a legal
/// directory name for the operating system. The precondition for this
/// function is that the Path reference a directory name (i.e.
/// is_directory() returns true).
/// isDirectory() returns true).
/// @throws nothing
/// @returns false if the file name could not be added.
/// @brief Appends the name of a file.
bool append_file( const std::string& filename );
bool appendFile( const std::string& filename );
/// One file component is removed from the Path name. The Path must
/// refer to a file (i.e. is_file() returns true). Upon exit,
/// refer to a file (i.e. isFile() returns true). Upon exit,
/// the Path will refer to the directory above it.
/// @throws nothing
/// @returns false if the file name could not be removed
/// @brief Removes the last file component of the path.
bool elide_file();
bool elideFile();
/// A period and the \p suffix are appended to the end of the pathname.
/// The precondition for this function is that the Path reference a file
/// name (i.e. is_file() returns true). If the Path is not a file, no
/// name (i.e. isFile() returns true). If the Path is not a file, no
/// action is taken and the function returns false. If the path would
/// become invalid for the host operating system, false is returned.
/// @returns false if the suffix could not be added, true if it was.
/// @throws nothing
/// @brief Adds a period and the \p suffix to the end of the pathname.
bool append_suffix(const std::string& suffix);
bool appendSuffix(const std::string& suffix);
/// The suffix of the filename is removed. The suffix begins with and
/// includes the last . character in the filename after the last directory
@ -398,7 +398,7 @@ namespace sys {
/// @returns false if there was no suffix to remove, true otherwise.
/// @throws nothing
/// @brief Remove the suffix from a path name.
bool elide_suffix();
bool elideSuffix();
/// This method attempts to create a directory in the file system with the
/// same name as the Path object. The \p create_parents parameter controls
@ -413,17 +413,17 @@ namespace sys {
/// components other than the last one (the "parents") are created or not.
/// @throws std::string if an error occurs.
/// @brief Create the directory this Path refers to.
bool create_directory( bool create_parents = false );
bool createDirectory( bool create_parents = false );
/// This method attempts to create a file in the file system with the same
/// name as the Path object. The intermediate directories must all exist
/// at the time this method is called. Use create_directories to
/// at the time this method is called. Use createDirectories to
/// accomplish that. The created file will be empty upon return from this
/// function.
/// @returns false if the Path does not reference a file, true otherwise.
/// @throws std::string if an error occurs.
/// @brief Create the file this Path refers to.
bool create_file();
bool createFile();
/// This method attempts to destroy the directory named by the last in
/// the Path name. If \p remove_contents is false, an attempt will be
@ -437,14 +437,14 @@ namespace sys {
/// otherwise.
/// @throws std::string if there is an error.
/// @brief Removes the file or directory from the filesystem.
bool destroy_directory( bool destroy_contents = false );
bool destroyDirectory( bool destroy_contents = false );
/// This method attempts to destroy the file named by the last item in the
/// Path name.
/// @returns false if the Path does not refer to a file, true otherwise.
/// @throws std::string if there is an error.
/// @brief Destroy the file this Path refers to.
bool destroy_file();
bool destroyFile();
/// @}
/// @name Data

View File

@ -24,7 +24,7 @@ using namespace sys;
//===----------------------------------------------------------------------===//
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
if (path.length() >= MAXPATHLEN)
@ -43,8 +43,8 @@ Path::GetTemporaryDirectory() {
if (!mkdir(TmpName, S_IRWXU))
ThrowErrno(std::string(TmpName) + ": Can't create temporary directory");
Path result;
result.set_directory(TmpName);
assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
result.setDirectory(TmpName);
assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
return result;
}

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
char pathname[MAXPATHLEN];
@ -39,9 +39,9 @@ Path::GetTemporaryDirectory() {
if (0 == pathname)
ThrowErrno(std::string("Can't create temporary directory name"));
Path result;
result.set_directory(pathname);
result.setDirectory(pathname);
free(pathname);
assert(result.is_valid() && "tempnam didn't create a valid pathname!");
assert(result.isValid() && "tempnam didn't create a valid pathname!");
if (0 != mkdir(result.c_str(), S_IRWXU))
ThrowErrno(result.get() + ": Can't create temporary directory");
return result;

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
if (path.length() >= MAXPATHLEN)
@ -38,8 +38,8 @@ Path::GetTemporaryDirectory() {
if (0 == mkdtemp(pathname))
ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
Path result;
result.set_directory(pathname);
assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
result.setDirectory(pathname);
assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
return result;
}

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isvalid() const {
if (path.empty())
return false;
char pathname[MAXPATHLEN];
@ -40,8 +40,8 @@ Path::GetTemporaryDirectory() {
if (0 == mkdtemp(pathname))
ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
Path result;
result.set_directory(pathname);
assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
result.setDirectory(pathname);
assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
return result;
}

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
char pathname[MAXPATHLEN];
@ -40,8 +40,8 @@ Path::GetTemporaryDirectory() {
if (0 == mkdtemp(pathname))
ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
Path result;
result.set_directory(pathname);
assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
result.setDirectory(pathname);
assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
return result;
}

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
char pathname[MAXPATHLEN];
@ -40,8 +40,8 @@ Path::GetTemporaryDirectory() {
if (0 == mkdtemp(pathname))
ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
Path result;
result.set_directory(pathname);
assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
result.setDirectory(pathname);
assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
return result;
}

View File

@ -23,7 +23,7 @@ namespace llvm {
using namespace sys;
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
char pathname[MAXPATHLEN];
@ -39,9 +39,9 @@ Path::GetTemporaryDirectory() {
if (0 == pathname)
ThrowErrno(std::string("Can't create temporary directory name"));
Path result;
result.set_directory(pathname);
result.setDirectory(pathname);
free(pathname);
assert(result.is_valid() && "tempnam didn't create a valid pathname!");
assert(result.isValid() && "tempnam didn't create a valid pathname!");
if (0 != mkdir(result.c_str(), S_IRWXU))
ThrowErrno(result.get() + ": Can't create temporary directory");
return result;

View File

@ -30,7 +30,7 @@ Path::Path(std::string unverified_path)
{
if (unverified_path.empty())
return;
if (this->is_valid())
if (this->isValid())
return;
// oops, not valid.
path.clear();
@ -40,28 +40,28 @@ Path::Path(std::string unverified_path)
Path
Path::GetRootDirectory() {
Path result;
result.set_directory("/");
result.setDirectory("/");
return result;
}
static inline bool IsLibrary(Path& path, const std::string& basename) {
if (path.append_file(std::string("lib") + basename)) {
if (path.append_suffix(Path::GetDLLSuffix()) && path.readable())
if (path.appendFile(std::string("lib") + basename)) {
if (path.appendSuffix(Path::GetDLLSuffix()) && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("a") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("a") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("o") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("o") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("bc") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("bc") && path.readable())
return true;
} else if (path.elide_file() && path.append_file(basename)) {
if (path.append_suffix(Path::GetDLLSuffix()) && path.readable())
} else if (path.elideFile() && path.appendFile(basename)) {
if (path.appendSuffix(Path::GetDLLSuffix()) && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("a") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("a") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("o") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("o") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("bc") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("bc") && path.readable())
return true;
}
path.clear();
@ -76,20 +76,20 @@ Path::GetLibraryPath(const std::string& basename,
// Try the paths provided
for (std::vector<std::string>::const_iterator I = LibPaths.begin(),
E = LibPaths.end(); I != E; ++I ) {
if (result.set_directory(*I) && IsLibrary(result,basename))
if (result.setDirectory(*I) && IsLibrary(result,basename))
return result;
}
// Try the LLVM lib directory in the LLVM install area
if (result.set_directory(LLVM_LIBDIR) && IsLibrary(result,basename))
if (result.setDirectory(LLVM_LIBDIR) && IsLibrary(result,basename))
return result;
// Try /usr/lib
if (result.set_directory("/usr/lib/") && IsLibrary(result,basename))
if (result.setDirectory("/usr/lib/") && IsLibrary(result,basename))
return result;
// Try /lib
if (result.set_directory("/lib/") && IsLibrary(result,basename))
if (result.setDirectory("/lib/") && IsLibrary(result,basename))
return result;
// Can't find it, give up and return invalid path.
@ -115,7 +115,7 @@ Path::GetLLVMDefaultConfigDir() {
Path
Path::GetLLVMConfigDir() {
Path result;
if (result.set_directory(LLVM_ETCDIR))
if (result.setDirectory(LLVM_ETCDIR))
return result;
return GetLLVMDefaultConfigDir();
}
@ -125,24 +125,24 @@ Path::GetUserHomeDirectory() {
const char* home = getenv("HOME");
if (home) {
Path result;
if (result.set_directory(home))
if (result.setDirectory(home))
return result;
}
return GetRootDirectory();
}
bool
Path::is_file() const {
return (is_valid() && path[path.length()-1] != '/');
Path::isFile() const {
return (isValid() && path[path.length()-1] != '/');
}
bool
Path::is_directory() const {
return (is_valid() && path[path.length()-1] == '/');
Path::isDirectory() const {
return (isValid() && path[path.length()-1] == '/');
}
std::string
Path::get_basename() const {
Path::getBasename() const {
// Find the last slash
size_t slash = path.rfind('/');
if (slash == std::string::npos)
@ -153,7 +153,7 @@ Path::get_basename() const {
return path.substr(slash, path.rfind('.'));
}
bool Path::has_magic_number(const std::string &Magic) const {
bool Path::hasMagicNumber(const std::string &Magic) const {
size_t len = Magic.size();
char buf[ 1 + len];
std::ifstream f(path.c_str());
@ -163,17 +163,17 @@ bool Path::has_magic_number(const std::string &Magic) const {
}
bool
Path::is_bytecode_file() const {
Path::isBytecodeFile() const {
if (readable()) {
return has_magic_number("llvm");
return hasMagicNumber("llvm");
}
return false;
}
bool
Path::is_archive() const {
Path::isArchive() const {
if (readable()) {
return has_magic_number("!<arch>\012");
return hasMagicNumber("!<arch>\012");
}
return false;
}
@ -221,7 +221,7 @@ Path::getLast() const {
}
bool
Path::set_directory(const std::string& a_path) {
Path::setDirectory(const std::string& a_path) {
if (a_path.size() == 0)
return false;
Path save(*this);
@ -229,7 +229,7 @@ Path::set_directory(const std::string& a_path) {
size_t last = a_path.size() -1;
if (last != 0 && a_path[last] != '/')
path += '/';
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -237,7 +237,7 @@ Path::set_directory(const std::string& a_path) {
}
bool
Path::set_file(const std::string& a_path) {
Path::setFile(const std::string& a_path) {
if (a_path.size() == 0)
return false;
Path save(*this);
@ -246,7 +246,7 @@ Path::set_file(const std::string& a_path) {
while (last > 0 && a_path[last] == '/')
last--;
path.erase(last+1);
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -254,13 +254,13 @@ Path::set_file(const std::string& a_path) {
}
bool
Path::append_directory(const std::string& dir) {
if (is_file())
Path::appendDirectory(const std::string& dir) {
if (isFile())
return false;
Path save(*this);
path += dir;
path += "/";
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -268,8 +268,8 @@ Path::append_directory(const std::string& dir) {
}
bool
Path::elide_directory() {
if (is_file())
Path::elideDirectory() {
if (isFile())
return false;
size_t slashpos = path.rfind('/',path.size());
if (slashpos == 0 || slashpos == std::string::npos)
@ -283,12 +283,12 @@ Path::elide_directory() {
}
bool
Path::append_file(const std::string& file) {
if (!is_directory())
Path::appendFile(const std::string& file) {
if (!isDirectory())
return false;
Path save(*this);
path += file;
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -296,8 +296,8 @@ Path::append_file(const std::string& file) {
}
bool
Path::elide_file() {
if (is_directory())
Path::elideFile() {
if (isDirectory())
return false;
size_t slashpos = path.rfind('/',path.size());
if (slashpos == std::string::npos)
@ -307,13 +307,13 @@ Path::elide_file() {
}
bool
Path::append_suffix(const std::string& suffix) {
if (is_directory())
Path::appendSuffix(const std::string& suffix) {
if (isDirectory())
return false;
Path save(*this);
path.append(".");
path.append(suffix);
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -321,8 +321,8 @@ Path::append_suffix(const std::string& suffix) {
}
bool
Path::elide_suffix() {
if (is_directory()) return false;
Path::elideSuffix() {
if (isDirectory()) return false;
size_t dotpos = path.rfind('.',path.size());
size_t slashpos = path.rfind('/',path.size());
if (slashpos != std::string::npos && dotpos != std::string::npos &&
@ -335,9 +335,9 @@ Path::elide_suffix() {
bool
Path::create_directory( bool create_parents) {
Path::createDirectory( bool create_parents) {
// Make sure we're dealing with a directory
if (!is_directory()) return false;
if (!isDirectory()) return false;
// Get a writeable copy of the path name
char pathname[MAXPATHLEN];
@ -372,9 +372,9 @@ Path::create_directory( bool create_parents) {
}
bool
Path::create_file() {
Path::createFile() {
// Make sure we're dealing with a file
if (!is_file()) return false;
if (!isFile()) return false;
// Create the file
int fd = ::creat(path.c_str(), S_IRUSR | S_IWUSR);
@ -386,9 +386,9 @@ Path::create_file() {
}
bool
Path::destroy_directory(bool remove_contents) {
Path::destroyDirectory(bool remove_contents) {
// Make sure we're dealing with a directory
if (!is_directory()) return false;
if (!isDirectory()) return false;
// If it doesn't exist, we're done.
if (!exists()) return true;
@ -412,8 +412,8 @@ Path::destroy_directory(bool remove_contents) {
}
bool
Path::destroy_file() {
if (!is_file()) return false;
Path::destroyFile() {
if (!isFile()) return false;
if (0 != unlink(path.c_str()))
ThrowErrno(std::string(path.c_str()) + ": Can't destroy file");
return true;

View File

@ -37,7 +37,7 @@ Program::FindProgramByName(const std::string& progName) {
if (progName.length() == 0) // no program
return Path();
Path temp;
if (!temp.set_file(progName)) // invalid name
if (!temp.setFile(progName)) // invalid name
return Path();
if (temp.executable()) // already executable as is
return temp;
@ -57,8 +57,8 @@ Program::FindProgramByName(const std::string& progName) {
// Check to see if this first directory contains the executable...
Path FilePath;
if (FilePath.set_directory(std::string(PathStr,Colon))) {
FilePath.append_file(progName);
if (FilePath.setDirectory(std::string(PathStr,Colon))) {
FilePath.appendFile(progName);
if (FilePath.executable())
return FilePath; // Found the executable!
}

View File

@ -111,7 +111,7 @@ RETSIGTYPE SignalHandler(int Sig) {
if (DirectoriesToRemove != 0)
while (!DirectoriesToRemove->empty()) {
DirectoriesToRemove->back().destroy_directory(true);
DirectoriesToRemove->back().destroyDirectory(true);
DirectoriesToRemove->pop_back();
}
@ -146,7 +146,7 @@ void sys::RemoveFileOnSignal(const std::string &Filename) {
// RemoveDirectoryOnSignal - The public API
void sys::RemoveDirectoryOnSignal(const llvm::sys::Path& path) {
if (!path.is_directory())
if (!path.isDirectory())
return;
if (DirectoriesToRemove == 0)

View File

@ -34,7 +34,7 @@ namespace llvm {
namespace sys {
bool
Path::is_valid() const {
Path::isValid() const {
if (path.empty())
return false;
@ -81,19 +81,19 @@ Path::GetTemporaryDirectory() {
throw std::string("Can't determine temporary directory");
Path result;
result.set_directory(pathname);
result.setDirectory(pathname);
// Append a subdirectory passed on our process id so multiple LLVMs don't
// step on each other's toes.
sprintf(pathname, "LLVM_%u", GetCurrentProcessId());
result.append_directory(pathname);
result.appendDirectory(pathname);
// If there's a directory left over from a previous LLVM execution that
// happened to have the same process id, get rid of it.
result.destroy_directory(true);
result.destroyDirectory(true);
// And finally (re-)create the empty directory.
result.create_directory(false);
result.createDirectory(false);
TempDirectory = new Path(result);
return *TempDirectory;
}
@ -104,7 +104,7 @@ Path::Path(std::string unverified_path)
FlipBackSlashes(path);
if (unverified_path.empty())
return;
if (this->is_valid())
if (this->isValid())
return;
// oops, not valid.
path.clear();
@ -115,7 +115,7 @@ Path::Path(std::string unverified_path)
Path
Path::GetRootDirectory() {
Path result;
result.set_directory("/");
result.setDirectory("/");
return result;
}
@ -125,23 +125,23 @@ Path::GetDLLSuffix() {
}
static inline bool IsLibrary(Path& path, const std::string& basename) {
if (path.append_file(std::string("lib") + basename)) {
if (path.append_suffix(Path::GetDLLSuffix()) && path.readable())
if (path.appendFile(std::string("lib") + basename)) {
if (path.appendSuffix(Path::GetDLLSuffix()) && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("a") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("a") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("o") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("o") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("bc") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("bc") && path.readable())
return true;
} else if (path.elide_file() && path.append_file(basename)) {
if (path.append_suffix(Path::GetDLLSuffix()) && path.readable())
} else if (path.elideFile() && path.appendFile(basename)) {
if (path.appendSuffix(Path::GetDLLSuffix()) && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("a") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("a") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("o") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("o") && path.readable())
return true;
else if (path.elide_suffix() && path.append_suffix("bc") && path.readable())
else if (path.elideSuffix() && path.appendSuffix("bc") && path.readable())
return true;
}
path.clear();
@ -156,20 +156,20 @@ Path::GetLibraryPath(const std::string& basename,
// Try the paths provided
for (std::vector<std::string>::const_iterator I = LibPaths.begin(),
E = LibPaths.end(); I != E; ++I ) {
if (result.set_directory(*I) && IsLibrary(result,basename))
if (result.setDirectory(*I) && IsLibrary(result,basename))
return result;
}
// Try the LLVM lib directory in the LLVM install area
//if (result.set_directory(LLVM_LIBDIR) && IsLibrary(result,basename))
//if (result.setDirectory(LLVM_LIBDIR) && IsLibrary(result,basename))
// return result;
// Try /usr/lib
if (result.set_directory("/usr/lib/") && IsLibrary(result,basename))
if (result.setDirectory("/usr/lib/") && IsLibrary(result,basename))
return result;
// Try /lib
if (result.set_directory("/lib/") && IsLibrary(result,basename))
if (result.setDirectory("/lib/") && IsLibrary(result,basename))
return result;
// Can't find it, give up and return invalid path.
@ -202,7 +202,7 @@ Path::GetUserHomeDirectory() {
const char* home = getenv("HOME");
if (home) {
Path result;
if (result.set_directory(home))
if (result.setDirectory(home))
return result;
}
return GetRootDirectory();
@ -210,17 +210,17 @@ Path::GetUserHomeDirectory() {
// FIXME: the above set of functions don't map to Windows very well.
bool
Path::is_file() const {
return (is_valid() && path[path.length()-1] != '/');
Path::isFile() const {
return (isValid() && path[path.length()-1] != '/');
}
bool
Path::is_directory() const {
return (is_valid() && path[path.length()-1] == '/');
Path::isDirectory() const {
return (isValid() && path[path.length()-1] == '/');
}
std::string
Path::get_basename() const {
Path::getBasename() const {
// Find the last slash
size_t slash = path.rfind('/');
if (slash == std::string::npos)
@ -231,7 +231,7 @@ Path::get_basename() const {
return path.substr(slash, path.rfind('.'));
}
bool Path::has_magic_number(const std::string &Magic) const {
bool Path::hasMagicNumber(const std::string &Magic) const {
size_t len = Magic.size();
char *buf = reinterpret_cast<char *>(_alloca(len+1));
std::ifstream f(path.c_str());
@ -241,17 +241,17 @@ bool Path::has_magic_number(const std::string &Magic) const {
}
bool
Path::is_bytecode_file() const {
Path::isBytecodeFile() const {
if (readable()) {
return has_magic_number("llvm");
return hasMagicNumber("llvm");
}
return false;
}
bool
Path::is_archive() const {
Path::isArchive() const {
if (readable()) {
return has_magic_number("!<arch>\012");
return hasMagicNumber("!<arch>\012");
}
return false;
}
@ -306,7 +306,7 @@ Path::getLast() const {
}
bool
Path::set_directory(const std::string& a_path) {
Path::setDirectory(const std::string& a_path) {
if (a_path.size() == 0)
return false;
Path save(*this);
@ -315,7 +315,7 @@ Path::set_directory(const std::string& a_path) {
size_t last = a_path.size() -1;
if (last != 0 && a_path[last] != '/')
path += '/';
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -323,7 +323,7 @@ Path::set_directory(const std::string& a_path) {
}
bool
Path::set_file(const std::string& a_path) {
Path::setFile(const std::string& a_path) {
if (a_path.size() == 0)
return false;
Path save(*this);
@ -333,7 +333,7 @@ Path::set_file(const std::string& a_path) {
while (last > 0 && a_path[last] == '/')
last--;
path.erase(last+1);
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -341,13 +341,13 @@ Path::set_file(const std::string& a_path) {
}
bool
Path::append_directory(const std::string& dir) {
if (is_file())
Path::appendDirectory(const std::string& dir) {
if (isFile())
return false;
Path save(*this);
path += dir;
path += "/";
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -355,8 +355,8 @@ Path::append_directory(const std::string& dir) {
}
bool
Path::elide_directory() {
if (is_file())
Path::elideDirectory() {
if (isFile())
return false;
size_t slashpos = path.rfind('/',path.size());
if (slashpos == 0 || slashpos == std::string::npos)
@ -370,12 +370,12 @@ Path::elide_directory() {
}
bool
Path::append_file(const std::string& file) {
if (!is_directory())
Path::appendFile(const std::string& file) {
if (!isDirectory())
return false;
Path save(*this);
path += file;
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -383,8 +383,8 @@ Path::append_file(const std::string& file) {
}
bool
Path::elide_file() {
if (is_directory())
Path::elideFile() {
if (isDirectory())
return false;
size_t slashpos = path.rfind('/',path.size());
if (slashpos == std::string::npos)
@ -394,13 +394,13 @@ Path::elide_file() {
}
bool
Path::append_suffix(const std::string& suffix) {
if (is_directory())
Path::appendSuffix(const std::string& suffix) {
if (isDirectory())
return false;
Path save(*this);
path.append(".");
path.append(suffix);
if (!is_valid()) {
if (!isValid()) {
path = save.path;
return false;
}
@ -408,8 +408,8 @@ Path::append_suffix(const std::string& suffix) {
}
bool
Path::elide_suffix() {
if (is_directory()) return false;
Path::elideSuffix() {
if (isDirectory()) return false;
size_t dotpos = path.rfind('.',path.size());
size_t slashpos = path.rfind('/',path.size());
if (slashpos != std::string::npos && dotpos != std::string::npos &&
@ -422,9 +422,9 @@ Path::elide_suffix() {
bool
Path::create_directory( bool create_parents) {
Path::createDirectory( bool create_parents) {
// Make sure we're dealing with a directory
if (!is_directory()) return false;
if (!isDirectory()) return false;
// Get a writeable copy of the path name
char *pathname = reinterpret_cast<char *>(_alloca(path.length()+1));
@ -473,9 +473,9 @@ Path::create_directory( bool create_parents) {
}
bool
Path::create_file() {
Path::createFile() {
// Make sure we're dealing with a file
if (!is_file()) return false;
if (!isFile()) return false;
// Create the file
HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW,
@ -488,9 +488,9 @@ Path::create_file() {
}
bool
Path::destroy_directory(bool remove_contents) {
Path::destroyDirectory(bool remove_contents) {
// Make sure we're dealing with a directory
if (!is_directory()) return false;
if (!isDirectory()) return false;
// If it doesn't exist, we're done.
if (!exists()) return true;
@ -517,8 +517,8 @@ Path::destroy_directory(bool remove_contents) {
}
bool
Path::destroy_file() {
if (!is_file()) return false;
Path::destroyFile() {
if (!isFile()) return false;
DWORD attr = GetFileAttributes(path.c_str());

View File

@ -32,7 +32,7 @@ Program::FindProgramByName(const std::string& progName) {
if (progName.length() == 0) // no program
return Path();
Path temp;
if (!temp.set_file(progName)) // invalid name
if (!temp.setFile(progName)) // invalid name
return Path();
if (temp.executable()) // already executable as is
return temp;

View File

@ -93,7 +93,7 @@ void sys::RemoveDirectoryOnSignal(const sys::Path& path) {
if (CleanupExecuted)
throw std::string("Process terminating -- cannot register for removal");
if (path.is_directory()) {
if (path.isDirectory()) {
if (DirectoriesToRemove == NULL)
DirectoriesToRemove = new std::vector<sys::Path>;
@ -124,7 +124,7 @@ static void Cleanup() {
if (FilesToRemove != NULL)
while (!FilesToRemove->empty()) {
try {
FilesToRemove->back().destroy_file();
FilesToRemove->back().destroyFile();
} catch (...) {
}
FilesToRemove->pop_back();
@ -133,7 +133,7 @@ static void Cleanup() {
if (DirectoriesToRemove != NULL)
while (!DirectoriesToRemove->empty()) {
try {
DirectoriesToRemove->back().destroy_directory(true);
DirectoriesToRemove->back().destroyDirectory(true);
} catch (...) {
}
DirectoriesToRemove->pop_back();

View File

@ -946,9 +946,9 @@ bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) {
// If the source library's module id is in the dependent library list of the
// destination library, remove it since that module is now linked in.
sys::Path modId;
modId.set_file(Src->getModuleIdentifier());
if (!modId.is_empty())
Dest->removeLibrary(modId.get_basename());
modId.setFile(Src->getModuleIdentifier());
if (!modId.isEmpty())
Dest->removeLibrary(modId.getBasename());
return false;
}

View File

@ -45,7 +45,7 @@ std::string llvm::FindLib(const std::string &Filename,
bool SharedObjectOnly) {
// Determine if the pathname can be found as it stands.
sys::Path FilePath;
if (FilePath.set_file(Filename) && FilePath.readable())
if (FilePath.setFile(Filename) && FilePath.readable())
return Filename;
// Ask the System Path object to locate the library. This ensures that

View File

@ -47,7 +47,7 @@ DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
//
static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
sys::Path Filename;
if (!Filename.set_file(FN)) {
if (!Filename.setFile(FN)) {
std::cerr << "Invalid file name: '" << FN << "'\n";
return std::auto_ptr<Module>();
}

View File

@ -134,7 +134,7 @@ public:
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
tmp.set_directory(*I);
tmp.setDirectory(*I);
IncludePaths.push_back(tmp);
++I;
}
@ -149,7 +149,7 @@ public:
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
tmp.set_directory(*I);
tmp.setDirectory(*I);
LibraryPaths.push_back(tmp);
++I;
}
@ -159,6 +159,10 @@ public:
LibraryPaths.push_back(libPath);
}
virtual void addToolPath( const sys::Path& toolPath ) {
ToolPaths.push_back(toolPath);
}
virtual void setfPassThrough(const StringVector& fOpts) {
fOptions = fOpts;
}
@ -182,8 +186,8 @@ private:
void cleanup() {
if (!isSet(KEEP_TEMPS_FLAG)) {
if (TempDir.is_directory() && TempDir.writable())
TempDir.destroy_directory(/*remove_contents=*/true);
if (TempDir.isDirectory() && TempDir.writable())
TempDir.destroyDirectory(/*remove_contents=*/true);
} else {
std::cout << "Temporary files are in " << TempDir.get() << "\n";
}
@ -192,9 +196,9 @@ private:
sys::Path MakeTempFile(const std::string& basename,
const std::string& suffix ) {
sys::Path result(TempDir);
if (!result.append_file(basename))
if (!result.appendFile(basename))
throw basename + ": can't use this file name";
if (!result.append_suffix(suffix))
if (!result.appendSuffix(suffix))
throw suffix + ": can't use this file suffix";
return result;
}
@ -373,7 +377,7 @@ private:
if (!isSet(DRY_RUN_FLAG)) {
sys::Path progpath = sys::Program::FindProgramByName(
action->program.get());
if (progpath.is_empty())
if (progpath.isEmpty())
throw std::string("Can't find program '"+progpath.get()+"'");
else if (progpath.executable())
action->program = progpath;
@ -404,24 +408,24 @@ private:
const sys::Path& dir,
bool native = false) {
sys::Path fullpath(dir);
fullpath.append_file(link_item);
fullpath.appendFile(link_item);
if (native) {
fullpath.append_suffix("a");
fullpath.appendSuffix("a");
} else {
fullpath.append_suffix("bc");
fullpath.appendSuffix("bc");
if (fullpath.readable())
return fullpath;
fullpath.elide_suffix();
fullpath.append_suffix("o");
fullpath.elideSuffix();
fullpath.appendSuffix("o");
if (fullpath.readable())
return fullpath;
fullpath = dir;
fullpath.append_file(std::string("lib") + link_item);
fullpath.append_suffix("a");
fullpath.appendFile(std::string("lib") + link_item);
fullpath.appendSuffix("a");
if (fullpath.readable())
return fullpath;
fullpath.elide_suffix();
fullpath.append_suffix("so");
fullpath.elideSuffix();
fullpath.appendSuffix("so");
if (fullpath.readable())
return fullpath;
}
@ -446,14 +450,14 @@ private:
// on the command line.
PathVector::iterator PI = LibraryPaths.begin();
PathVector::iterator PE = LibraryPaths.end();
while (PI != PE && fullpath.is_empty()) {
while (PI != PE && fullpath.isEmpty()) {
fullpath = GetPathForLinkageItem(link_item.get(),*PI);
++PI;
}
// If we didn't find the file in any of the library search paths
// so we have to bail. No where else to look.
if (fullpath.is_empty()) {
if (fullpath.isEmpty()) {
err =
std::string("Can't find linkage item '") + link_item.get() + "'";
return false;
@ -466,7 +470,7 @@ private:
set.insert(fullpath);
// If its an LLVM bytecode file ...
if (fullpath.is_bytecode_file()) {
if (fullpath.isBytecodeFile()) {
// Process the dependent libraries recursively
Module::LibraryListType modlibs;
if (GetBytecodeDependentLibraries(fullpath.get(),modlibs)) {
@ -530,13 +534,13 @@ public:
// If they are asking for linking and didn't provide an output
// file then its an error (no way for us to "make up" a meaningful
// file name based on the various linker input files).
if (finalPhase == LINKING && Output.is_empty())
if (finalPhase == LINKING && Output.isEmpty())
throw std::string(
"An output file name must be specified for linker output");
// If they are not asking for linking, provided an output file and
// there is more than one input file, its an error
if (finalPhase != LINKING && !Output.is_empty() && InpList.size() > 1)
if (finalPhase != LINKING && !Output.isEmpty() && InpList.size() > 1)
throw std::string("An output file name cannot be specified ") +
"with more than one input file name when not linking";
@ -581,19 +585,19 @@ public:
// Initialize the input and output files
sys::Path InFile(I->first);
sys::Path OutFile(I->first.get_basename());
sys::Path OutFile(I->first.getBasename());
// PRE-PROCESSING PHASE
Action& action = cd->PreProcessor;
// Get the preprocessing action, if needed, or error if appropriate
if (!action.program.is_empty()) {
if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == PREPROCESSING) {
if (finalPhase == PREPROCESSING) {
OutFile.append_suffix("E");
OutFile.appendSuffix("E");
actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING));
} else {
sys::Path TempFile(MakeTempFile(I->first.get_basename(),"E"));
sys::Path TempFile(MakeTempFile(I->first.getBasename(),"E"));
actions.push_back(GetAction(cd,InFile,TempFile,
PREPROCESSING));
InFile = TempFile;
@ -614,13 +618,13 @@ public:
action = cd->Translator;
// Get the translation action, if needed, or error if appropriate
if (!action.program.is_empty()) {
if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == TRANSLATION) {
if (finalPhase == TRANSLATION) {
OutFile.append_suffix("o");
OutFile.appendSuffix("o");
actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION));
} else {
sys::Path TempFile(MakeTempFile(I->first.get_basename(),"trans"));
sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans"));
actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION));
InFile = TempFile;
}
@ -630,10 +634,10 @@ public:
/// The output of the translator is an LLVM Assembly program
/// We need to translate it to bytecode
Action* action = new Action();
action->program.set_file("llvm-as");
action->program.setFile("llvm-as");
action->args.push_back(InFile.get());
action->args.push_back("-o");
InFile.append_suffix("bc");
InFile.appendSuffix("bc");
action->args.push_back(InFile.get());
actions.push_back(action);
}
@ -653,13 +657,13 @@ public:
// Get the optimization action, if needed, or error if appropriate
if (!isSet(EMIT_RAW_FLAG)) {
if (!action.program.is_empty()) {
if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) {
if (finalPhase == OPTIMIZATION) {
OutFile.append_suffix("o");
OutFile.appendSuffix("o");
actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION));
} else {
sys::Path TempFile(MakeTempFile(I->first.get_basename(),"opt"));
sys::Path TempFile(MakeTempFile(I->first.getBasename(),"opt"));
actions.push_back(GetAction(cd,InFile,TempFile,OPTIMIZATION));
InFile = TempFile;
}
@ -668,11 +672,11 @@ public:
/// The output of the optimizer is an LLVM Assembly program
/// We need to translate it to bytecode with llvm-as
Action* action = new Action();
action->program.set_file("llvm-as");
action->program.setFile("llvm-as");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
InFile.append_suffix("bc");
InFile.appendSuffix("bc");
action->args.push_back(InFile.get());
actions.push_back(action);
}
@ -695,20 +699,20 @@ public:
if (isSet(EMIT_NATIVE_FLAG)) {
// Use llc to get the native assembly file
Action* action = new Action();
action->program.set_file("llc");
action->program.setFile("llc");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
OutFile.append_suffix("s");
OutFile.appendSuffix("s");
action->args.push_back(OutFile.get());
} else {
// Just convert back to llvm assembly with llvm-dis
Action* action = new Action();
action->program.set_file("llvm-dis");
action->program.setFile("llvm-dis");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
OutFile.append_suffix("ll");
OutFile.appendSuffix("ll");
action->args.push_back(OutFile.get());
actions.push_back(action);
}
@ -743,7 +747,7 @@ public:
// Set up the linking action with llvm-ld
Action* link = new Action();
link->program.set_file("llvm-ld");
link->program.setFile("llvm-ld");
// Add in the optimization level requested
switch (optLevel) {
@ -834,6 +838,7 @@ private:
std::string machine; ///< Target machine name
PathVector LibraryPaths; ///< -L options
PathVector IncludePaths; ///< -I options
PathVector ToolPaths; ///< -B options
StringVector Defines; ///< -D options
sys::Path TempDir; ///< Name of the temporary directory.
StringTable AdditionalArgs; ///< The -Txyz options

View File

@ -161,7 +161,7 @@ namespace llvm {
/// @brief Set the output machine name.
virtual void setOutputMachine(const std::string& machineName) = 0;
/// @brief Set Preprocessor specific options
/// @brief Set the options for a given phase.
virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0;
/// @brief Set Library Paths
@ -173,10 +173,12 @@ namespace llvm {
/// @brief Set Library Paths
virtual void setLibraryPaths(const StringVector& paths) = 0;
/// @brief Set the list of library paths to be searched for
/// libraries.
/// @brief Add a path to the list of library paths
virtual void addLibraryPath( const sys::Path& libPath ) = 0;
/// @brief Add a path to the list of paths in which to find tools
virtual void addToolPath( const sys::Path& toolPath) = 0;
/// @brief Set the list of -f options to be passed through
virtual void setfPassThrough(const StringVector& fOpts) = 0;

View File

@ -233,7 +233,7 @@ namespace {
action.args.clear();
} else {
if (token == STRING || token == OPTION) {
action.program.set_file(ConfigLexerState.StringVal);
action.program.setFile(ConfigLexerState.StringVal);
} else {
error("Expecting a program name");
}
@ -421,33 +421,33 @@ CompilerDriver::ConfigData*
LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) {
CompilerDriver::ConfigData* result = 0;
sys::Path confFile;
if (configDir.is_empty()) {
if (configDir.isEmpty()) {
// Try the environment variable
const char* conf = getenv("LLVM_CONFIG_DIR");
if (conf) {
confFile.set_directory(conf);
confFile.append_file(ftype);
confFile.setDirectory(conf);
confFile.appendFile(ftype);
if (!confFile.readable())
throw std::string("Configuration file for '") + ftype +
"' is not available.";
} else {
// Try the user's home directory
confFile = sys::Path::GetUserHomeDirectory();
if (!confFile.is_empty()) {
confFile.append_directory(".llvm");
confFile.append_directory("etc");
confFile.append_file(ftype);
if (!confFile.isEmpty()) {
confFile.appendDirectory(".llvm");
confFile.appendDirectory("etc");
confFile.appendFile(ftype);
if (!confFile.readable())
confFile.clear();
}
if (!confFile.is_empty()) {
if (!confFile.isEmpty()) {
// Okay, try the LLVM installation directory
confFile = sys::Path::GetLLVMConfigDir();
confFile.append_file(ftype);
confFile.appendFile(ftype);
if (!confFile.readable()) {
// Okay, try the "standard" place
confFile = sys::Path::GetLLVMDefaultConfigDir();
confFile.append_file(ftype);
confFile.appendFile(ftype);
if (!confFile.readable()) {
throw std::string("Configuration file for '") + ftype +
"' is not available.";
@ -457,7 +457,7 @@ LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) {
}
} else {
confFile = configDir;
confFile.append_file(ftype);
confFile.appendFile(ftype);
if (!confFile.readable())
throw std::string("Configuration file for '") + ftype +
"' is not available.";

View File

@ -111,6 +111,10 @@ cl::list<std::string> WOpts("W", cl::ZeroOrMore, cl::Prefix,
cl::desc("Pass through -W options to compiler tools"),
cl::value_desc("warnings category"));
cl::list<std::string> BOpt("B", cl::ZeroOrMore, cl::Prefix,
cl::desc("Indicate where llvmc sub-tools are installed"),
cl::value_desc("directory path containing bin and lib directories"));
//===------------------------------------------------------------------------===
//=== INPUT OPTIONS
//===------------------------------------------------------------------------===