Skip to content

Commit 5b202ef

Browse files
authored
Merge pull request #8745 from cachemeifyoucan/eng/PR-127615714-swift-6.0
[6.0][IncludeTree] Don't callback on visibility only modules
2 parents 76e0c40 + 143ef0f commit 5b202ef

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

clang/lib/Lex/PPDirectives.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,16 +2093,16 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
20932093
/*IsIncludeDirective=*/true);
20942094
if (!CheckLoadResult(Imported))
20952095
return;
2096+
// PPCallback for IncludeDirective. Using the AST file as the FileEntry
2097+
// in the callback to indicate this is not a missing header. Note this
2098+
// is not the same behavior as non-include-tree build where the
2099+
// FileEntry is for the header file.
2100+
// FIXME: Need to clarify what `File` means in the callback, and if that
2101+
// can be the module file entry instead of header file entry.
2102+
Module *M = Imported;
2103+
InclusionCallback(M->getASTFile(), Imported);
20962104
}
20972105

2098-
// PPCallback for IncludeDirective. Using the AST file as the FileEntry in
2099-
// the callback to indicate this is not a missing header. Note this is not
2100-
// the same behavior as non-include-tree build where the FileEntry is for
2101-
// the header file.
2102-
// FIXME: Need to clarify what `File` means in the callback, and if that
2103-
// can be the module file entry instead of header file entry.
2104-
Module *M = Imported;
2105-
InclusionCallback(M->getASTFile(), Imported);
21062106
makeModuleVisible(Imported, EndLoc);
21072107
if (IncludeTok.getIdentifierInfo()->getPPKeywordID() !=
21082108
tok::pp___include_macros)

clang/test/ClangScanDeps/modules-include-tree-implementation-private.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
// RUN: cat %t/tu.rsp | sed -E 's|.*"-fcas-include-tree" "(llvmcas://[[:xdigit:]]+)".*|\1|' > %t/tu.casid
1717
// RUN: clang-cas-test -cas %t/cas -print-include-tree @%t/tu.casid | FileCheck %s -DPREFIX=%/t
1818
// RUN: %clang @%t/tu.rsp
19+
//
20+
// RUN: FileCheck %s -input-file=%t/tu.d -check-prefix DEPS
21+
22+
// DEPS: dependencies:
23+
// DEPS-DAG: tu.m
24+
// DEPS-DAG: Mod.h
25+
// DEPS-DAG: Priv.h
1926

2027
// CHECK: [[PREFIX]]/tu.m llvmcas://
2128
// CHECK: 1:1 <built-in> llvmcas://
@@ -43,7 +50,7 @@
4350
[{
4451
"file": "DIR/tu.m",
4552
"directory": "DIR",
46-
"command": "clang -fsyntax-only DIR/tu.m -F DIR -fmodule-name=Mod -fmodules -fimplicit-modules -fimplicit-module-maps -fmodules-cache-path=DIR/module-cache"
53+
"command": "clang -fsyntax-only DIR/tu.m -F DIR -fmodule-name=Mod -fmodules -fimplicit-modules -fimplicit-module-maps -fmodules-cache-path=DIR/module-cache -MMD -MT dependencies -MF DIR/tu.d"
4754
}]
4855

4956
//--- Mod.framework/Modules/module.modulemap

0 commit comments

Comments
 (0)