This is an archive of the discontinued LLVM Phabricator instance.

[clang][lex] Introduce `ConstSearchDirIterator`
ClosedPublic

Authored by jansvoboda11 on Jan 18 2022, 7:46 AM.

Details

Summary

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.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Jan 18 2022, 7:46 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 7:46 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Fix comment typo

ahoppen accepted this revision.Jan 19 2022, 6:09 AM
This revision is now accepted and ready to land.Jan 19 2022, 6:09 AM
jansvoboda11 retitled this revision from [clang][lex] Introduce `DirectoryLookupIterator` to [clang][lex] Introduce `SearchDirIterator`.Jan 20 2022, 6:54 AM
jansvoboda11 edited the summary of this revision. (Show Details)

Rename the new iterator type.

jansvoboda11 retitled this revision from [clang][lex] Introduce `SearchDirIterator` to [clang][lex] Introduce `ConstSearchDirIterator`.Feb 14 2022, 7:22 AM
jansvoboda11 edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Feb 15 2022, 1:37 AM
This revision was automatically updated to reflect the committed changes.