#include "llvm/System/Path.h"
#include "llvm/Config/config.h"
#include <cassert>
-
-namespace llvm {
+#include <ostream>
+using namespace llvm;
using namespace sys;
//===----------------------------------------------------------------------===//
//=== independent code.
//===----------------------------------------------------------------------===//
+std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) {
+ strm << aPath.toString();
+ return strm;
+}
+
Path
Path::GetLLVMConfigDir() {
Path result;
#ifdef LLVM_ETCDIR
- if (result.setDirectory(LLVM_ETCDIR))
+ if (result.set(LLVM_ETCDIR))
return result;
#endif
return GetLLVMDefaultConfigDir();
bool
Path::isArchive() const {
- if (readable())
+ if (canRead())
return hasMagicNumber("!<arch>\012");
return false;
}
bool
Path::isDynamicLibrary() const {
- if (readable())
+ if (canRead())
return hasMagicNumber("\177ELF");
return false;
}
GetSystemLibraryPaths(LibPaths);
for (unsigned i = 0; i < LibPaths.size(); ++i) {
sys::Path FullPath(LibPaths[i]);
- FullPath.appendFile("lib" + name + LTDL_SHLIB_EXT);
+ FullPath.appendComponent("lib" + name + LTDL_SHLIB_EXT);
if (FullPath.isDynamicLibrary())
return FullPath;
- FullPath.elideSuffix();
+ FullPath.eraseSuffix();
FullPath.appendSuffix("a");
if (FullPath.isArchive())
return FullPath;
return sys::Path();
}
-std::string
-Path::GetDLLSuffix() {
+std::string Path::GetDLLSuffix() {
return LTDL_SHLIB_EXT;
}
-}
-
// Include the truly platform-specific parts of this class.
-
#if defined(LLVM_ON_UNIX)
#include "Unix/Path.inc"
#endif
#include "Win32/Path.inc"
#endif
+DEFINING_FILE_FOR(SystemPath)