[PATCH] D23905: [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 25 19:37:37 PDT 2016
bruno created this revision.
bruno added a reviewer: rsmith.
bruno added subscribers: cfe-commits, eladcohen.
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
https://reviews.llvm.org/D23905
Files:
docs/Modules.rst
lib/Basic/Module.cpp
lib/Headers/module.modulemap
test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h
test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h
test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
test/Modules/requires-gnuasminline.m
Index: test/Modules/requires-gnuasminline.m
===================================================================
--- /dev/null
+++ test/Modules/requires-gnuasminline.m
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules \
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
+// RUN: -fno-gnu-inline-asm -verify
+
+ at import NeedsGNUAsmInline.Asm; // expected-error{{module 'NeedsGNUAsmInline.Asm' requires feature 'gnuasminline'}}
Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
===================================================================
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
@@ -0,0 +1,8 @@
+framework module NeedsGNUAsmInline {
+ header "NeedsGNUAsmInline.h"
+
+ explicit module Asm {
+ requires gnuasminline
+ header "asm.h"
+ }
+}
Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h
@@ -0,0 +1 @@
+__asm("foo");
Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h
@@ -0,0 +1 @@
+// NeedsGNUAsmInline.h
Index: lib/Headers/module.modulemap
===================================================================
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -68,6 +68,7 @@
}
explicit module cpuid {
+ requires gnuinlineasm
header "cpuid.h"
}
Index: lib/Basic/Module.cpp
===================================================================
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
.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)
Index: docs/Modules.rst
===================================================================
--- docs/Modules.rst
+++ docs/Modules.rst
@@ -413,6 +413,9 @@
cplusplus11
C++11 support is available.
+gnuinlineasm
+ GNU inline ASM is available.
+
objc
Objective-C support is available.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23905.69313.patch
Type: text/x-patch
Size: 2624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160826/0ea46f42/attachment-0001.bin>
More information about the cfe-commits
mailing list