ModuleIdPath Path,
Module::NameVisibilityKind Visibility,
bool IsInclusionDirective) {
+ // Determine what file we're searching from.
+ StringRef ModuleName = Path[0].first->getName();
+ SourceLocation ModuleNameLoc = Path[0].second;
+
// If we've already handled this import, just return the cached result.
// This one-element cache is important to eliminate redundant diagnostics
// when both the preprocessor and parser see the same import declaration.
if (!ImportLoc.isInvalid() && LastModuleImportLoc == ImportLoc) {
// Make the named module visible.
- if (LastModuleImportResult)
+ if (LastModuleImportResult && ModuleName != getLangOpts().CurrentModule)
ModuleManager->makeModuleVisible(LastModuleImportResult, Visibility,
ImportLoc, /*Complain=*/false);
return LastModuleImportResult;
}
-
- // Determine what file we're searching from.
- StringRef ModuleName = Path[0].first->getName();
- SourceLocation ModuleNameLoc = Path[0].second;
clang::Module *Module = 0;
-
+
// If we don't already have information on this module, load the module now.
llvm::DenseMap<const IdentifierInfo *, clang::Module *>::iterator Known
= KnownModules.find(Path[0].first);
--- /dev/null
+@import import_self.c;
+#include "import-self-d.h"
+
+// FIXME: This should not work; names from 'a' should not be visible here.
+MyTypeA import_self_test_a;
+
+// FIXME: This should work but does not; names from 'b' are not actually visible here.
+//MyTypeC import_self_test_c;
+
+MyTypeD import_self_test_d;
module type_traits { header "type_traits.h" }
explicit module hash_map { header "hash_map.h" }
}
+
+module import_self {
+ module a { header "import-self-a.h" }
+ module b { header "import-self-b.h" export * }
+ module c { header "import-self-c.h" }
+ module d { header "import-self-d.h" }
+}
hash_map<int, float> ints_to_floats2;
+@import import_self.b;
+extern MyTypeA import_self_test_a; // expected-error {{must be imported from module 'import_self.a'}}
+// expected-note@import-self-a.h:1 {{here}}
+extern MyTypeC import_self_test_c;
+// FIXME: This should be valid; import_self.b re-exports import_self.d.
+extern MyTypeD import_self_test_d; // expected-error {{must be imported from module 'import_self.d'}}
+// expected-note@import-self-d.h:1 {{here}}