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

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 10:30:59 PST 2024


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

>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 1/2] [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)

>From 4ef8bcd3a9019299145b59d4f26cd4307171bed5 Mon Sep 17 00:00:00 2001
From: Prabhuk <prabhukrllvm at gmail.com>
Date: Wed, 13 Nov 2024 10:30:50 -0800
Subject: [PATCH 2/2] Update OSTargets.h

Remove PE_COFF
---
 clang/lib/Basic/Targets/OSTargets.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 92c76b303def65..5a23eef0117294 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -785,7 +785,6 @@ class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo<Target> {
   void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
                     MacroBuilder &Builder) const override {
     Builder.defineMacro("__UEFI__");
-    Builder.defineMacro("__PECOFF__");
   }
 
 public:



More information about the cfe-commits mailing list