[clang] [clang][PP] Add extension to predefine target OS macros (PR #74676)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 15:23:47 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 23d402e5b705d98463150302a55623951284b5f2 2812f69940451b810b8aa9a580e98a4a22a89967 -- clang/test/Driver/darwin-fdefine-target-os-macros.c clang/include/clang/Lex/PreprocessorOptions.h clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/InitPreprocessor.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 320894f33f..cb82844808 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1348,7 +1348,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   if (PPOpts.DefineTargetOSMacros) {
     const llvm::Triple &Triple = TI.getTriple();
 #define TARGET_OS(Name, Predicate)                                             \
-    Builder.defineMacro(#Name, Predicate ? "1" : "0");
+  Builder.defineMacro(#Name, Predicate ? "1" : "0");
 #include "clang/Basic/TargetOSMacros.def"
 #undef TARGET_OS
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/74676


More information about the cfe-commits mailing list