From f5eedd05db6dd136fd8a4368fe2f9ffd67f696f0 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. llvm-svn: 145811 --- clang/lib/Lex/ModuleMap.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index b20ccd122f5..02848eef6d4 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/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