]> granicus.if.org Git - clang/commit
Module use declarations (II)
authorDaniel Jasper <djasper@google.com>
Tue, 24 Sep 2013 09:14:14 +0000 (09:14 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 24 Sep 2013 09:14:14 +0000 (09:14 +0000)
commitddd2dfc1d3f4a36cbe8cd775c588623a17049f9f
tree99fe31428c47f0d77c5cf9cc45c6ab33fdbaaeab
parentfc12c4aa20876bdf91bff98dc50eb68b4dd04b80
Module use declarations (II)

Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

  use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191283 91177308-0d34-0410-b5e6-96231b3b80d8
29 files changed:
docs/Modules.rst
include/clang/Basic/DiagnosticLexKinds.td
include/clang/Basic/LangOptions.def
include/clang/Basic/Module.h
include/clang/Driver/Options.td
include/clang/Lex/ModuleMap.h
include/clang/Lex/Preprocessor.h
lib/Basic/Module.cpp
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Lex/HeaderSearch.cpp
lib/Lex/ModuleMap.cpp
lib/Lex/PPDirectives.cpp
lib/Sema/Sema.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/Modules/Inputs/declare-use/a.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/b.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/c.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/d.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/e.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/f.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/g.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/g1.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/h.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/h1.h [new file with mode: 0644]
test/Modules/Inputs/declare-use/module.map [new file with mode: 0644]
test/Modules/declare-use1.cpp [new file with mode: 0644]
test/Modules/declare-use2.cpp [new file with mode: 0644]