[PATCH] Fix replacements for files with relative paths are not applied.
Ariel Bernal
ariel.j.bernal at intel.com
Sat Oct 5 21:23:38 PDT 2013
================
Comment at: lib/Tooling/Refactoring.cpp:108
@@ -107,4 +107,3 @@
const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first);
-
- if (Entry != NULL) {
+ if (Entry != NULL)
// Make FilePath absolute so replacements can be applied correctly when
----------------
Manuel Klimek wrote:
> I'd always use {} if there's a more complex statement inside.
yes sure
================
Comment at: lib/Tooling/Refactoring.cpp:112
@@ +111,3 @@
+ // files.
+ if (Sources.getFileManager().isFileVirtual(Entry->getName())) {
+ this->FilePath = Entry->getName();
----------------
Manuel Klimek wrote:
> Can't we instead just check whether the relative file exists?
> If the file is relative, and it can be accessed via the filesystem, use make_absolute; otherwise, simply use the entry name.
no problem I'll check that and upload another patch.
================
Comment at: include/clang/Basic/FileManager.h:278
@@ +277,3 @@
+ /// \brief Check if a FilePath is a virtual file that we have allocated.
+ bool isFileVirtual(StringRef FilePath);
+
----------------
Manuel Klimek wrote:
> If we decided we need this (see further down), this'll need approval from Doug...
if I use exists on the relative file then this won't be needed anymore.
http://llvm-reviews.chandlerc.com/D1800
More information about the cfe-commits
mailing list