================
@@ -815,13 +815,16 @@ void Sema::ActOnAnnotModuleEnd(SourceLocation EomLoc, 
Module *Mod) {
   // ImportDecl as we would for an imported module.
   FileID File = getSourceManager().getFileID(EomLoc);
   SourceLocation DirectiveLoc;
-  if (EomLoc == getSourceManager().getLocForEndOfFile(File)) {
+  SourceLocation IncludeLoc = getSourceManager().getIncludeLoc(File);
+  if (EomLoc == getSourceManager().getLocForEndOfFile(File) &&
+      IncludeLoc.isValid()) {
----------------
ArcsinX wrote:

What if we have `#pragma clang module build N`/`#pragma clang module begin N`  
inside a header and include this header from the main file?
It seems that for this case `IncludeLoc.isValid()` is true (for this header 
inclusion). I don't know can this lead to some problems, but maybe we need a 
test for such a case.

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

Reply via email to