From 0adaa880993ad23186c87c7f98e7a3fd2697742c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 5 Dec 2011 17:28:06 +0000 Subject: Implement support for wildcard exports in modules, allowing a module to re-export anything that it imports. This opt-in feature makes a module behave more like a header, because it can be used to re-export the transitive closure of a (sub)module's dependencies. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145811 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/ModuleMap.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/Lex/ModuleMap.cpp') diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index b20ccd122f..02848eef6d 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -31,6 +31,12 @@ Module::ExportDecl ModuleMap::resolveExport(Module *Mod, const Module::UnresolvedExportDecl &Unresolved, bool Complain) { + // We may have just a wildcard. + if (Unresolved.Id.empty()) { + assert(Unresolved.Wildcard && "Invalid unresolved export"); + return Module::ExportDecl(0, true); + } + // Find the starting module. Module *Context = lookupModuleUnqualified(Unresolved.Id[0].first, Mod); if (!Context) { @@ -229,7 +235,7 @@ bool ModuleMap::resolveExports(Module *Mod, bool Complain) { for (unsigned I = 0, N = Mod->UnresolvedExports.size(); I != N; ++I) { Module::ExportDecl Export = resolveExport(Mod, Mod->UnresolvedExports[I], Complain); - if (Export.getPointer()) + if (Export.getPointer() || Export.getInt()) Mod->Exports.push_back(Export); else HadError = true; @@ -764,6 +770,7 @@ void ModuleMapParser::parseExportDecl() { if(Tok.is(MMToken::Star)) { Wildcard = true; + consumeToken(); break; } -- cgit v1.2.3-18-g5258