[PATCH] D39122: [Sema] Fixes for enum handling for tautological comparison diagnostics

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 21 08:51:19 PDT 2017


lebedev.ri added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:8619
+  if (OtherRange.Width == 0)
+    return Value == 0 ? LimitType::Both : llvm::Optional<LimitType>();
+
----------------
aaron.ballman wrote:
> Instead of default constructing the Optional, you should use `llvm::None` instead.
Thank you for the suggestion, i did not really know about `llvm::None`.
However only the last `return` can be enhanced:
```
clang/lib/Sema/SemaChecking.cpp:8619:23: error: incompatible operand types ('(anonymous namespace)::LimitType' and 'llvm::NoneType')
    return Value == 0 ? LimitType::Both : llvm::None;
                      ^ ~~~~~~~~~~~~~~~   ~~~~~~~~~~
```



Repository:
  rL LLVM

https://reviews.llvm.org/D39122





More information about the cfe-commits mailing list