[PATCH] D117566: [clang][lex] Introduce `DirectoryLookupIterator`

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 18 07:46:22 PST 2022


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

The `const DirectoryLookup *` out-parameter of `{HeaderSearch,Preprocessor}::LookupFile()` is assigned the most recently used search directory, which callers use to implement `#include_next`.

>From the function signature it's not obvious the `const DirectoryLookup *` is being used as an iterator. This patch introduces `DirectoryLookupIterator` to make that affordance obvious. This would've prevented a bug that occurred after initially landing D116750 <https://reviews.llvm.org/D116750>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117566

Files:
  clang/include/clang/Lex/HeaderSearch.h
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPLexerChange.cpp
  clang/lib/Lex/PPMacroExpansion.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117566.400849.patch
Type: text/x-patch
Size: 16291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220118/fbcdb5e9/attachment-0001.bin>


More information about the cfe-commits mailing list