[PATCH] D141968: [NFC] Consolidate llvm::CodeGenOpt::Level handling

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 15:31:51 PST 2023


barannikov88 added inline comments.


================
Comment at: llvm/include/llvm/Support/CodeGen.h:67
+  inline std::optional<Level> getLevel(IDType ID) {
+    if (ID < 0 || ID > 3)
+      return std::nullopt;
----------------
As I can see, clients do not check for nullopt. Either add checks or replace this check with an assertion and drop std::optional (in this case `parseLevel` should be updated accordingly).




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141968/new/

https://reviews.llvm.org/D141968



More information about the cfe-commits mailing list