llvm-project/clang/lib/Frontend/Rewrite
Richard Smith 8128f3327f Add support for building modules from preprocessed source.
To support this, an optional marker "#pragma clang module contents" is
recognized in module map files, and the rest of the module map file from that
point onwards is treated as the source of the module. Preprocessing a module
map produces the input module followed by the marker and then the preprocessed
contents of the module.

Ignoring line markers, a preprocessed module might look like this:

  module A {
    header "a.h"
  }
  #pragma clang module contents
  #pragma clang module begin A
  // ... a.h ...
  #pragma clang module end

The preprocessed output generates line markers, which are not accepted by the
module map parser, so -x c++-module-map-cpp-output should be used to compile
such outputs.

A couple of major parts do not work yet:

1) The files that are listed in the module map must exist on disk, in order to
   build the on-disk header -> module lookup table in the PCM file. To fix
   this, we need the preprocessed output to track the file size and other stat
   information we might use to build the lookup table.

2) Declaration ownership semantics don't work properly yet, since mapping from
   a source location to a module relies on mapping from FileIDs to modules,
   which we can't do if module transitions can occur in the middle of a file.

llvm-svn: 302309
2017-05-05 22:18:51 +00:00
..
CMakeLists.txt
FixItRewriter.cpp Roll-back r250822. 2015-10-20 13:23:58 +00:00
FrontendActions.cpp Add support for building modules from preprocessed source. 2017-05-05 22:18:51 +00:00
HTMLPrint.cpp Use StringRef for MemoryBuffer identifier API (NFC) 2016-10-01 16:38:28 +00:00
InclusionRewriter.cpp Add #pragma clang module begin/end pragmas and generate them when preprocessing a module. 2017-05-04 00:29:54 +00:00
RewriteMacros.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
RewriteModernObjC.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
RewriteObjC.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
RewriteTest.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00