This is an archive of the discontinued LLVM Phabricator instance.

[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
ClosedPublic

Authored by rmaz on Jan 19 2023, 6:52 AM.

Details

Summary

Refactor the Module::Header class to use an OptionalFileEntryRef
instead of a FileEntry*. This is preparation for refactoring the
TopHeaderNames to use FileEntryRef so that we preserve the
lookup path of the headers when serializing.

This is mostly based on https://reviews.llvm.org/D90497

Diff Detail

Event Timeline

rmaz created this revision.Jan 19 2023, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 6:52 AM
Herald added a subscriber: ChuanqiXu. · View Herald Transcript
rmaz requested review of this revision.Jan 19 2023, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 6:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 added inline comments.Jan 19 2023, 9:25 AM
clang/lib/Frontend/FrontendAction.cpp
424

Debian CI is complaining about this:

error: no viable conversion from 'clang::CustomizableOptional<clang::FileEntryRef>' to 'const clang::FileEntry *'

You might need to refactor Module::addTopHeader() too, or use OptionalFileEntryRefDegradesToFileEntryPtr in the local Headers variable.

clang/lib/Lex/ModuleMap.cpp
2514

Does it make sense to unwrap the optional here? It'll be instantly wrapped in OptionalFileEntryRefDegradesToFileEntryPtr anyways.

clang/lib/Serialization/ASTReader.cpp
1950

Does it make sense to unwrap the optional here? It'll be instantly wrapped in OptionalFileEntryRefDegradesToFileEntryPtr anyways.

rmaz updated this revision to Diff 490568.Jan 19 2023, 9:53 AM

address comments

rmaz marked 3 inline comments as done.Jan 19 2023, 9:55 AM
This revision is now accepted and ready to land.Jan 19 2023, 2:48 PM
This revision was landed with ongoing or failed builds.Jan 20 2023, 7:23 AM
This revision was automatically updated to reflect the committed changes.