This is an archive of the discontinued LLVM Phabricator instance.

[modules] Make a module map referenced by a system map a system one too.
ClosedPublic

Authored by vsapsai on Oct 8 2021, 5:17 PM.

Details

Summary

Mimic the behavior of including headers where a system includer makes an
includee a system header too.

rdar://84049469

Diff Detail

Event Timeline

vsapsai created this revision.Oct 8 2021, 5:17 PM
vsapsai requested review of this revision.Oct 8 2021, 5:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 8 2021, 5:17 PM

Used the mechanism simpler than the one with headers on purpose.

// The #included file will be considered to be a system header if either it is
// in a system include directory, or if the #includer is a system include
// header.
SrcMgr::CharacteristicKind FileCharacter =
    SourceMgr.getFileCharacteristic(FilenameTok.getLocation());
if (File)
  FileCharacter = std::max(HeaderInfo.getFileDirFlavor(&File->getFileEntry()),
                           FileCharacter);

We aren't doing general-purpose module map search, only extern module maps based on relative or absolute paths. In practice we don't see system and non-system maps referencing each other, so I think anything more complicated isn't really justified. Though if people think we shouldn't propagate IsSystem for absolute paths, I'm fine with that complication.

This revision is now accepted and ready to land.Oct 15 2021, 7:34 AM

Thanks for the review!