diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-18 20:02:41 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-18 20:02:41 +0000 |
commit | 2d4a11fba6a55fa0fc2b552ec082a4ea74dfbddf (patch) | |
tree | 8dcf3eed199b22bb463c768878fa5af264e5bcaf /clang/lib/Lex/PPDirectives.cpp | |
parent | e5768d1717a354531f00062fdaf5d1dfbbedf12b (diff) | |
download | bcm5719-llvm-2d4a11fba6a55fa0fc2b552ec082a4ea74dfbddf.tar.gz bcm5719-llvm-2d4a11fba6a55fa0fc2b552ec082a4ea74dfbddf.zip |
[modules] When a file is listed as a non-textual header in a module map, don't
enter it more than once, even if it doesn't have #include guards -- we already
know that it is intended to have the same effect every time it's included, and
it's already had that effect. This particularly helps with local submodule
visibility builds, where the include guard macro may not be visible in the
includer, but will become visible the moment we enter the included file.
llvm-svn: 237609
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index ec06e790f01..aaed6b92d48 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1737,13 +1737,12 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, std::max(HeaderInfo.getFileDirFlavor(File), SourceMgr.getFileCharacteristic(FilenameTok.getLocation())); - // FIXME: If we have a suggested module, and we've already visited this file, - // don't bother entering it again. We know it has no further effect. - // Ask HeaderInfo if we should enter this #include file. If not, #including - // this file will have no effect. + // this file will have no effect. We treat any textual inclusion of a modular + // header as a #import here. if (ShouldEnter && - !HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport)) { + !HeaderInfo.ShouldEnterIncludeFile( + *this, File, isImport || SuggestedModule.getModule())) { ShouldEnter = false; if (Callbacks) Callbacks->FileSkipped(*File, FilenameTok, FileCharacter); |