[modules] Don't pass interesting decls to the consumer for a module file that's
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Jul 2016 21:50:09 +0000 (21:50 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Jul 2016 21:50:09 +0000 (21:50 +0000)
commit6c35b2dea457cdcf5360d3ff8caf99868f2666c1
treeec3e1fa70c8c40c5f3c0506c21ecda26d951b3d9
parent765aa2d1c20f273fac60b12832e76466a92444af
[modules] Don't pass interesting decls to the consumer for a module file that's
passed on the command line but never actually used. We consider a (top-level)
module to be used if any part of it is imported, either by the current
translation unit, or by any part of a top-level module that is itself used.

(Put another way, a module is used if an implicit modules build would have
loaded its .pcm file.)

llvm-svn: 275481
clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/Modules/unused-global-init.cpp [new file with mode: 0644]