If a module A exports a macro M, and a module B imports that macro and #undef's
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 1 Mar 2014 00:08:04 +0000 (00:08 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 1 Mar 2014 00:08:04 +0000 (00:08 +0000)
commit49f906a36fdad83a9935d6f1815d620a7d0bf57a
tree8cd2c4e93b4c73e04c2af692c044eadb55c809ca
parent49133948a96617a67631c59d3158a8aa3463136c
If a module A exports a macro M, and a module B imports that macro and #undef's
it, importers of B should not see the macro. This is complicated by the fact
that A's macro could also be visible through a different path. The rules (as
hashed out on cfe-commits) are included as a documentation update in this
change.

With this, the number of regressions in libc++'s testsuite when modules are
enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are
due to remaining bugs in this change (in particular, the handling of submodules
is imperfect).

llvm-svn: 202560
17 files changed:
clang/docs/Modules.rst
clang/include/clang/Basic/Module.h
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/Module.h
clang/lib/Lex/MacroInfo.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Modules/Inputs/macros_other.h
clang/test/Modules/Inputs/macros_right.h
clang/test/Modules/Inputs/macros_right_undef.h
clang/test/Modules/Inputs/macros_top.h
clang/test/Modules/Inputs/module.map
clang/test/Modules/macros.c
clang/test/Modules/macros2.c [new file with mode: 0644]
clang/test/PCH/macro-undef.cpp [new file with mode: 0644]