[PATCH] D116659: [llvm][clang][vfs] NFC: Extract directory iteration boilerplate into macro

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 05:50:34 PST 2022


jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, arphaman.
Herald added subscribers: kerbowa, nhaehnle, jvesely.
jansvoboda11 requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

The iteration over directory entries of a VFS is a bit unweildy, since it requires using a pair of `llvm::vfs::directory_iterator`, calling `llvm::vfs::directory_iterator::increment(std::error_code &)` and checking `std::error_code`. Currently, there are 13 instances of this pattern in the Clang codebase.

This patch simplifies iteration over directory entries by extracting the boilerplate into a macro.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116659

Files:
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSVC.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  llvm/include/llvm/Support/VirtualFileSystem.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116659.397549.patch
Type: text/x-patch
Size: 11079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220105/8ddd4160/attachment-0001.bin>


More information about the cfe-commits mailing list