[PATCH] D70063: clang/Modules: Error if ReadASTBlock does not find the main module

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 17:04:46 PST 2019


bruno added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSerializationKinds.td:78
+def err_module_file_missing_definition : Error<
+  "module file '%0' is missing the main module's definition">, DefaultFatal;
 
----------------
aprantl wrote:
> Should this be `AST file` like in the above error message?
+1


================
Comment at: clang/lib/Serialization/ASTReader.cpp:5503
 
+        F.DidReadMainModule = true;
         CurrentModule->setASTFile(F.File);
----------------
Is this enough? Because this is done at the end of `SUBMODULE_DEFINITION`, could it be that only some of the submodules were read (top level or not) and this is still going to be true? I wonder if marking this `true` at the end of successful `SUBMODULE_BLOCK` instead wouldn't be a better option.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70063/new/

https://reviews.llvm.org/D70063





More information about the cfe-commits mailing list