[clang] [llvm] [ADT] Add and use (for AArch64) `ValueOrSentinel<T, Sentinel>` (PR #158120)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 07:04:44 PDT 2025


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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/ADT/ValueOrSentinel.h llvm/unittests/ADT/ValueOrSentinelTest.cpp clang/include/clang/Basic/UnsignedOrNone.h llvm/lib/Target/AArch64/AArch64FrameLowering.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/ADT/ValueOrSentinel.h b/llvm/include/llvm/ADT/ValueOrSentinel.h
index 5f4a80f2b..290ef9f0a 100644
--- a/llvm/include/llvm/ADT/ValueOrSentinel.h
+++ b/llvm/include/llvm/ADT/ValueOrSentinel.h
@@ -36,7 +36,7 @@ template <typename T, T Sentinel,
 class ValueOrSentinel {
 public:
   constexpr ValueOrSentinel() = default;
-  constexpr ValueOrSentinel(std::nullopt_t){};
+  constexpr ValueOrSentinel(std::nullopt_t) {};
 
   constexpr ValueOrSentinel(T Value) : Value(Adjust::toRepresentation(Value)) {
     assert(this->Value != Sentinel &&
@@ -76,7 +76,7 @@ public:
   constexpr T toInternalRepresentation() const { return Value; }
 
 protected:
-  ValueOrSentinel(std::nullopt_t, T Value) : Value(Value){};
+  ValueOrSentinel(std::nullopt_t, T Value) : Value(Value) {};
 
   T Value{Sentinel};
 };

``````````

</details>


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


More information about the llvm-commits mailing list