Currently, the "potentially uninitialized local variable" & "potentially uninitialized local pointer variable" warnings are turned off. At some point we should probably turn them back on, because they can find serious problems. This patch eliminates the most obviously benign offenders.
Assuming that I did everything correctly, there should be no behavior change. In several places, I added defensive checks to bulletproof against future changes.
This leaves about ~33 not-so-obviously benign offenders. which I'll include here for convenience:
Severity | Code | Description | Project | File | Line |
---|---|---|---|---|---|
Warning | C4703 | potentially uninitialized local pointer variable 'ExprOffset' used | LLVMMipsAsmParser | c:\llvm\llvm\lib\target\mips\asmparser\mipsasmparser.cpp | 2668 |
Warning | C4701 | potentially uninitialized local variable 'Encoding' used | clangCodeGen | c:\llvm\llvm\tools\clang\lib\codegen\cgdebuginfo.cpp | 573 |
Warning | C4701 | potentially uninitialized local variable 'result' used | clangCodeGen | c:\llvm\llvm\tools\clang\lib\codegen\cgobjc.cpp | 2675 |
Warning | C4701 | potentially uninitialized local variable 'Nullability' used | clangParse | c:\llvm\llvm\tools\clang\lib\parse\parseobjc.cpp | 1202 |
Warning | C4701 | potentially uninitialized local variable 'RepresentationMethod' used | clangParse | c:\llvm\llvm\tools\clang\lib\parse\parsepragma.cpp | 1582 |
Warning | C4701 | potentially uninitialized local variable 'FirstOpKind' used | clangSema | c:\llvm\llvm\tools\clang\lib\sema\sematemplate.cpp | 4464 |
Warning | C4701 | potentially uninitialized local variable 'FnEntry8BitAbbrev' used | LLVMBitWriter | c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp | 2353 |
Warning | C4701 | potentially uninitialized local variable 'FnEntry7BitAbbrev' used | LLVMBitWriter | c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp | 2357 |
Warning | C4701 | potentially uninitialized local variable 'FnEntry6BitAbbrev' used | LLVMBitWriter | c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp | 2355 |
Warning | C4701 | potentially uninitialized local variable 'OutIt' used | LLVMCodeGen | c:\llvm\llvm\lib\codegen\liveinterval.cpp | 876 |
Warning | C4701 | potentially uninitialized local variable 'mid' used | LLVMHexagonCodeGen | c:\llvm\build\lib\target\hexagon\hexagongeninstrinfo.inc | 9722 |
Warning | C4701 | potentially uninitialized local variable 'RealEightBitCounterArray' used | LLVMInstrumentation | c:\llvm\llvm\lib\transforms\instrumentation\sanitizercoverage.cpp | 294 |
Warning | C4701 | potentially uninitialized local variable 'LoOffset' used | LLVMMipsAsmParser | c:\llvm\llvm\lib\target\mips\asmparser\mipsasmparser.cpp | 2668 |
Warning | C4701 | potentially uninitialized local variable 'HiOffset' used | LLVMMipsAsmParser | c:\llvm\llvm\lib\target\mips\asmparser\mipsasmparser.cpp | 2659 |
Warning | C4701 | potentially uninitialized local variable 'ExprOffset' used | LLVMMipsAsmParser | c:\llvm\llvm\lib\target\mips\asmparser\mipsasmparser.cpp | 2668 |
Warning | C4701 | potentially uninitialized local variable 'BranchTargetNoTraps' used | LLVMMipsAsmParser | c:\llvm\llvm\lib\target\mips\asmparser\mipsasmparser.cpp | 3072 |
Warning | C4701 | potentially uninitialized local variable 'MatImm' used | LLVMPowerPCCodeGen | c:\llvm\llvm\lib\target\powerpc\ppciseldagtodag.cpp | 808 |
Warning | C4701 | potentially uninitialized local variable 'MaskEnd' used | LLVMPowerPCCodeGen | c:\llvm\llvm\lib\target\powerpc\ppciseldagtodag.cpp | 809 |
Warning | C4701 | potentially uninitialized local variable 'FirstLP' used | LLVMScalarOpts | c:\llvm\llvm\lib\transforms\scalar\loadcombine.cpp | 198 |
Warning | C4701 | potentially uninitialized local variable 'CC' used | LLVMSelectionDAG | c:\llvm\llvm\lib\codegen\selectiondag\dagcombiner.cpp | 13889 |
Warning | C4701 | potentially uninitialized local variable 'Operation' used | llvm-ar | c:\llvm\llvm\tools\llvm-ar\llvm-ar.cpp | 287 |
Warning | C4701 | potentially uninitialized local variable 'Kind' used | llvm-ar | c:\llvm\llvm\tools\llvm-ar\llvm-ar.cpp | 602 |
Warning | C4701 | potentially uninitialized local variable 'CurSegAddress' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 8548 |
Warning | C4701 | potentially uninitialized local variable 'objc_class' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 5435 |
Warning | C4701 | potentially uninitialized local variable 'r_type' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1781 |
Warning | C4701 | potentially uninitialized local variable 'r_value' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1783 |
Warning | C4701 | potentially uninitialized local variable 'pair_r_value' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1784 |
Warning | C4701 | potentially uninitialized local variable 'r_value' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1970 |
Warning | C4701 | potentially uninitialized local variable 'other_half' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1940 |
Warning | C4701 | potentially uninitialized local variable 'pair_r_value' used | llvm-objdump | c:\llvm\llvm\tools\llvm-objdump\machodump.cpp | 1980 |
Warning | C4703 | potentially uninitialized local pointer variable 'result' used | clangCodeGen | c:\llvm\llvm\tools\clang\lib\codegen\cgobjc.cpp | 2675 |
Warning | C4703 | potentially uninitialized local pointer variable 'OutIt' used | LLVMCodeGen | c:\llvm\llvm\lib\codegen\liveinterval.cpp | 876 |
Warning | C4703 | potentially uninitialized local pointer variable 'RealEightBitCounterArray' used | LLVMInstrumentation | c:\llvm\llvm\lib\transforms\instrumentation\sanitizercoverage.cpp | 294 |
I think this should be Mips::NoRegister.