From 6b2405c749a74d3db7ff500b313af57762c5a3ed Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Thu, 7 Apr 2016 00:00:42 +0000 Subject: [PATCH] [CrashReproducer] Move ModuleDependencyCollector method around. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265621 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/ModuleDependencyCollector.cpp | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/Frontend/ModuleDependencyCollector.cpp b/lib/Frontend/ModuleDependencyCollector.cpp index e0ec674a16..d9cf40af0f 100644 --- a/lib/Frontend/ModuleDependencyCollector.cpp +++ b/lib/Frontend/ModuleDependencyCollector.cpp @@ -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 &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(*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 &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 &Result) { using namespace llvm::sys; -- 2.40.0