This adds support for modules that require (no-)gnu-inline-asm
environment, such as the compiler builtin cpuid submodule.
This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871
Differential Revision: https://reviews.llvm.org/D23905
rdar://problem/
26931199
llvm-svn: 280159
cplusplus11
C++11 support is available.
+gnuinlineasm
+ GNU inline ASM is available.
+
objc
Objective-C support is available.
.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)
}
explicit module cpuid {
+ requires gnuinlineasm
header "cpuid.h"
}
--- /dev/null
+// NeedsGNUInlineAsm.h
--- /dev/null
+__asm("foo");
--- /dev/null
+framework module NeedsGNUInlineAsm {
+ header "NeedsGNUInlineAsm.h"
+
+ explicit module Asm {
+ requires gnuinlineasm
+ header "asm.h"
+ }
+}
--- /dev/null
+// 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