diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-05-05 05:31:33 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-05-05 05:31:33 +0000 |
commit | 527040e0c87ac8d6cdde46be51c1a93e098bb5fd (patch) | |
tree | afcff5e3af5543aff587f498b4c4ad5fdc6416de /clang/lib/Sema/SemaDecl.cpp | |
parent | d29607871f661c9cde7f60fbf3adeae4fb6d82bc (diff) | |
download | bcm5719-llvm-527040e0c87ac8d6cdde46be51c1a93e098bb5fd.tar.gz bcm5719-llvm-527040e0c87ac8d6cdde46be51c1a93e098bb5fd.zip |
Make module self-import an error
Ideally, importing Foo.a from Foo.b would "do the right thing", but
until it does, this patch makes it an error rather than allow it to
silently be ignored.
llvm-svn: 207948
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 743a8f29439..3ee1577b0ba 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13142,6 +13142,13 @@ DeclResult Sema::ActOnModuleImport(SourceLocation AtLoc, checkModuleImportContext(*this, Mod, ImportLoc, CurContext); + // FIXME: we should support importing a submodule within a different submodule + // of the same top-level module. Until we do, make it an error rather than + // silently ignoring the import. + if (Mod->getTopLevelModuleName() == getLangOpts().CurrentModule) + Diag(ImportLoc, diag::err_module_self_import) + << Mod->getFullModuleName() << getLangOpts().CurrentModule; + SmallVector<SourceLocation, 2> IdentifierLocs; Module *ModCheck = Mod; for (unsigned I = 0, N = Path.size(); I != N; ++I) { |