Reverted r192992 broke windows and freebsd builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192997 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Tooling/Refactoring.cpp b/lib/Tooling/Refactoring.cpp
index 175dbd4..9e58db0 100644
--- a/lib/Tooling/Refactoring.cpp
+++ b/lib/Tooling/Refactoring.cpp
@@ -107,16 +107,10 @@
const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first);
if (Entry != NULL) {
// Make FilePath absolute so replacements can be applied correctly when
- // relative paths for files are used. But we don't want to change virtual
- // files.
- if (llvm::sys::fs::exists(Entry->getName())) {
- llvm::SmallString<256> FilePath(Entry->getName());
- llvm::sys::fs::make_absolute(FilePath);
- this->FilePath = FilePath.c_str();
- }
- else {
- this->FilePath = Entry->getName();
- }
+ // relative paths for files are used.
+ llvm::SmallString<256> FilePath(Entry->getName());
+ llvm::error_code EC = llvm::sys::fs::make_absolute(FilePath);
+ this->FilePath = EC ? FilePath.c_str() : Entry->getName();
} else {
this->FilePath = InvalidLocation;
}