Commit Graph

3 Commits

Author SHA1 Message Date
Richard Smith ee60c74826 Add pragma to perform module import and use it in -E output.
Many of our supported configurations support modules but do not have any
first-class syntax to perform a module import. This leaves us with a problem:
there is no way to represent the expansion of a #include that imports a module
in the -E output for such languages. (We don't want to just leave it as a
#include because that requires the consumer of the preprocessed source to have
the same file system layout and include paths as the creator.)

This patch adds a new pragma:

  #pragma clang module import MODULE.NAME.HERE

that imports a module, and changes -E and -frewrite-includes to use it when
rewriting a #include that maps to a module import. We don't make any attempt
to use a native language syntax import if one exists, to get more consistent
output. (If in the future, @import and #include have different semantics in
some way, the pragma will track the #include semantics.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301725 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-29 00:34:47 +00:00
Richard Smith 7249d7283d [modules] Add a comment to explain why -E leaves some #includes in the preprocessed output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265766 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 01:23:59 +00:00
Richard Smith 1160cb7def [modules] Don't write @import in -E output if the current language mode doesn't
support @import; use the form as written instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 00:09:53 +00:00