[Lldb-commits] [PATCH] D26528: Fix uninitialized members.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 11 09:07:58 PST 2016


> On Nov 10, 2016, at 8:57 PM, Zachary Turner via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> Maybe just inline the initializations so we don't have to repeat code across multiple constructors?  i.e.
> 
> bool m_is_resolved = false;
> 
> in the header file.

I actually like the ability to do this in the header file, that seems clearer to me.  But if we're going to start doing this more widely I think it would be better to do it consistently  - maybe converting on a class by class basis when you touch one of the ivars in the class?  Having to look in two places for all these default initializations with only history as the pattern seems like it will make the code harder to read.

Jim


> 
> On Thu, Nov 10, 2016 at 8:54 PM Sam McCall via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> sammccall created this revision.
> sammccall added a subscriber: lldb-commits.
> 
> Fix uninitialized members.
> 
> 
> https://reviews.llvm.org/D26528
> 
> Files:
>   source/Host/common/FileSpec.cpp
>   source/Target/Process.cpp
> 
> 
> Index: source/Target/Process.cpp
> ===================================================================
> --- source/Target/Process.cpp
> +++ source/Target/Process.cpp
> @@ -4581,7 +4581,7 @@
>        : IOHandler(process->GetTarget().GetDebugger(),
>                    IOHandler::Type::ProcessIO),
>          m_process(process), m_read_file(), m_write_file(write_fd, false),
> -        m_pipe() {
> +        m_pipe(), m_is_running(false) {
>      m_pipe.CreateNew(false);
>      m_read_file.SetDescriptor(GetInputFD(), false);
>    }
> Index: source/Host/common/FileSpec.cpp
> ===================================================================
> --- source/Host/common/FileSpec.cpp
> +++ source/Host/common/FileSpec.cpp
> @@ -278,8 +278,8 @@
>  }
> 
>  FileSpec::FileSpec()
> -    : m_directory(), m_filename(), m_syntax(FileSystem::GetNativePathSyntax()) {
> -}
> +    : m_directory(), m_filename(), m_is_resolved(false),
> +      m_syntax(FileSystem::GetNativePathSyntax()) {}
> 
>  //------------------------------------------------------------------
>  // Default constructor that can take an optional full path to a
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list