summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2018-04-20 17:16:04 +0000
committerJordan Rose <jordan_rose@apple.com>2018-04-20 17:16:04 +0000
commit90b0a1fc58cc0987d748eb02ecadee743d2efd97 (patch)
treeace16dfbdb2202ed58adf3d5363cf0c1a3f18126 /clang/lib/Lex/ModuleMap.cpp
parent42b2a0e162933d3d942c3dc259344bea67d489ad (diff)
downloadbcm5719-llvm-90b0a1fc58cc0987d748eb02ecadee743d2efd97.tar.gz
bcm5719-llvm-90b0a1fc58cc0987d748eb02ecadee743d2efd97.zip
Record whether a module came from a private module map
Right now we only use this information in one place, immediately after we calculate it, but it's still nice information to have. The Swift project is going to use this to tidy up its "API notes" feature (see past discussion on cfe-dev that never quite converged). Reviewed by Bruno Cardoso Lopes. llvm-svn: 330452
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index e47abd50f17..e29cc692eae 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1891,20 +1891,23 @@ void ModuleMapParser::parseModuleDecl() {
ActiveModule->NoUndeclaredIncludes = true;
ActiveModule->Directory = Directory;
+ StringRef MapFileName(ModuleMapFile->getName());
+ if (MapFileName.endswith("module.private.modulemap") ||
+ MapFileName.endswith("module_private.map")) {
+ ActiveModule->ModuleMapIsPrivate = true;
+ }
// Private modules named as FooPrivate, Foo.Private or similar are likely a
// user error; provide warnings, notes and fixits to direct users to use
// Foo_Private instead.
SourceLocation StartLoc =
SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());
- StringRef MapFileName(ModuleMapFile->getName());
if (Map.HeaderInfo.getHeaderSearchOpts().ImplicitModuleMaps &&
!Diags.isIgnored(diag::warn_mmap_mismatched_private_submodule,
StartLoc) &&
!Diags.isIgnored(diag::warn_mmap_mismatched_private_module_name,
StartLoc) &&
- (MapFileName.endswith("module.private.modulemap") ||
- MapFileName.endswith("module_private.map")))
+ ActiveModule->ModuleMapIsPrivate)
diagnosePrivateModules(Map, Diags, ActiveModule, LastInlineParentLoc);
bool Done = false;
OpenPOWER on IntegriCloud