================
@@ -486,21 +487,24 @@ void ModuleMap::diagnoseHeaderInclusion(Module 
*RequestingModule,
                                         bool RequestingModuleIsModuleInterface,
                                         SourceLocation FilenameLoc,
                                         StringRef Filename, FileEntryRef File) 
{
-  // No errors for indirect modules. This may be a bit of a problem for modules
-  // with no source files.
-  if (getTopLevelOrNull(RequestingModule) != getTopLevelOrNull(SourceModule))
-    return;
-
   if (RequestingModule) {
     resolveUses(RequestingModule, /*Complain=*/false);
     resolveHeaderDirectives(RequestingModule, /*File=*/std::nullopt);
   }
 
+  HeadersMap::iterator Known = findKnownHeader(File);
+
+  diagnoseDuplicateHeaderOwnership(FilenameLoc, Filename, File, Known);
----------------
Bigcheese wrote:

I tested this out and yes we can get duplicate diagnostics, but you also get 
diagnostics that would be otherwise hidden. I'm adding a test of a real case we 
have that requires this to be detected.

Note that this still only triggers one time per header per `CompilerInstance`.

https://github.com/llvm/llvm-project/pull/188538
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to