[Lldb-commits] [PATCH] D72190: Removing C-style casts in favor of explict C++ style casts

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 6 07:20:23 PST 2020


labath added a comment.

This is fine, though, since you're already touching these lines, I'd consider converting them from LLDB_LOGF to LLDB_LOG at the same time (getting rid of most of the static_casts...).

However, I don't think we should be changing `(void)` to `static_cast<void>`.

There is also ample precedent in llvm for using -1 (or sometimes `~0`) to mean UINTxx_MAX, so I'm not sure we should change that too. Though it is somewhat confusing, in a way, it is actually safer, as `-1` will always convert to the right `MAX` value. (e.g., in `foo = -1`, the value will remain fff...ff even if we change the type of foo from `uint32_t` to `uint64_t`, but that won't happen with UINT32_MAX)...



================
Comment at: lldb/source/Expression/IRExecutionUnit.cpp:306-307
           "jit-object-" + module->getModuleIdentifier() + "-%%%.o";
-      (void)llvm::sys::fs::createUniqueFile(object_name_model, fd, result_path);
+      static_cast<void>(
+          llvm::sys::fs::createUniqueFile(object_name_model, fd, result_path));
       llvm::raw_fd_ostream fds(fd, true);
----------------
I think this is overkill. `(void)` is used throughout llvm as a way to explicitly ignore a value (usually done to supress some kind of a warning).


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

https://reviews.llvm.org/D72190





More information about the lldb-commits mailing list