From 6df7083be430bd40a5f46e7c14b7d5247cca0a8f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 2 Aug 2013 15:31:35 +0000 Subject: [PATCH] Convert last use of st_dev in clang. llvm-svn: 187654 --- clang/lib/Driver/Tools.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 3a23732..c2b7f6e 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1901,17 +1901,15 @@ static bool shouldUseLeafFramePointer(const ArgList &Args, /// If the PWD environment variable is set, add a CC1 option to specify the /// debug compilation directory. static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) { - struct stat StatPWDBuf, StatDotBuf; - const char *pwd = ::getenv("PWD"); if (!pwd) return; + llvm::sys::fs::file_status PWDStatus, DotStatus; if (llvm::sys::path::is_absolute(pwd) && - stat(pwd, &StatPWDBuf) == 0 && - stat(".", &StatDotBuf) == 0 && - StatPWDBuf.st_ino == StatDotBuf.st_ino && - StatPWDBuf.st_dev == StatDotBuf.st_dev) { + !llvm::sys::fs::status(pwd, PWDStatus) && + !llvm::sys::fs::status(".", DotStatus) && + PWDStatus.getUniqueID() == DotStatus.getUniqueID()) { CmdArgs.push_back("-fdebug-compilation-dir"); CmdArgs.push_back(Args.MakeArgString(pwd)); return; -- 2.7.4