[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.

llvm-svn: 291794
This commit is contained in:
Bruno Cardoso Lopes 2017-01-12 19:15:33 +00:00
parent 45337df08f
commit 052d95a6d6
7 changed files with 52 additions and 2 deletions

View File

@ -446,10 +446,20 @@ ModuleMap::isHeaderUnavailableInModule(const FileEntry *Header,
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;
}

View File

@ -0,0 +1,12 @@
framework module FooFramework {
umbrella header "FooUmbrella.h"
export *
module * {
export *
}
explicit module Private {
textual header "Baz_Private.h"
}
}

View File

@ -0,0 +1,2 @@
@interface Bar
@end

View File

@ -0,0 +1,3 @@
#ifndef Baz_h
#define Baz_h
#endif /* Baz_h */

View File

@ -0,0 +1,10 @@
__attribute__((objc_root_class))
@interface NSObject
+ (instancetype) alloc;
- (instancetype) init;
- (instancetype)retain;
- (void)release;
@end
@interface Foo : NSObject
@end

View File

@ -0,0 +1,3 @@
#import <FooFramework/Foo.h>
#import <FooFramework/Bar.h>

View File

@ -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>
@implementation Foo
@end