This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Add support for -include flag in flang -fc1
AbandonedPublic

Authored by skatrak on Feb 7 2023, 5:53 AM.

Details

Summary

This patch adds support for the -include flag to include header files before
parsing the input. It should implement the same behavior as the flag with the
same name in clang.

Diff Detail

Event Timeline

skatrak created this revision.Feb 7 2023, 5:53 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added a subscriber: sunshaoce. · View Herald Transcript
skatrak requested review of this revision.Feb 7 2023, 5:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2023, 5:53 AM

In what cases would this flag be used in practice? I've scanned Clang and couldn't find any answers.

In what cases would this flag be used in practice? I've scanned Clang and couldn't find any answers.

+1

In what cases would this flag be used in practice? I've scanned Clang and couldn't find any answers.

It is introduced to the arguments list in Clang::AddPreprocessingOptions in certain cases to add the OpenMP wrapper "__clang_openmp_device_functions.h" to the list of includes for device offload. It seemed likely that we would need to add a similar mechanism eventually to flang as well, although I suppose it could also be useful in other situations.

It is introduced to the arguments list in Clang::AddPreprocessingOptions in certain cases to add the OpenMP wrapper "__clang_openmp_device_functions.h" to the list of includes for device offload.

This is a use case in Clang ;-)

It seemed likely that we would need to add a similar mechanism eventually to flang as well

Possibly, but it's not needed yet?

I would rather refrain from adding flags to Flang only because a similar flag exists in Clang. I suggest abandoning this until there's a clear need for this in Flang.

It is introduced to the arguments list in Clang::AddPreprocessingOptions in certain cases to add the OpenMP wrapper "__clang_openmp_device_functions.h" to the list of includes for device offload.

This is a use case in Clang ;-)

It seemed likely that we would need to add a similar mechanism eventually to flang as well

Possibly, but it's not needed yet?

I would rather refrain from adding flags to Flang only because a similar flag exists in Clang. I suggest abandoning this until there's a clear need for this in Flang.

Sure, sounds reasonable. I suppose this will most likely come together with the rest of changes needed for basic offload then. Thank you!

skatrak abandoned this revision.Feb 9 2023, 7:56 AM