for (const tooling::Replacement &R : TU.Replacements) {
// Use the file manager to deduplicate paths. FileEntries are
// automatically canonicalized.
- const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
- if (!Entry && Warned.insert(R.getFilePath()).second) {
- errs() << "Described file '" << R.getFilePath()
- << "' doesn't exist. Ignoring...\n";
- continue;
+ if (const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath())) {
+ GroupedReplacements[Entry].push_back(R);
+ } else if (Warned.insert(R.getFilePath()).second) {
+ errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
}
- GroupedReplacements[Entry].push_back(R);
}
}
for (const tooling::Replacement &R : Fix.second) {
// Use the file manager to deduplicate paths. FileEntries are
// automatically canonicalized.
- const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
- if (!Entry && Warned.insert(R.getFilePath()).second) {
- errs() << "Described file '" << R.getFilePath()
- << "' doesn't exist. Ignoring...\n";
- continue;
+ if (const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath())) {
+ GroupedReplacements[Entry].push_back(R);
+ } else if (Warned.insert(R.getFilePath()).second) {
+ errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
}
- GroupedReplacements[Entry].push_back(R);
}
}
}
--- /dev/null
+// RUN: mkdir -p %T/invalid-files
+// RUN: clang-apply-replacements %T/invalid-files
+//
+// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files.
+// RUN: ls %T/Inputs/invalid-files/invalid-files.yaml