[PATCH] cpp11-migrate: Write header replacements to disk
Tareq A. Siraj
tareq.a.siraj at intel.com
Thu Jul 25 11:46:48 PDT 2013
================
Comment at: unittests/cpp11-migrate/ReplacementsYamlTest.cpp:29
@@ +28,3 @@
+ ReplacementsYamlTest() {
+ ASSERT_NO_ERROR(sys::fs::current_path(SourceFileName));
+ ASSERT_NO_ERROR(sys::fs::current_path(HeaderFileName));
----------------
Edwin Vane wrote:
> Don't write to and read from files on disk. This is just asking for trouble. We have no guarantee what the "current_path" will even be and risk polluting whatever directory structure this test runs in. YAML doesn't require files to write to so create a raw_string_ostream instead and write to blocks in memory.
Fixed.
================
Comment at: cpp11-migrate/Core/ReplacementsYaml.h:69
@@ +68,3 @@
+ Length(R.getLength()) {
+ // We need to put quotes around the string to make this a YAML string.
+ ReplacementText = std::string("\"") +
----------------
Edwin Vane wrote:
> This should really happen in ScalarTraits<std::string>::output().
Fixed.
================
Comment at: cpp11-migrate/Core/FileOverrides.h:101
@@ +100,3 @@
+ /// TransformReplacementsDoc.
+ void addTransformReplacement(llvm::StringRef TransformID,
+ const clang::tooling::Replacement &R) {
----------------
Edwin Vane wrote:
> This will result in a whole bunch of TransformReplacements with only a single Replacment will it not? There should be some sort of lookup by transform ID and the replacement should be **added** to that. Since replacements are provided in a batch a whole transform at a time you should just accept the entire replacements set here instead of one replacement at a time.
Fixed.
http://llvm-reviews.chandlerc.com/D1142
BRANCH
write_replacements_to_disk
ARCANIST PROJECT
clang-tools-extra
More information about the cfe-commits
mailing list