diff options
author | Ben Langmuir <blangmuir@apple.com> | 2015-08-13 17:13:33 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2015-08-13 17:13:33 +0000 |
commit | 7ff29148ac7883881e62dc9e1714057c68ad4436 (patch) | |
tree | 54d51d0e2e33fda451999a6f3eeab578c69bad84 /clang/test | |
parent | a7471795ae391a71cd66213300a173bcea9fd672 (diff) | |
download | bcm5719-llvm-7ff29148ac7883881e62dc9e1714057c68ad4436.tar.gz bcm5719-llvm-7ff29148ac7883881e62dc9e1714057c68ad4436.zip |
[Modules] Add Darwin-specific compatibility module map parsing hacks
This preserves backwards compatibility for two hacks in the Darwin
system module map files:
1. The use of 'requires excluded' to make headers non-modular, which
should really be mapped to 'textual' now that we have this feature.
2. Silently removes a bogus cplusplus requirement from IOKit.avc.
Once we start diagnosing missing requirements and headers on
auto-imports these would have broken compatibility with existing Darwin
SDKs.
llvm-svn: 244912
Diffstat (limited to 'clang/test')
4 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/System/usr/include/assert.h b/clang/test/Modules/Inputs/System/usr/include/assert.h new file mode 100644 index 00000000000..844e3790912 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/assert.h @@ -0,0 +1,2 @@ +// assert.h +#define DARWIN_C_EXCLUDED 1 diff --git a/clang/test/Modules/Inputs/System/usr/include/module.map b/clang/test/Modules/Inputs/System/usr/include/module.map index 9b2f3af2bac..1d88ca380f4 100644 --- a/clang/test/Modules/Inputs/System/usr/include/module.map +++ b/clang/test/Modules/Inputs/System/usr/include/module.map @@ -30,3 +30,25 @@ module uses_other_constants { header "uses_other_constants.h" export * } + +module Darwin { + module C { + module excluded { + requires excluded + header "assert.h" + } + } +} + +module Tcl { + module Private { + requires excluded + umbrella "" + } +} + +module IOKit { + module avc { + requires cplusplus + } +} diff --git a/clang/test/Modules/Inputs/System/usr/include/tcl-private/header.h b/clang/test/Modules/Inputs/System/usr/include/tcl-private/header.h new file mode 100644 index 00000000000..0e8fb64a712 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/tcl-private/header.h @@ -0,0 +1,2 @@ +// tcl-private/header.h +#define TCL_PRIVATE 1 diff --git a/clang/test/Modules/darwin_specific_modulemap_hacks.m b/clang/test/Modules/darwin_specific_modulemap_hacks.m new file mode 100644 index 00000000000..82fc6978838 --- /dev/null +++ b/clang/test/Modules/darwin_specific_modulemap_hacks.m @@ -0,0 +1,22 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -isystem %S/Inputs/System/usr/include -triple x86_64-apple-darwin10 %s -verify -fsyntax-only +// expected-no-diagnostics + +@import Darwin.C.excluded; // no error, header is implicitly 'textual' +@import Tcl.Private; // no error, header is implicitly 'textual' +@import IOKit.avc; // no error, cplusplus requirement removed + +#if defined(DARWIN_C_EXCLUDED) +#error assert.h should be textual +#elif defined(TCL_PRIVATE) +#error tcl-private/header.h should be textual +#endif + +#import <assert.h> +#import <tcl-private/header.h> + +#if !defined(DARWIN_C_EXCLUDED) +#error assert.h missing +#elif !defined(TCL_PRIVATE) +#error tcl-private/header.h missing +#endif |