diff options
author | David Blaikie <dblaikie@gmail.com> | 2019-05-07 21:38:51 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2019-05-07 21:38:51 +0000 |
commit | 89e58ddb2868bfb84c082b1a7ac07faf8c3bbca7 (patch) | |
tree | b832a5e0d53e45802b665598f215c8235caeab93 /clang/lib/Basic/Module.cpp | |
parent | 2b09b25e486834634db5eb200fe48576525b4c7d (diff) | |
download | llvm-89e58ddb2868bfb84c082b1a7ac07faf8c3bbca7.zip llvm-89e58ddb2868bfb84c082b1a7ac07faf8c3bbca7.tar.gz llvm-89e58ddb2868bfb84c082b1a7ac07faf8c3bbca7.tar.bz2 |
-frewrite-imports: Add support for wildcard rules in umbrella modules with
This trips over a few other limitations, but in the interests of incremental development I'm starting here & I'll look at the issues with -verify and filesystem checks (the fact that the behavior depends on the existence of a 'foo' directory even though it shouldn't need it), etc.
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D61656
llvm-svn: 360195
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index b405ab6..f394f26 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -321,6 +321,21 @@ Module *Module::findSubmodule(StringRef Name) const { return SubModules[Pos->getValue()]; } +Module *Module::findOrInferSubmodule(StringRef Name) { + llvm::StringMap<unsigned>::const_iterator Pos = SubModuleIndex.find(Name); + if (Pos != SubModuleIndex.end()) + return SubModules[Pos->getValue()]; + if (!InferSubmodules) + return nullptr; + Module *Result = new Module(Name, SourceLocation(), this, false, InferExplicitSubmodules, 0); + Result->InferExplicitSubmodules = InferExplicitSubmodules; + Result->InferSubmodules = InferSubmodules; + Result->InferExportWildcard = InferExportWildcard; + if (Result->InferExportWildcard) + Result->Exports.push_back(Module::ExportDecl(nullptr, true)); + return Result; +} + void Module::getExportedModules(SmallVectorImpl<Module *> &Exported) const { // All non-explicit submodules are exported. for (std::vector<Module *>::const_iterator I = SubModules.begin(), |