From ddbcc10b9e26b18f6a70e23d0611b9da75ffa52f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Sep 2023 10:35:54 -0700 Subject: [clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()` This commit replaces some calls to the deprecated `FileEntry::getName()` with `FileEntryRef::getName()` by swapping current usages of `SourceManager::getFileEntryForID()` with `SourceManager::getFileEntryRefForID()`. This lowers the number of usages of the deprecated `FileEntry::getName()` from 95 to 50. --- clang/lib/Frontend/FrontendAction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/Frontend/FrontendAction.cpp') diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 2da25be..248558e 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -666,7 +666,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, } else { auto &OldSM = AST->getSourceManager(); FileID ID = OldSM.getMainFileID(); - if (auto *File = OldSM.getFileEntryForID(ID)) + if (auto File = OldSM.getFileEntryRefForID(ID)) Input = FrontendInputFile(File->getName(), Kind); else Input = FrontendInputFile(OldSM.getBufferOrFake(ID), Kind); @@ -844,7 +844,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, return false; } // We now have the filename... - FileName = FE->getFileEntry().getName(); + FileName = FE->getName(); // ... still a header unit, but now use the path as written. Kind = Input.getKind().withHeaderUnit(InputKind::HeaderUnit_Abs); Input = FrontendInputFile(FileName, Kind, Input.isSystem()); -- cgit v1.1