This is an archive of the discontinued LLVM Phabricator instance.

[clang] remove SUBMODULE_TOPHEADER
AbandonedPublic

Authored by rmaz on Jan 18 2023, 8:32 AM.

Details

Summary

We are seeing issues with path serialization of the
SUBMODULE_TOPHEADER field when the inputs are links. While working
on a fix I noticed this field does not appear to be used anywhere
outside of libclang. This diff removes the field entirely and
updates the libclang API to always return empty top headers.

Diff Detail

Event Timeline

rmaz created this revision.Jan 18 2023, 8:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 8:32 AM
Herald added a subscriber: arphaman. · View Herald Transcript
rmaz requested review of this revision.Jan 18 2023, 8:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2023, 8:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

@akyrtzi it looks like you added this field a while back. Do you know if there are still consumers for the the libclang API, do we need to keep this field around?

The alternative is to refactor the TopHeaders set to use FileEntryRef so that we can keep track of the correct import names for the headers.

This is useful for functionality, like in an IDE, to show the top headers of a module import for navigational purposes.
Is it reasonable to at least have an alternative implementation for it (e.g. from the module headers find the headers that were not included from other headers), not sure if it'd be straightforward or not.

rmaz added a comment.Jan 18 2023, 12:15 PM

Is it reasonable to at least have an alternative implementation for it (e.g. from the module headers find the headers that were not included from other headers), not sure if it'd be straightforward or not.

Its feasible to refactor by moving the collectModuleHeaderIncludes function to be a method on Module with a callback. Then we could avoid serializing the top header list and call the method in CIndex as well as FrontendAction. I'll take a look at how much work this is.

rmaz abandoned this revision.Jan 19 2023, 6:55 AM

Its going to be less work to refactor TopheaderNames to use FileEntryRef, so went that way instead. First step is here: https://reviews.llvm.org/D142113