This is an archive of the discontinued LLVM Phabricator instance.

Fix replacements for files with relative paths are not applied.
ClosedPublic

Authored by arielbernal on Sep 27 2013, 9:51 AM.

Details

Summary

When using a compilation database where paths in the command are specified relative to the directory then replacements for these files are not applied since there is no path associated to the files.

Diff Detail

Event Timeline

klimek added inline comments.Sep 27 2013, 10:08 AM
lib/Tooling/Refactoring.cpp
108–118
  1. was it intentional that you removed the Entry != NULL check?
  2. please add a regression test
arielbernal added inline comments.Sep 27 2013, 12:10 PM
lib/Tooling/Refactoring.cpp
108–118

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.

klimek added inline comments.Sep 29 2013, 9:26 AM
lib/Tooling/Refactoring.cpp
108–118

Which ones and why? The easiest way to review that would be if you included the fixes for all breaking tests in the patch :D

arielbernal updated this revision to Unknown Object (????).Sep 30 2013, 12:57 PM

Addressed comments and fixed the case where virtual file paths cannot be made absolute. Also added a regression test.

Note that make_absolute already checks for the file to exist so it should be equivalent to check whether the file is virtual or not but if this introduces a performance issue then maybe we would want to have a function in the FileManager to query if a FileEntry is a virtual file (in the VirtualFileEntries vector).

klimek accepted this revision.Oct 1 2013, 12:58 AM

lg

lib/Tooling/Refactoring.cpp
116

I think the common practice is to use braces if one part of the if-else needs braces.

arielbernal closed this revision.Oct 1 2013, 9:05 AM

Fixed braces and committed r191766