]> granicus.if.org Git - clang/commit
Warning for framework include violation from Headers to PrivateHeaders
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 25 Jun 2018 22:24:17 +0000 (22:24 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 25 Jun 2018 22:24:17 +0000 (22:24 +0000)
commit50ebf26c30b297dbea9c20d993415b13f27b0300
tree46d9206e5b77b309cef4d6f804cca5b32be48c77
parentf479c70eb4f9546892e1bfc84b34fa54c8f6070e
Warning for framework include violation from Headers to PrivateHeaders

Framework vendors usually layout their framework headers in the
following way:

Foo.framework/Headers -> "public" headers
Foo.framework/PrivateHeader -> "private" headers

Since both headers in both directories can be found with #import
<Foo/some-header.h>, it's easy to make mistakes and include headers in
Foo.framework/PrivateHeader from headers in Foo.framework/Headers, which
usually configures a layering violation on Darwin ecosystems. One of the
problem this causes is dep cycles when modules are used, since it's very
common for "private" modules to include from the "public" ones; adding
an edge the other way around will trigger cycles.

Add a warning to catch those cases such that:

./A.framework/Headers/A.h:1:10: warning: public framework header includes private framework header 'A/APriv.h'
#include <A/APriv.h>
         ^

rdar://problem/38712182

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335542 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticLexKinds.td
lib/Lex/HeaderSearch.cpp
test/Modules/Inputs/framework-public-includes-private/A.framework/Headers/A.h [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/A.framework/Modules/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/A.framework/Modules/module.private.modulemap [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/A.framework/PrivateHeaders/APriv.h [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/A.framework/PrivateHeaders/APriv2.h [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/a.hmap.json [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.h [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.modulemap [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/flat-header-path/Z.private.modulemap [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/flat-header-path/ZPriv.h [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/z.hmap.json [new file with mode: 0644]
test/Modules/Inputs/framework-public-includes-private/z.yaml [new file with mode: 0644]
test/Modules/framework-public-includes-private.m [new file with mode: 0644]