[PATCH] D10423: [modules] PR20507: Avoid silent textual inclusion.

Richard Smith richard at metafoo.co.uk
Mon Jul 20 15:04:49 PDT 2015


rsmith added inline comments.

================
Comment at: lib/Lex/PPDirectives.cpp:1680-1698
@@ +1679,21 @@
+    // unavailable, diagnose the situation and bail out.
+    if (!SuggestedModule.getModule()->isAvailable()) {
+      clang::Module::Requirement Requirement;
+      clang::Module::UnresolvedHeaderDirective MissingHeader;
+      Module *M = SuggestedModule.getModule();
+      // Identify the cause.
+      (void)M->isAvailable(getLangOpts(), getTargetInfo(), Requirement,
+                           MissingHeader);
+      if (MissingHeader.FileNameLoc.isValid()) {
+        Diag(MissingHeader.FileNameLoc, diag::err_module_header_missing)
+            << MissingHeader.IsUmbrella << MissingHeader.FileName;
+      } else {
+        Diag(M->DefinitionLoc, diag::err_module_unavailable)
+            << M->getFullModuleName() << Requirement.second << Requirement.first;
+      }
+      Diag(FilenameTok.getLocation(),
+           diag::note_implicit_top_level_module_import_here)
+          << M->getTopLevelModuleName();
+      return;
+    }
+
----------------
The call to `loadModule` a few lines below already does this. Is this change necessary?


http://reviews.llvm.org/D10423







More information about the cfe-commits mailing list