<div><div class="gmail_extra"><div class="gmail_quote">On 25 Aug 2016 7:37 p.m., "Bruno Cardoso Lopes" <<a href="mailto:bruno.cardoso@gmail.com">bruno.cardoso@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">bruno created this revision.<br>
bruno added a reviewer: rsmith.<br>
bruno added subscribers: cfe-commits, eladcohen.<br>
<br>
This adds support for modules that require (no-)gnu-inline-asm<br>
environment, such as the compiler builtin cpuid submodule.<br>
<br>
This is the gnu-inline-asm variant of <a href="https://reviews.llvm.org/D23871" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D23871</a><br>
<br>
<a href="https://reviews.llvm.org/D23905" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D23905</a><br>
<br>
Files:<br>
docs/Modules.rst<br>
lib/Basic/Module.cpp<br>
lib/Headers/module.modulemap<br>
test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/NeedsGNUAsmInline.h<br>
test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/asm.h<br>
test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>module.map<br>
test/Modules/requires-<wbr>gnuasminline.m<br>
<br>
Index: test/Modules/requires-<wbr>gnuasminline.m<br>
==============================<wbr>==============================<wbr>=======<br>
--- /dev/null<br>
+++ test/Modules/requires-<wbr>gnuasminline.m<br>
@@ -0,0 +1,6 @@<br>
+// RUN: rm -rf %t<br>
+// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules \<br>
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \<br>
+// RUN: -fno-gnu-inline-asm -verify<br>
+<br>
+@import NeedsGNUAsmInline.Asm; // expected-error{{module 'NeedsGNUAsmInline.Asm' requires feature 'gnuasminline'}}<br></blockquote></div></div></div><div><br></div><div>You should add a positive test for the case where inline asm is available, too...</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Index: test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>module.map<br>
==============================<wbr>==============================<wbr>=======<br>
--- /dev/null<br>
+++ test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>module.map<br>
@@ -0,0 +1,8 @@<br>
+framework module NeedsGNUAsmInline {<br>
+ header "NeedsGNUAsmInline.h"<br>
+<br>
+ explicit module Asm {<br>
+ requires gnuasminline<br></blockquote></div></div></div><div><br></div><div>... that way, you'd catch this typo in the test :)</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ header "asm.h"<br>
+ }<br>
+}<br>
Index: test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/asm.h<br>
==============================<wbr>==============================<wbr>=======<br>
--- /dev/null<br>
+++ test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/asm.h<br>
@@ -0,0 +1 @@<br>
+__asm("foo");<br>
Index: test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/NeedsGNUAsmInline.h<br>
==============================<wbr>==============================<wbr>=======<br>
--- /dev/null<br>
+++ test/Modules/Inputs/GNUAsm/<wbr>NeedsGNUAsmInline.framework/<wbr>Headers/NeedsGNUAsmInline.h<br>
@@ -0,0 +1 @@<br>
+// NeedsGNUAsmInline.h<br>
Index: lib/Headers/module.modulemap<br>
==============================<wbr>==============================<wbr>=======<br>
--- lib/Headers/module.modulemap<br>
+++ lib/Headers/module.modulemap<br>
@@ -68,6 +68,7 @@<br>
}<br>
<br>
explicit module cpuid {<br>
+ requires gnuinlineasm<br>
header "cpuid.h"<br>
}<br>
<br>
Index: lib/Basic/Module.cpp<br>
==============================<wbr>==============================<wbr>=======<br>
--- lib/Basic/Module.cpp<br>
+++ lib/Basic/Module.cpp<br>
@@ -64,6 +64,7 @@<br>
.Case("blocks", LangOpts.Blocks)<br>
.Case("cplusplus", LangOpts.CPlusPlus)<br>
.Case("cplusplus11", LangOpts.CPlusPlus11)<br>
+ .Case("gnuinlineasm", LangOpts.GNUAsm)<br>
.Case("objc", LangOpts.ObjC1)<br>
.Case("objc_arc", LangOpts.ObjCAutoRefCount)<br>
.Case("opencl", LangOpts.OpenCL)<br>
Index: docs/Modules.rst<br>
==============================<wbr>==============================<wbr>=======<br>
--- docs/Modules.rst<br>
+++ docs/Modules.rst<br>
@@ -413,6 +413,9 @@<br>
cplusplus11<br>
C++11 support is available.<br>
<br>
+gnuinlineasm<br>
+ GNU inline ASM is available.<br>
+<br>
objc<br>
Objective-C support is available.<br>
<br>
<br>
<br>
</blockquote></div><br></div></div>