[PATCH] D140332: [ADT] Alias llvm::Optional to std::optional

Benjamin Kramer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 14:48:16 PST 2022


bkramer marked an inline comment as done.
bkramer added inline comments.


================
Comment at: clang/lib/Basic/TargetInfo.cpp:513
   if (Opts.MaxBitIntWidth)
-    MaxBitIntWidth = Opts.MaxBitIntWidth;
+    MaxBitIntWidth = (unsigned)Opts.MaxBitIntWidth;
 
----------------
barannikov88 wrote:
> Nit: C-style casts are generally discouraged (there are several occurrences in this patch).
-> static_cast


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.h:83
   public:
-    ExtraRegInfo() = default;
+    ExtraRegInfo() {}
     ExtraRegInfo(const ExtraRegInfo &) = delete;
----------------
barannikov88 wrote:
> Is it somehow different than ' = default'?
It makes the class non-trivial, std::optional::emplace has issues with trivial default constructors :(


================
Comment at: mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp:182
 
-  return ret;
+  return std::move(ret);
 }
----------------
barannikov88 wrote:
> clang-tidy would usually complain on this. Does it solve some gcc issue?
It does, this is a bug in GCC 7.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140332



More information about the cfe-commits mailing list