From 326e651107c3b6991f913168be77c1aa84bf6d6c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 6 Oct 2015 14:45:13 +0000 Subject: [PATCH] [Tooling] Remove dead code. It took me some time to figure out why this is not working as expected: std:error_code converts to true if there is an error. This means we never ever took the generated absolute path, which happens to be the right thing anyways as it properly works with virtual files. Just remove the whole thing, relative paths are covered by existing tooling tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249408 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Tooling/Core/Replacement.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/Tooling/Core/Replacement.cpp b/lib/Tooling/Core/Replacement.cpp index 5bea84fd44..301c7b71ca 100644 --- a/lib/Tooling/Core/Replacement.cpp +++ b/lib/Tooling/Core/Replacement.cpp @@ -113,15 +113,7 @@ void Replacement::setFromSourceLocation(const SourceManager &Sources, const std::pair DecomposedLocation = Sources.getDecomposedLoc(Start); const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first); - if (Entry) { - // Make FilePath absolute so replacements can be applied correctly when - // relative paths for files are used. - llvm::SmallString<256> FilePath(Entry->getName()); - std::error_code EC = llvm::sys::fs::make_absolute(FilePath); - this->FilePath = EC ? FilePath.c_str() : Entry->getName(); - } else { - this->FilePath = InvalidLocation; - } + this->FilePath = Entry ? Entry->getName() : InvalidLocation; this->ReplacementRange = Range(DecomposedLocation.second, Length); this->ReplacementText = ReplacementText; } -- 2.50.1