[PATCH] D127658: [clang][lex] NFCI: Use FileEntryRef in Sema::CodeCompleteIncludedFile

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 08:38:34 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added a reviewer: bnbarham.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch replaces some calls to the deprecated `DirectoryEntry::getName()` with calls to `DirectoryEntryRef::getName()` in SemaCodeComplete.cpp.

Depends on D127654 <https://reviews.llvm.org/D127654>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127658

Files:
  clang/lib/Sema/SemaCodeComplete.cpp


Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -9957,12 +9957,12 @@
       // header maps are not (currently) enumerable.
       break;
     case DirectoryLookup::LT_NormalDir:
-      AddFilesFromIncludeDir(IncludeDir.getDir()->getName(), IsSystem,
+      AddFilesFromIncludeDir(IncludeDir.getDirRef()->getName(), IsSystem,
                              DirectoryLookup::LT_NormalDir);
       break;
     case DirectoryLookup::LT_Framework:
-      AddFilesFromIncludeDir(IncludeDir.getFrameworkDir()->getName(), IsSystem,
-                             DirectoryLookup::LT_Framework);
+      AddFilesFromIncludeDir(IncludeDir.getFrameworkDirRef()->getName(),
+                             IsSystem, DirectoryLookup::LT_Framework);
       break;
     }
   };
@@ -9974,9 +9974,8 @@
   using llvm::make_range;
   if (!Angled) {
     // The current directory is on the include path for "quoted" includes.
-    const FileEntry *CurFile = PP.getCurrentFileLexer()->getFileEntry();
-    if (CurFile && CurFile->getDir())
-      AddFilesFromIncludeDir(CurFile->getDir()->getName(), false,
+    if (auto CurFile = PP.getCurrentFileLexer()->getFileEntry())
+      AddFilesFromIncludeDir(CurFile->getDir().getName(), false,
                              DirectoryLookup::LT_NormalDir);
     for (const auto &D : make_range(S.quoted_dir_begin(), S.quoted_dir_end()))
       AddFilesFromDirLookup(D, false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127658.436419.patch
Type: text/x-patch
Size: 1541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220613/63919c5a/attachment.bin>


More information about the cfe-commits mailing list