diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-09 20:00:58 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-09 20:00:58 +0000 |
commit | 69325d5b7cfecf1b3128745efc33612aedf1b8b4 (patch) | |
tree | ddd1627268276e97d9a2394625f3aff4b904f5ec /lib/ARCMigrate/FileRemapper.cpp | |
parent | 8dd5cdfc462026648b480adaf774e24bc620f7c3 (diff) |
[arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.
<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.
Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.
Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.
rdar://9735086.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134844 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ARCMigrate/FileRemapper.cpp')
-rw-r--r-- | lib/ARCMigrate/FileRemapper.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ARCMigrate/FileRemapper.cpp b/lib/ARCMigrate/FileRemapper.cpp index ae5d3a3c93..c1dbe92ffb 100644 --- a/lib/ARCMigrate/FileRemapper.cpp +++ b/lib/ARCMigrate/FileRemapper.cpp @@ -71,11 +71,8 @@ bool FileRemapper::initFromDisk(llvm::StringRef outputDir, Diagnostic &Diag, fin >> fromFilename >> timeModified >> toFilename; if (fin.eof()) break; - if (!fin.good()) { - if (ignoreIfFilesChanged) - return false; + if (!fin.good()) return report(std::string("Error in format of file: ") + infoFile, Diag); - } const FileEntry *origFE = FileMgr->getFile(fromFilename); if (!origFE) { @@ -115,8 +112,7 @@ bool FileRemapper::flushToDisk(llvm::StringRef outputDir, Diagnostic &Diag) { std::string errMsg; std::string infoFile = getRemapInfoFile(outputDir); - llvm::raw_fd_ostream infoOut(infoFile.c_str(), errMsg, - llvm::raw_fd_ostream::F_Binary); + llvm::raw_fd_ostream infoOut(infoFile.c_str(), errMsg); if (!errMsg.empty() || infoOut.has_error()) return report(errMsg, Diag); @@ -124,11 +120,15 @@ bool FileRemapper::flushToDisk(llvm::StringRef outputDir, Diagnostic &Diag) { I = FromToMappings.begin(), E = FromToMappings.end(); I != E; ++I) { const FileEntry *origFE = I->first; - infoOut << origFE->getName() << '\n'; + llvm::SmallString<200> origPath = llvm::StringRef(origFE->getName()); + fs::make_absolute(origPath); + infoOut << origPath << '\n'; infoOut << (uint64_t)origFE->getModificationTime() << '\n'; if (const FileEntry *FE = I->second.dyn_cast<const FileEntry *>()) { - infoOut << FE->getName() << '\n'; + llvm::SmallString<200> newPath = llvm::StringRef(FE->getName()); + fs::make_absolute(newPath); + infoOut << newPath << '\n'; } else { llvm::SmallString<64> tempPath; |