[Lldb-commits] [PATCH] D130098: [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan
Slava Gurevich via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 19 14:20:19 PDT 2022
fixathon added a comment.
Adding review comments
================
Comment at: lldb/include/lldb/Core/EmulateInstruction.h:182
eInfoTypeNoArgs
- } InfoType;
+ };
----------------
clayborg wrote:
> This doesn't fall into the un initialized variable case, I would revert this. You can always submit a new patch if you want to fix this.
This is fixing Coverity scan warning 1094796 "Uninitialized scalar field".
"Non-static class member InfoType is not initialized in this constructor nor in any functions that it calls"
================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:410
/// already.
- const char *Written;
+ const char *Written = "";
----------------
clayborg wrote:
> set to nullptr instead of empty string? Check the code to see if they check this variable for NULL and use nullptr if they do.
An empty string literal is a reasonable and safe init value for what is semantically a string (C-string). The warning related to this fix is triggered by line 403:
Written += From.size();
I am not sure that nullptr += (llvm::StringRef type) will pay nice, but I am not opposed to changing it to nullptr if you feel strongly about it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130098/new/
https://reviews.llvm.org/D130098
More information about the lldb-commits
mailing list