[PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

Elad Cohen via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 07:14:14 PDT 2016


eladcohen created this revision.
eladcohen added reviewers: rsmith, andreybokhanko.
eladcohen added a subscriber: cfe-commits.

This adds support for modules that require (non-)freestanding environment such as the compiler builtin mm_malloc submodule.

https://reviews.llvm.org/D23871

Files:
  docs/Modules.rst
  lib/Basic/Module.cpp
  lib/Headers/module.modulemap
  test/Modules/compiler_builtins_x86.c

Index: test/Modules/compiler_builtins_x86.c
===================================================================
--- test/Modules/compiler_builtins_x86.c
+++ test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include<x86intrin.h>
+
Index: lib/Headers/module.modulemap
===================================================================
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -63,6 +63,7 @@
     textual header "mwaitxintrin.h"
 
     explicit module mm_malloc {
+      requires !freestanding
       header "mm_malloc.h"
       export * // note: for <stdlib.h> dependency
     }
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("freestanding", LangOpts.Freestanding)
                         .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.
 
+freestanding
+  A freestanding environment is available.
+
 objc
   Objective-C support is available.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23871.69239.patch
Type: text/x-patch
Size: 1689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160825/7ab399b7/attachment.bin>


More information about the cfe-commits mailing list