bruno created this revision. bruno added a reviewer: rsmith. bruno added subscribers: cfe-commits, eladcohen.
This adds support for modules that require (no-)gnu-inline-asm environment, such as the compiler builtin cpuid submodule. This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871 https://reviews.llvm.org/D23905 Files: docs/Modules.rst lib/Basic/Module.cpp lib/Headers/module.modulemap test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map test/Modules/requires-gnuasminline.m Index: test/Modules/requires-gnuasminline.m =================================================================== --- /dev/null +++ test/Modules/requires-gnuasminline.m @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules \ +// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \ +// RUN: -fno-gnu-inline-asm -verify + +@import NeedsGNUAsmInline.Asm; // expected-error{{module 'NeedsGNUAsmInline.Asm' requires feature 'gnuasminline'}} Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map @@ -0,0 +1,8 @@ +framework module NeedsGNUAsmInline { + header "NeedsGNUAsmInline.h" + + explicit module Asm { + requires gnuasminline + header "asm.h" + } +} Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h @@ -0,0 +1 @@ +__asm("foo"); Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h @@ -0,0 +1 @@ +// NeedsGNUAsmInline.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.
Index: test/Modules/requires-gnuasminline.m =================================================================== --- /dev/null +++ test/Modules/requires-gnuasminline.m @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules \ +// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \ +// RUN: -fno-gnu-inline-asm -verify + +@import NeedsGNUAsmInline.Asm; // expected-error{{module 'NeedsGNUAsmInline.Asm' requires feature 'gnuasminline'}} Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map @@ -0,0 +1,8 @@ +framework module NeedsGNUAsmInline { + header "NeedsGNUAsmInline.h" + + explicit module Asm { + requires gnuasminline + header "asm.h" + } +} Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h @@ -0,0 +1 @@ +__asm("foo"); Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h =================================================================== --- /dev/null +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h @@ -0,0 +1 @@ +// NeedsGNUAsmInline.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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits