This is an archive of the discontinued LLVM Phabricator instance.

[clang][lex] Introduce `SearchDirIdx` to usage tracking code
AcceptedPublic

Authored by jansvoboda11 on Feb 15 2022, 2:58 AM.

Details

Summary

This patch introduces new SearchDirIdx type to the internal HeaderSearch code that tracks search path usage. The type replaces the current uses of unsigned to identify DirectoryLookup objects.

In a follow-up patch (D116750), this type will become resilient against insertions "into the middle" of SearchDirs as done by HeaderSearch::AddSearchPath().

Diff Detail

Event Timeline

jansvoboda11 created this revision.Feb 15 2022, 2:58 AM
jansvoboda11 requested review of this revision.Feb 15 2022, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2022, 2:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Definitely a lot nicer 👍

clang/include/clang/Lex/HeaderSearch.h
185

I would have expected these to be methods on HeaderSearch. Is there a particular reason why these are methods on SearchDirIdx?

jansvoboda11 added inline comments.Feb 15 2022, 7:02 AM
clang/include/clang/Lex/HeaderSearch.h
185

No particular reason. I agree this makes more sense on HeaderSearch.

Move SearchDirIdx::get() to HeaderSearch

jansvoboda11 retitled this revision from [clang][lex] Introduce `SearchDirIndex` to usage tracking code to [clang][lex] Introduce `SearchDirIdx` to usage tracking code.Feb 15 2022, 8:00 AM
jansvoboda11 edited the summary of this revision. (Show Details)
ahoppen accepted this revision.Feb 15 2022, 8:31 AM
This revision is now accepted and ready to land.Feb 15 2022, 8:31 AM