File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -3192,7 +3192,7 @@ bool ASTReader::isConsumerInterestedIn(Decl *D) {
31923192 // emitted when we import the relevant module.
31933193 if (isPartOfPerModuleInitializer (D)) {
31943194 auto *M = D->getImportedOwningModule ();
3195- if (M && M->Kind == Module::ModuleMapModule &&
3195+ if (M && M->isModuleMapModule () &&
31963196 getContext ().DeclMustBeEmitted (D))
31973197 return false ;
31983198 }
Original file line number Diff line number Diff line change 1+ // Check that a definition for a symbol in an unimported submodule is not
2+ // visible for codegen.
3+
4+ // REQUIRES: ondisk_cas
5+
6+ // RUN: rm -rf %t
7+ // RUN: split-file %s %t
8+ // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
9+
10+ // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
11+ // RUN: -cas-path %t/cas -module-files-dir %t/outputs \
12+ // RUN: -format experimental-include-tree-full -mode preprocess-dependency-directives \
13+ // RUN: > %t/deps.json
14+
15+ // RUN: %deps-to-rsp %t/deps.json --module Mod > %t/Mod.rsp
16+ // RUN: %deps-to-rsp %t/deps.json --tu-index 0 > %t/tu.rsp
17+ // RUN: %clang @%t/Mod.rsp
18+ // RUN: %clang @%t/tu.rsp -o - | FileCheck %s
19+
20+ // CHECK-NOT: @record = global
21+ // CHECK: @record = external global
22+
23+ //--- cdb.json.template
24+ [{
25+ "file" : "DIR/tu.c" ,
26+ "directory" : "DIR" ,
27+ "command" : "clang -S -emit-llvm DIR/tu.c -fmodules -fimplicit-modules -fimplicit-module-maps -fmodules-cache-path=DIR/module-cache"
28+ }]
29+
30+ //--- module.modulemap
31+ module Mod {
32+ module A {
33+ header "A.h"
34+ }
35+ explicit module B {
36+ header "B.h"
37+ }
38+ }
39+
40+ //--- A.h
41+ extern int record ;
42+
43+ //--- B.h
44+ int record = 7 ;
45+
46+ //--- tu.c
47+ #include "A.h"
48+ int tu (void ) {
49+ return record ;
50+ }
You can’t perform that action at this time.
0 commit comments