[PATCH] D23905: [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 26 10:13:58 PDT 2016


bruno updated this revision to Diff 69392.
bruno added a comment.

Update patch after Richard's comment


https://reviews.llvm.org/D23905

Files:
  docs/Modules.rst
  lib/Basic/Module.cpp
  lib/Headers/module.modulemap
  test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
  test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
  test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
  test/Modules/requires-gnuinlineasm.m

Index: test/Modules/requires-gnuinlineasm.m
===================================================================
--- /dev/null
+++ 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
+ at import NeedsGNUInlineAsm.Asm; // expected-error{{module 'NeedsGNUInlineAsm.Asm' requires feature 'gnuinlineasm'}}
+#endif
+
+#ifdef ASM_INLINE
+ at import NeedsGNUInlineAsm.Asm; // expected-no-diagnostics
+#endif
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
===================================================================
--- /dev/null
+++ 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"
+  }
+}
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
@@ -0,0 +1 @@
+__asm("foo");
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
@@ -0,0 +1 @@
+// NeedsGNUInlineAsm.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.69392.patch
Type: text/x-patch
Size: 2915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160826/633e9520/attachment.bin>


More information about the cfe-commits mailing list