diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-08 17:13:11 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-08 17:13:11 +0000 |
commit | 0a5fb09b599c1bdea3cd11168bb8f4ff4040316e (patch) | |
tree | 5e94367d1a8032322c6871cfe16714c0982fd61a /lib/Frontend/Rewrite/FrontendActions.cpp | |
parent | f0c0337bbfb63d1f9edf145aab535bdf82c20454 (diff) |
Diffstat (limited to 'lib/Frontend/Rewrite/FrontendActions.cpp')
-rw-r--r-- | lib/Frontend/Rewrite/FrontendActions.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Frontend/Rewrite/FrontendActions.cpp b/lib/Frontend/Rewrite/FrontendActions.cpp index 2e76e2e3151e..8c5eb161b5ab 100644 --- a/lib/Frontend/Rewrite/FrontendActions.cpp +++ b/lib/Frontend/Rewrite/FrontendActions.cpp @@ -196,6 +196,18 @@ void RewriteIncludesAction::ExecuteAction() { CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; + // If we're preprocessing a module map, start by dumping the contents of the + // module itself before switching to the input buffer. + auto &Input = getCurrentInput(); + if (Input.getKind().getFormat() == InputKind::ModuleMap) { + if (Input.isFile()) + (*OS) << "# 1 \"" << Input.getFile() << "\"\n"; + // FIXME: Include additional information here so that we don't need the + // original source files to exist on disk. + getCurrentModule()->print(*OS); + (*OS) << "#pragma clang module contents\n"; + } + RewriteIncludesInInput(CI.getPreprocessor(), OS.get(), CI.getPreprocessorOutputOpts()); } |