Skip to content

Commit

Permalink
When making a module visible, also make any of its exported modules
Browse files Browse the repository at this point in the history
visible, allowing one to create modules that import (and then
re-export) other modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145696 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
DougGregor committed Dec 2, 2011
1 parent af13bfc commit 07165b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 12 additions & 0 deletions lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,18 @@ void ASTReader::makeModuleVisible(Module *Mod,
if (!Sub->getValue()->IsExplicit && Visited.insert(Sub->getValue()))
Stack.push_back(Sub->getValue());
}

// Push any exported modules onto the stack to be marked as visible.
for (unsigned I = 0, N = Mod->Exports.size(); I != N; ++I) {
Module *Exported = Mod->Exports[I].getPointer();
if (Visited.insert(Exported)) {
// FIXME: The intent of wildcards is to re-export any imported modules.
// However, we don't yet have the module-dependency information to do
// this, so we ignore wildcards for now.
if (!Mod->Exports[I].getInt())
Stack.push_back(Exported);
}
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions test/Modules/diamond.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

__import_module__ diamond_bottom;

// FIXME: We want 'bottom' to re-export left and right, and both of those to
// re-export 'top'.
__import_module__ diamond_top;
__import_module__ diamond_left;
__import_module__ diamond_right;

void test_diamond(int i, float f, double d, char c) {
top(&i);
left(&f);
Expand Down

0 comments on commit 07165b9

Please sign in to comment.