[all-commits] [llvm/llvm-project] 7631c3: [clang][lex] Introduce `ConstSearchDirIterator`

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Feb 15 01:37:08 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7631c366c8589dda488cb7ff1df26cc134002208
      https://github.com/llvm/llvm-project/commit/7631c366c8589dda488cb7ff1df26cc134002208
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    M clang/include/clang/Lex/HeaderSearch.h
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Lex/HeaderSearch.cpp
    M clang/lib/Lex/PPDirectives.cpp
    M clang/lib/Lex/PPLexerChange.cpp
    M clang/lib/Lex/PPMacroExpansion.cpp

  Log Message:
  -----------
  [clang][lex] Introduce `ConstSearchDirIterator`

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 `ConstSearchDirIterator` to make that affordance obvious. This would've prevented a bug that occurred after initially landing D116750.

Reviewed By: ahoppen

Differential Revision: https://reviews.llvm.org/D117566




More information about the All-commits mailing list