Skip to content

Commit d95c83a

Browse files
committed
[clang][modules] Fix modules TS test
1 parent d544d8b commit d95c83a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/lib/Sema/SemaModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc,
269269
// module map defining it already.
270270
if (auto *M = Map.findModule(ModuleName)) {
271271
Diag(Path[0].second, diag::err_module_redefinition) << ModuleName;
272-
if (M->DefinitionLoc.isValid())
272+
if (M->DefinitionLoc.isValid() && !M->IsFromModuleFile)
273273
Diag(M->DefinitionLoc, diag::note_prev_module_definition);
274274
else if (Optional<FileEntryRef> FE = M->getASTFile())
275-
Diag(M->DefinitionLoc, diag::note_prev_module_definition_from_ast_file)
275+
Diag(SourceLocation(), diag::note_prev_module_definition_from_ast_file)
276276
<< FE->getName();
277277
Mod = M;
278278
break;

clang/test/SemaCXX/modules-ts.cppm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ static int m;
1717
#if TEST == 2
1818
// expected-error@-2 {{redefinition of '}}
1919
// expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
20+
// expected-note@-10 {{foo defined here}}
2021
// FIXME: We should drop the "header from" in this diagnostic.
2122
// [email protected]:1 {{'{{.*}}modules-ts.cppm' included multiple times, additional include site in header from module 'foo'}}
2223
#endif
2324
int n;
2425
#if TEST == 2
2526
// expected-error@-2 {{redefinition of '}}
2627
// expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
28+
// expected-note@-18 {{foo defined here}}
2729
// FIXME: We should drop the "header from" in this diagnostic.
2830
// [email protected]:1 {{'{{.*}}modules-ts.cppm' included multiple times, additional include site in header from module 'foo'}}
2931
#endif

0 commit comments

Comments
 (0)