r280159 - [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 30 14:25:42 PDT 2016
Author: bruno
Date: Tue Aug 30 16:25:42 2016
New Revision: 280159
URL: http://llvm.org/viewvc/llvm-project?rev=280159&view=rev
Log:
[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
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
Added:
cfe/trunk/test/Modules/Inputs/GNUAsm/
cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/
cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/
cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
cfe/trunk/test/Modules/requires-gnuinlineasm.m
Modified:
cfe/trunk/docs/Modules.rst
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/Headers/module.modulemap
Modified: cfe/trunk/docs/Modules.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=280159&r1=280158&r2=280159&view=diff
==============================================================================
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Tue Aug 30 16:25:42 2016
@@ -413,6 +413,9 @@ cplusplus
cplusplus11
C++11 support is available.
+gnuinlineasm
+ GNU inline ASM is available.
+
objc
Objective-C support is available.
Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=280159&r1=280158&r2=280159&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Tue Aug 30 16:25:42 2016
@@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature
.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)
Modified: cfe/trunk/lib/Headers/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/module.modulemap?rev=280159&r1=280158&r2=280159&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/module.modulemap (original)
+++ cfe/trunk/lib/Headers/module.modulemap Tue Aug 30 16:25:42 2016
@@ -68,6 +68,7 @@ module _Builtin_intrinsics [system] [ext
}
explicit module cpuid {
+ requires gnuinlineasm
header "cpuid.h"
}
Added: cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h?rev=280159&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h (added)
+++ cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h Tue Aug 30 16:25:42 2016
@@ -0,0 +1 @@
+// NeedsGNUInlineAsm.h
Added: cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h?rev=280159&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h (added)
+++ cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h Tue Aug 30 16:25:42 2016
@@ -0,0 +1 @@
+__asm("foo");
Added: cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map?rev=280159&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map (added)
+++ cfe/trunk/test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map Tue Aug 30 16:25:42 2016
@@ -0,0 +1,8 @@
+framework module NeedsGNUInlineAsm {
+ header "NeedsGNUInlineAsm.h"
+
+ explicit module Asm {
+ requires gnuinlineasm
+ header "asm.h"
+ }
+}
Added: cfe/trunk/test/Modules/requires-gnuinlineasm.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/requires-gnuinlineasm.m?rev=280159&view=auto
==============================================================================
--- cfe/trunk/test/Modules/requires-gnuinlineasm.m (added)
+++ cfe/trunk/test/Modules/requires-gnuinlineasm.m Tue Aug 30 16:25:42 2016
@@ -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
+ at import NeedsGNUInlineAsm.Asm; // expected-error{{module 'NeedsGNUInlineAsm.Asm' requires feature 'gnuinlineasm'}}
+#endif
+
+#ifdef ASM_INLINE
+ at import NeedsGNUInlineAsm.Asm; // expected-no-diagnostics
+#endif
More information about the cfe-commits
mailing list