@@ -537,10 +537,10 @@ class ModuleDecl : public DeclContext, public TypeDecl {
537
537
// / \return True if the traversal ran to completion, false if it ended early
538
538
// / due to the callback.
539
539
bool forAllVisibleModules (AccessPathTy topLevelAccessPath,
540
- llvm::function_ref<bool (ImportedModule)> fn);
540
+ llvm::function_ref<bool (ImportedModule)> fn) const ;
541
541
542
542
bool forAllVisibleModules (AccessPathTy topLevelAccessPath,
543
- llvm::function_ref<void (ImportedModule)> fn) {
543
+ llvm::function_ref<void (ImportedModule)> fn) const {
544
544
return forAllVisibleModules (topLevelAccessPath,
545
545
[=](const ImportedModule &import ) -> bool {
546
546
fn (import );
@@ -550,7 +550,7 @@ class ModuleDecl : public DeclContext, public TypeDecl {
550
550
551
551
template <typename Fn>
552
552
bool forAllVisibleModules (AccessPathTy topLevelAccessPath,
553
- Fn &&fn) {
553
+ Fn &&fn) const {
554
554
using RetTy = typename std::result_of<Fn (ImportedModule)>::type;
555
555
llvm::function_ref<RetTy (ImportedModule)> wrapped{std::forward<Fn>(fn)};
556
556
return forAllVisibleModules (topLevelAccessPath, wrapped);
@@ -562,7 +562,7 @@ class ModuleDecl : public DeclContext, public TypeDecl {
562
562
563
563
// / Generate the list of libraries needed to link this module, based on its
564
564
// / imports.
565
- void collectLinkLibraries (LinkLibraryCallback callback);
565
+ void collectLinkLibraries (LinkLibraryCallback callback) const ;
566
566
567
567
// / Returns true if the two access paths contain the same chain of
568
568
// / identifiers.
@@ -826,18 +826,20 @@ class FileUnit : public DeclContext {
826
826
// / \return True if the traversal ran to completion, false if it ended early
827
827
// / due to the callback.
828
828
bool
829
- forAllVisibleModules (llvm::function_ref<bool (ModuleDecl::ImportedModule)> fn);
829
+ forAllVisibleModules (
830
+ llvm::function_ref<bool (ModuleDecl::ImportedModule)> fn) const ;
830
831
831
832
bool
832
- forAllVisibleModules (llvm::function_ref<void (ModuleDecl::ImportedModule)> fn) {
833
+ forAllVisibleModules (
834
+ llvm::function_ref<void (ModuleDecl::ImportedModule)> fn) const {
833
835
return forAllVisibleModules ([=](ModuleDecl::ImportedModule import ) -> bool {
834
836
fn (import );
835
837
return true ;
836
838
});
837
839
}
838
840
839
841
template <typename Fn>
840
- bool forAllVisibleModules (Fn &&fn) {
842
+ bool forAllVisibleModules (Fn &&fn) const {
841
843
using RetTy = typename std::result_of<Fn (ModuleDecl::ImportedModule)>::type;
842
844
llvm::function_ref<RetTy (ModuleDecl::ImportedModule)> wrapped{
843
845
std::forward<Fn>(fn)
0 commit comments