r280613 - [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

Elad Cohen via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 3 23:00:43 PDT 2016


Author: eladcohen
Date: Sun Sep  4 01:00:42 2016
New Revision: 280613

URL: http://llvm.org/viewvc/llvm-project?rev=280613&view=rev
Log:
[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

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

Differential Revision: https://reviews.llvm.org/D23871


Added:
    cfe/trunk/test/Modules/compiler_builtins_x86.c
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=280613&r1=280612&r2=280613&view=diff
==============================================================================
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Sun Sep  4 01:00:42 2016
@@ -413,6 +413,9 @@ cplusplus
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 gnuinlineasm
   GNU inline ASM is available.
 

Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=280613&r1=280612&r2=280613&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Sun Sep  4 01:00:42 2016
@@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature
                         .Case("blocks", LangOpts.Blocks)
                         .Case("cplusplus", LangOpts.CPlusPlus)
                         .Case("cplusplus11", LangOpts.CPlusPlus11)
+                        .Case("freestanding", LangOpts.Freestanding)
                         .Case("gnuinlineasm", LangOpts.GNUAsm)
                         .Case("objc", LangOpts.ObjC1)
                         .Case("objc_arc", LangOpts.ObjCAutoRefCount)

Modified: cfe/trunk/lib/Headers/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/module.modulemap?rev=280613&r1=280612&r2=280613&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/module.modulemap (original)
+++ cfe/trunk/lib/Headers/module.modulemap Sun Sep  4 01:00:42 2016
@@ -63,6 +63,7 @@ module _Builtin_intrinsics [system] [ext
     textual header "mwaitxintrin.h"
 
     explicit module mm_malloc {
+      requires !freestanding
       header "mm_malloc.h"
       export * // note: for <stdlib.h> dependency
     }

Added: cfe/trunk/test/Modules/compiler_builtins_x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins_x86.c?rev=280613&view=auto
==============================================================================
--- cfe/trunk/test/Modules/compiler_builtins_x86.c (added)
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c Sun Sep  4 01:00:42 2016
@@ -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>
+




More information about the cfe-commits mailing list