forked from OSchip/llvm-project
[CrashReproducer] Move ModuleDependencyCollector method around. NFC
llvm-svn: 265621
This commit is contained in:
parent
8c0d66bc54
commit
7caebc182a
|
@ -52,6 +52,24 @@ struct ModuleDependencyMMCallbacks : public ModuleMapCallbacks {
|
|||
|
||||
}
|
||||
|
||||
// TODO: move this to Support/Path.h and check for HAVE_REALPATH?
|
||||
static bool real_path(StringRef SrcPath, SmallVectorImpl<char> &RealPath) {
|
||||
#ifdef LLVM_ON_UNIX
|
||||
char CanonicalPath[PATH_MAX];
|
||||
|
||||
// TODO: emit a warning in case this fails...?
|
||||
if (!realpath(SrcPath.str().c_str(), CanonicalPath))
|
||||
return false;
|
||||
|
||||
SmallString<256> RPath(CanonicalPath);
|
||||
RealPath.swap(RPath);
|
||||
return true;
|
||||
#else
|
||||
// FIXME: Add support for systems without realpath.
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ModuleDependencyCollector::attachToASTReader(ASTReader &R) {
|
||||
R.addListener(llvm::make_unique<ModuleDependencyListener>(*this));
|
||||
}
|
||||
|
@ -81,24 +99,6 @@ void ModuleDependencyCollector::writeFileMap() {
|
|||
VFSWriter.write(OS);
|
||||
}
|
||||
|
||||
// TODO: move this to Support/Path.h and check for HAVE_REALPATH?
|
||||
static bool real_path(StringRef SrcPath, SmallVectorImpl<char> &RealPath) {
|
||||
#ifdef LLVM_ON_UNIX
|
||||
char CanonicalPath[PATH_MAX];
|
||||
|
||||
// TODO: emit a warning in case this fails...?
|
||||
if (!realpath(SrcPath.str().c_str(), CanonicalPath))
|
||||
return false;
|
||||
|
||||
SmallString<256> RPath(CanonicalPath);
|
||||
RealPath.swap(RPath);
|
||||
return true;
|
||||
#else
|
||||
// FIXME: Add support for systems without realpath.
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ModuleDependencyCollector::getRealPath(StringRef SrcPath,
|
||||
SmallVectorImpl<char> &Result) {
|
||||
using namespace llvm::sys;
|
||||
|
|
Loading…
Reference in New Issue