mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[clang] Introduce a new UEFI target predefine. (#111719)
Add a `__UEFI__` predefine for UEFI target. Co-authored-by: RossComputerGuy
This commit is contained in:
@@ -790,7 +790,9 @@ template <typename Target>
|
||||
class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo<Target> {
|
||||
protected:
|
||||
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
||||
MacroBuilder &Builder) const override {}
|
||||
MacroBuilder &Builder) const override {
|
||||
Builder.defineMacro("__UEFI__");
|
||||
}
|
||||
|
||||
public:
|
||||
UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
|
||||
6
clang/test/Driver/uefi-defines.c
Normal file
6
clang/test/Driver/uefi-defines.c
Normal file
@@ -0,0 +1,6 @@
|
||||
// RUN: %clang -target x86_64-unknown-uefi %s -emit-llvm -S -c -o - | FileCheck %s
|
||||
|
||||
// CHECK: __UEFI__defined
|
||||
#ifdef __UEFI__
|
||||
void __UEFI__defined() {}
|
||||
#endif
|
||||
@@ -2742,3 +2742,7 @@
|
||||
// RISCV64-LINUX: #define __unix__ 1
|
||||
// RISCV64-LINUX: #define linux 1
|
||||
// RISCV64-LINUX: #define unix 1
|
||||
|
||||
// RUN: %clang_cc1 -dM -triple=x86_64-uefi -E /dev/null | FileCheck -match-full-lines -check-prefix UEFI %s
|
||||
|
||||
// UEFI: #define __UEFI__ 1
|
||||
|
||||
Reference in New Issue
Block a user