[clang] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)
Ben Langmuir via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 29 11:01:48 PDT 2023
================
@@ -843,7 +843,7 @@ void ClangMoveTool::moveDeclsToNewFiles() {
// Move all contents from OldFile to NewFile.
void ClangMoveTool::moveAll(SourceManager &SM, StringRef OldFile,
StringRef NewFile) {
- auto FE = SM.getFileManager().getFile(makeAbsolutePath(OldFile));
+ auto FE = SM.getFileManager().getOptionalFileRef(makeAbsolutePath(OldFile));
if (!FE) {
llvm::errs() << "Failed to get file: " << OldFile << "\n";
----------------
benlangmuir wrote:
Recommend `getFileRef` and then print the error message as well if it fails.
https://github.com/llvm/llvm-project/pull/67838
More information about the cfe-commits
mailing list