[clang] [clang] NFC: Refactor UnsignedOrNone into SmallOptional<T> with enum support (PR #191828)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 08:29:25 PDT 2026


================
@@ -4557,7 +4557,7 @@ static QualType mergeTypeNullabilityForRedecl(Sema &S, SourceLocation loc,
   auto prevNullability = prevType->getNullability();
 
   // Easy case: both have nullability.
-  if (nullability.has_value() == prevNullability.has_value()) {
+  if (bool(nullability) == bool(prevNullability)) {
----------------
erichkeane wrote:

Cast to bool here is a little bit of a subtle syntax, we should have some sort of function that explains what is going on.

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


More information about the cfe-commits mailing list