versioner: always copy over source headers when preprocessing.
Also, be less noisy when preprocessing.
Bug: http://b/30170081
Change-Id: If0d81b0a3a49756164e4945a20703afeb302fd4d
Test: python run_tests.py
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index 33531bd..3c18922 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -459,7 +459,7 @@
}
}
- // Copy over any unchanged files directly.
+ // Copy over the original headers before preprocessing.
char* fts_paths[2] = { const_cast<char*>(src_dir.c_str()), nullptr };
FTS* fts = fts_open(fts_paths, FTS_LOGICAL, nullptr);
while (FTSENT* ent = fts_read(fts)) {
@@ -473,18 +473,14 @@
}
std::string rel_path = path.substr(src_dir.length() + 1);
- if (guards.count(rel_path) == 0) {
- std::string dst_path = dst_dir + "/" + rel_path;
- llvm::StringRef parent_path = llvm::sys::path::parent_path(dst_path);
- if (llvm::sys::fs::create_directories(parent_path)) {
- errx(1, "failed to ensure existence of directory '%s'", parent_path.str().c_str());
- }
- if (llvm::sys::fs::copy_file(path, dst_path)) {
- errx(1, "failed to copy '%s/%s' to '%s'", src_dir.c_str(), path.str().c_str(),
- dst_path.c_str());
- }
-
- printf("Copied unmodified header %s\n", dst_path.c_str());
+ std::string dst_path = dst_dir + "/" + rel_path;
+ llvm::StringRef parent_path = llvm::sys::path::parent_path(dst_path);
+ if (llvm::sys::fs::create_directories(parent_path)) {
+ errx(1, "failed to ensure existence of directory '%s'", parent_path.str().c_str());
+ }
+ if (llvm::sys::fs::copy_file(path, dst_path)) {
+ errx(1, "failed to copy '%s/%s' to '%s'", src_dir.c_str(), path.str().c_str(),
+ dst_path.c_str());
}
}
fts_close(fts);