summaryrefslogtreecommitdiffstats
path: root/clang/lib/ARCMigrate/FileRemapper.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-09 20:00:58 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-09 20:00:58 +0000
commit7fbd97f641aac5aa047b16fb075e30826023ca09 (patch)
tree65b1cd86783449c9f4a54182688b1b2209342e51 /clang/lib/ARCMigrate/FileRemapper.cpp
parent25659e93c755bdb6832ca58e7d4b698df9f2e10f (diff)
downloadbcm5719-llvm-7fbd97f641aac5aa047b16fb075e30826023ca09.tar.gz
bcm5719-llvm-7fbd97f641aac5aa047b16fb075e30826023ca09.zip
[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. llvm-svn: 134844
Diffstat (limited to 'clang/lib/ARCMigrate/FileRemapper.cpp')
-rw-r--r--clang/lib/ARCMigrate/FileRemapper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp
index ae5d3a3c934..c1dbe92ffb8 100644
--- a/clang/lib/ARCMigrate/FileRemapper.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud