From 38721a95243c9cefae358b2bbe566b0e12e6cba9 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 19 May 2015 19:58:11 +0000 Subject: [PATCH] Revert r237609 for now. glibc's headers use __need_* macros to selectively export parts of themselves to each other. This requires us to enter those files repeatedly when building a glibc module. This can be unreverted once we have a better mechanism to deal with that non-modular aspect of glibc (possibly some way to mark a header as "textual if this macro is defined"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237718 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/PPDirectives.cpp | 9 +++++---- test/Modules/malformed.cpp | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index aaed6b92d4..ec06e790f0 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1737,12 +1737,13 @@ 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. We treat any textual inclusion of a modular - // header as a #import here. + // this file will have no effect. if (ShouldEnter && - !HeaderInfo.ShouldEnterIncludeFile( - *this, File, isImport || SuggestedModule.getModule())) { + !HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport)) { ShouldEnter = false; if (Callbacks) Callbacks->FileSkipped(*File, FilenameTok, FileCharacter); diff --git a/test/Modules/malformed.cpp b/test/Modules/malformed.cpp index 6d49850cce..2d07c4cd0d 100644 --- a/test/Modules/malformed.cpp +++ b/test/Modules/malformed.cpp @@ -23,9 +23,9 @@ // CHECK-B: {{^}}Inputs/malformed/b1.h:1:{{.*}} note: to match this '{' // CHECK-B: {{^}}Inputs/malformed/b1.h:3:{{.*}} error: extraneous closing brace ('}') // -// We don't see another definition of 'g' because we don't re-enter b2.h -// (even though it has no include guards). -// CHECK-B-NOT: redefinition of 'g' +// CHECK-B: While building module 'malformed_b' +// CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} error: redefinition of 'g' +// CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} note: previous definition is here void test() { f(); } // Test that we use relative paths to name files within an imported module. -- 2.40.0