[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

llvm-svn: 280613
This commit is contained in:
Elad Cohen 2016-09-04 06:00:42 +00:00
parent 8e571b551e
commit fb6358d2b5
4 changed files with 11 additions and 0 deletions

View File

@ -413,6 +413,9 @@ cplusplus
cplusplus11
C++11 support is available.
freestanding
A freestanding environment is available.
gnuinlineasm
GNU inline ASM is available.

View File

@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
.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)

View File

@ -63,6 +63,7 @@ module _Builtin_intrinsics [system] [extern_c] {
textual header "mwaitxintrin.h"
explicit module mm_malloc {
requires !freestanding
header "mm_malloc.h"
export * // note: for <stdlib.h> dependency
}

View File

@ -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>