r291794 - [Modules] Fix misleading warning about missing textual header in umbrella header
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 11:15:33 PST 2017
Author: bruno
Date: Thu Jan 12 13:15:33 2017
New Revision: 291794
URL: http://llvm.org/viewvc/llvm-project?rev=291794&view=rev
Log:
[Modules] Fix misleading warning about missing textual header in umbrella header
When a textual header is present inside a umbrella dir but not in the
header, we get the misleading warning:
warning: umbrella header for module 'FooFramework' does not include
header 'Baz_Private.h'
The module map in question:
framework module FooFramework {
umbrella header "FooUmbrella.h"
export *
module * { export * }
module Private {
textual header "Baz_Private.h"
}
}
Fix this by taking textual headers into account.
Added:
cfe/trunk/test/Modules/Inputs/FooFramework.framework/
cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/
cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap
cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/
cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h
cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h
cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h
cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h
cfe/trunk/test/Modules/textual-hdr-in-umbrella-hdr.m
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=291794&r1=291793&r2=291794&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Thu Jan 12 13:15:33 2017
@@ -446,9 +446,19 @@ ModuleMap::isHeaderUnavailableInModule(c
I = Known->second.begin(),
E = Known->second.end();
I != E; ++I) {
- if (I->isAvailable() && (!RequestingModule ||
- I->getModule()->isSubModuleOf(RequestingModule)))
+
+ if (I->isAvailable() &&
+ (!RequestingModule ||
+ I->getModule()->isSubModuleOf(RequestingModule))) {
+ // When no requesting module is available, the caller is looking if a
+ // header is part a module by only looking into the module map. This is
+ // done by warn_uncovered_module_header checks; don't consider textual
+ // headers part of it in this mode, otherwise we get misleading warnings
+ // that a umbrella header is not including a textual header.
+ if (!RequestingModule && I->getRole() == ModuleMap::TextualHeader)
+ continue;
return false;
+ }
}
return true;
}
Added: cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap Thu Jan 12 13:15:33 2017
@@ -0,0 +1,12 @@
+framework module FooFramework {
+ umbrella header "FooUmbrella.h"
+
+ export *
+ module * {
+ export *
+ }
+
+ explicit module Private {
+ textual header "Baz_Private.h"
+ }
+}
Added: cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h (added)
+++ cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h Thu Jan 12 13:15:33 2017
@@ -0,0 +1,2 @@
+ at interface Bar
+ at end
Added: cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h (added)
+++ cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h Thu Jan 12 13:15:33 2017
@@ -0,0 +1,3 @@
+#ifndef Baz_h
+#define Baz_h
+#endif /* Baz_h */
Added: cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h (added)
+++ cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h Thu Jan 12 13:15:33 2017
@@ -0,0 +1,10 @@
+__attribute__((objc_root_class))
+ at interface NSObject
++ (instancetype) alloc;
+- (instancetype) init;
+- (instancetype)retain;
+- (void)release;
+ at end
+
+ at interface Foo : NSObject
+ at end
Added: cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h (added)
+++ cfe/trunk/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h Thu Jan 12 13:15:33 2017
@@ -0,0 +1,3 @@
+#import <FooFramework/Foo.h>
+#import <FooFramework/Bar.h>
+
Added: cfe/trunk/test/Modules/textual-hdr-in-umbrella-hdr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/textual-hdr-in-umbrella-hdr.m?rev=291794&view=auto
==============================================================================
--- cfe/trunk/test/Modules/textual-hdr-in-umbrella-hdr.m (added)
+++ cfe/trunk/test/Modules/textual-hdr-in-umbrella-hdr.m Thu Jan 12 13:15:33 2017
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t.cache
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.cache \
+// RUN: %s -fsyntax-only -F %S/Inputs -Wincomplete-umbrella -verify
+
+// expected-no-diagnostics
+
+#import <FooFramework/Foo.h>
+
+ at implementation Foo
+ at end
More information about the cfe-commits
mailing list