[Lldb-commits] [lldb] r184334 - Fix two 'variable is used uninitialised' warnings. Change assert to llvm_unreachable.

Andy Gibbs andyg1001 at hotmail.co.uk
Wed Jun 19 13:08:17 PDT 2013


On Wednesday, June 19, 2013 9:13 PM, Mike Sartain wrote:
> Would it be better to initialize reg to LLDB_INVALID_REGNUM?
>
> Otherwise this function could fail, but return 0 which is a valid 
> register.

Yes, you're right.  I've fixed this in r184342.

Thanks
Andy

> ________________________________________
> From: lldb-commits-bounces at cs.uiuc.edu [lldb-commits-bounces at cs.uiuc.edu] 
> on behalf of Andy Gibbs [andyg1001 at hotmail.co.uk]
> Sent: Wednesday, June 19, 2013 12:05 PM
> To: lldb-commits at cs.uiuc.edu
> Subject: [Lldb-commits] [lldb] r184334 - Fix two 'variable is used 
> uninitialised' warnings. Change assert to llvm_unreachable.
>
> Author: andyg
> Date: Wed Jun 19 14:05:52 2013
> New Revision: 184334
>
> URL: http://llvm.org/viewvc/llvm-project?rev=184334&view=rev
> Log:
> Fix two 'variable is used uninitialised' warnings.  Change assert to 
> llvm_unreachable.
>
> Modified:
>    lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
>
> Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=184334&r1=184333&r2=184334&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Wed Jun 19 
> 14:05:52 2013
> @@ -488,13 +488,13 @@ POSIXThread::ThreadNotify(const ProcessM
> unsigned
> POSIXThread::GetRegisterIndexFromOffset(unsigned offset)
> {
> -    unsigned reg;
> +    unsigned reg = 0;
>     ArchSpec arch = Host::GetArchitecture();
>
>     switch (arch.GetCore())
>     {
>     default:
> -        assert(false && "CPU type not supported!");
> +        llvm_unreachable("CPU type not supported!");
>         break;
>
>     case ArchSpec::eCore_x86_32_i386:
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 



More information about the lldb-commits mailing list