[PATCH] Fix replacements for files with relative paths are not applied.

Manuel Klimek klimek at google.com
Tue Oct 8 05:30:39 PDT 2013


  Apart from my remaining nits, LG. Thanks!


================
Comment at: lib/Tooling/Refactoring.cpp:110
@@ -110,7 +109,3 @@
     // Make FilePath absolute so replacements can be applied correctly when
-    // relative paths for files are used.
-    llvm::SmallString<256> FilePath(Entry->getName());
-    llvm::error_code EC = llvm::sys::fs::make_absolute(FilePath);
-    // Don't change the FilePath if the file is a virtual file.
-    this->FilePath = EC ? FilePath.c_str() : Entry->getName();
-  } else
+    // relative paths for file are used. But we don't want to change virtual
+    // files.
----------------
Did you change files to file on purpose? I think this makes the sentence incorrect ;)


================
Comment at: unittests/Tooling/RefactoringTest.cpp:290
@@ +289,3 @@
+  // Change directory to the temporary directory.
+  EXPECT_FALSE(chdir(TempPath.str().c_str()));
+  llvm::sys::fs::current_path(CurrentPath);
----------------
I'd EXPECT_EQ(0, chdir(...)), as the type of the chdir is not bool, and EXPECT_FALSE reads like we'd expect the command to fail.


http://llvm-reviews.chandlerc.com/D1800



More information about the cfe-commits mailing list