diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-04-07 00:00:42 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-04-07 00:00:42 +0000 |
commit | 7caebc182a90dda7ed698f0b4c889860f15422a1 (patch) | |
tree | 465045476846ac6c4e96e2f7b0f54caec9ed46b7 /clang/lib/Frontend/ModuleDependencyCollector.cpp | |
parent | 8c0d66bc5418dae3fe0a445f43cd478bafafa579 (diff) | |
download | bcm5719-llvm-7caebc182a90dda7ed698f0b4c889860f15422a1.tar.gz bcm5719-llvm-7caebc182a90dda7ed698f0b4c889860f15422a1.zip |
[CrashReproducer] Move ModuleDependencyCollector method around. NFC
llvm-svn: 265621
Diffstat (limited to 'clang/lib/Frontend/ModuleDependencyCollector.cpp')
-rw-r--r-- | clang/lib/Frontend/ModuleDependencyCollector.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/clang/lib/Frontend/ModuleDependencyCollector.cpp b/clang/lib/Frontend/ModuleDependencyCollector.cpp index e0ec674a16c..d9cf40af0f6 100644 --- a/clang/lib/Frontend/ModuleDependencyCollector.cpp +++ b/clang/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<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; |