summaryrefslogtreecommitdiff
path: root/clang/include
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2023-05-08 15:59:51 -0700
committerBen Langmuir <blangmuir@apple.com>2023-05-09 13:02:36 -0700
commit5984ea216d2acbe5613b0af06ea27ef395ca9904 (patch)
tree2286c3de9542e6009d5923ffb017ef392ce04c0a /clang/include
parentbb6a1eb003320cdfd4a5887ad2cd8577275c2f95 (diff)
downloadllvm-5984ea216d2acbe5613b0af06ea27ef395ca9904.tar.gz
[clang] Prevent creation of new submodules in ASTWriter
Avoid inferring new submodules for headers in ASTWriter's collection of affecting modulemap files, since we don't want to pick up dependencies that didn't actually exist during parsing. rdar://109112624 Differential Revision: https://reviews.llvm.org/D150151
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Lex/HeaderSearch.h6
-rw-r--r--clang/include/clang/Lex/ModuleMap.h6
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index 76e3e786ff07..49fb99c1483c 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -665,9 +665,13 @@ public:
/// Retrieve all the modules corresponding to the given file.
///
+ /// \param AllowCreation Whether to allow inference of a new submodule, or to
+ /// only return existing known modules.
+ ///
/// \ref findModuleForHeader should typically be used instead of this.
ArrayRef<ModuleMap::KnownHeader>
- findAllModulesForHeader(const FileEntry *File) const;
+ findAllModulesForHeader(const FileEntry *File,
+ bool AllowCreation = true) const;
/// Read the contents of the given module map file.
///
diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index f155c609b06c..8f8580fd1149 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -448,9 +448,13 @@ public:
/// and does not consult the external source. (Those checks are the
/// responsibility of \ref HeaderSearch.)
///
+ /// \param AllowCreation Whether to allow inference of a new submodule, or to
+ /// only return existing known modules.
+ ///
/// Typically, \ref findModuleForHeader should be used instead, as it picks
/// the preferred module for the header.
- ArrayRef<KnownHeader> findAllModulesForHeader(const FileEntry *File);
+ ArrayRef<KnownHeader> findAllModulesForHeader(const FileEntry *File,
+ bool AllowCreation = true);
/// Like \ref findAllModulesForHeader, but do not attempt to infer module
/// ownership from umbrella headers if we've not already done so.