diff options
7 files changed, 31 insertions, 0 deletions
diff --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst index 418765468c2..e11145ed71c 100644 --- a/clang/docs/Modules.rst +++ b/clang/docs/Modules.rst @@ -413,6 +413,9 @@ cplusplus cplusplus11 C++11 support is available. +gnuinlineasm + GNU inline ASM is available. + objc Objective-C support is available. diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 3d1a40db5ea..b37deb12228 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, .Case("blocks", LangOpts.Blocks) .Case("cplusplus", LangOpts.CPlusPlus) .Case("cplusplus11", LangOpts.CPlusPlus11) + .Case("gnuinlineasm", LangOpts.GNUAsm) .Case("objc", LangOpts.ObjC1) .Case("objc_arc", LangOpts.ObjCAutoRefCount) .Case("opencl", LangOpts.OpenCL) diff --git a/clang/lib/Headers/module.modulemap b/clang/lib/Headers/module.modulemap index 3e40d2c08d8..4654b3de298 100644 --- a/clang/lib/Headers/module.modulemap +++ b/clang/lib/Headers/module.modulemap @@ -68,6 +68,7 @@ module _Builtin_intrinsics [system] [extern_c] { } explicit module cpuid { + requires gnuinlineasm header "cpuid.h" } diff --git a/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h new file mode 100644 index 00000000000..7978a767e63 --- /dev/null +++ b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h @@ -0,0 +1 @@ +// NeedsGNUInlineAsm.h diff --git a/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h new file mode 100644 index 00000000000..da52f829c37 --- /dev/null +++ b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h @@ -0,0 +1 @@ +__asm("foo"); diff --git a/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map new file mode 100644 index 00000000000..a9536100d61 --- /dev/null +++ b/clang/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map @@ -0,0 +1,8 @@ +framework module NeedsGNUInlineAsm { + header "NeedsGNUInlineAsm.h" + + explicit module Asm { + requires gnuinlineasm + header "asm.h" + } +} diff --git a/clang/test/Modules/requires-gnuinlineasm.m b/clang/test/Modules/requires-gnuinlineasm.m new file mode 100644 index 00000000000..80b1b18d074 --- /dev/null +++ b/clang/test/Modules/requires-gnuinlineasm.m @@ -0,0 +1,16 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \ +// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \ +// RUN: -fno-gnu-inline-asm -DNO_ASM_INLINE -verify +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \ +// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \ +// RUN: -DASM_INLINE -verify + +#ifdef NO_ASM_INLINE +@import NeedsGNUInlineAsm.Asm; // expected-error{{module 'NeedsGNUInlineAsm.Asm' requires feature 'gnuinlineasm'}} +#endif + +#ifdef ASM_INLINE +@import NeedsGNUInlineAsm.Asm; // expected-no-diagnostics +#endif |