summaryrefslogtreecommitdiffstats
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-30 19:06:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-30 19:06:26 +0000
commit3ec1cdd422ec49d2a54ebc1a94d3d80ee57031c0 (patch)
tree752b7eaace6be1e57c24a364f5c9d5bf4b0ca5ee /lib/Parse/Parser.cpp
parent0c25e2545416359c181e3486ea7000fc63cdabb9 (diff)
Unrevert r280035 now that the clang-cl bug it exposed has been fixed by
r280133. Original commit message: C++ Modules TS: driver support for building modules. This works as follows: we add --precompile to the existing gamut of options for specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag specifies that an input is taken to the precompilation step and no further, and this can be specified when building a .pcm from a module interface or when building a .pch from a header file. The .cppm extension (and some related extensions) are implicitly recognized as C++ module interface files. If --precompile is /not/ specified, the file is compiled (via a .pcm) to a .o file containing the code for the module (and then potentially also assembled and linked, if -S, -c, etc. are not specified). We do not yet suppress the emission of object code for other users of the module interface, so for now this will only work if everything in the .cppm file has vague linkage. As with the existing support for module-map modules, prebuilt modules can be provided as compiler inputs either via the -fmodule-file= command-line argument or via files named ModuleName.pcm in one of the directories specified via -fprebuilt-module-path=. This also exposes the -fmodules-ts cc1 flag in the driver. This is still experimental, and in particular, the concrete syntax is subject to change as the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does not enable support for implicitly loading module maps nor building modules via the module cache, but those features can be turned on separately and used in conjunction with the Modules TS support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index e58e3f7c20..0bc4680e78 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -546,7 +546,13 @@ bool Parser::ParseFirstTopLevelDecl(DeclGroupPtrTy &Result) {
return false;
} else if (getLangOpts().getCompilingModule() ==
LangOptions::CMK_ModuleInterface) {
- Diag(Tok, diag::err_expected_module_interface_decl);
+ // FIXME: We avoid providing this diagnostic when generating an object file
+ // from an existing PCM file. This is not a good way to detect this
+ // condition; we should provide a mechanism to indicate whether we've
+ // already parsed a declaration in this translation unit and avoid calling
+ // ParseFirstTopLevelDecl in that case.
+ if (Actions.TUKind == TU_Module)
+ Diag(Tok, diag::err_expected_module_interface_decl);
}
// C11 6.9p1 says translation units must have at least one top-level