[PATCH] Fix replacements for files with relative paths are not applied.
ariel.j.bernal at intel.com
Fri Sep 27 12:10:26 PDT 2013
Comment at: lib/Tooling/Refactoring.cpp:108-112
@@ -105,3 +107,7 @@
const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first);
- this->FilePath = Entry != NULL ? Entry->getName() : InvalidLocation;
+ // Make FilePath absolute so replacements can be applied correctly when
+ // relative paths for files are used.
+ llvm::SmallString<256> FilePath(Entry->getName());
+ this->FilePath = FilePath.c_str();
this->ReplacementRange = Range(DecomposedLocation.second, Length);
Manuel Klimek wrote:
> 1. was it intentional that you removed the Entry != NULL check?
> 2. please add a regression test
No it wasn't, it was a mistake, I fixed it and added a regression test. The problem is that this patch breaks many other tests in c-index-test and also some unit tests.
More information about the cfe-commits