[clang] [clang] Introduce a new UEFI target predefine. (PR #111719)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 10:17:50 PDT 2024


https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/111719

None

>From 05eab970b59c61b22e8afa1ed9381906ae925c03 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Wed, 9 Oct 2024 10:16:58 -0700
Subject: [PATCH] [clang] Introduce a new UEFI target predefine.

---
 clang/lib/Basic/Targets/OSTargets.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index a83d6464e789d6..92c76b303def65 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -783,7 +783,10 @@ 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__");
+    Builder.defineMacro("__PECOFF__");
+  }
 
 public:
   UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)



More information about the cfe-commits mailing list