[llvm] r286600 - Fix windows buildbot where warnings are errors. We had a switch statement where all enumerations were handled, but some compilers don't recognize this. Simplify the logic so that all compilers will know a return value is returned in all cases.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 11 09:22:04 PST 2016
> On Nov 11, 2016, at 8:55 AM, Greg Clayton via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: gclayton
> Date: Fri Nov 11 10:55:31 2016
> New Revision: 286600
>
> URL: http://llvm.org/viewvc/llvm-project?rev=286600&view=rev
> Log:
> Fix windows buildbot where warnings are errors. We had a switch statement where all enumerations were handled, but some compilers don't recognize this. Simplify the logic so that all compilers will know a return value is returned in all cases.
>
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h?rev=286600&r1=286599&r2=286600&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h Fri Nov 11 10:55:31 2016
> @@ -204,12 +204,9 @@ public:
> return getDwarfOffsetByteSize();
> }
> uint8_t getDwarfOffsetByteSize() const {
> - switch (getFormat()) {
> - case dwarf::DwarfFormat::DWARF32:
> - return 4;
> - case dwarf::DwarfFormat::DWARF64:
> + if (getFormat() == dwarf::DwarfFormat::DWARF64)
> return 8;
> - }
> + return 4;
> }
I think this pattern might work (unreachable has a MSVC-specific definition, too):
uint8_t getDwarfOffsetByteSize() const {
switch (getFormat()) {
case dwarf::DwarfFormat::DWARF32: return 4;
case dwarf::DwarfFormat::DWARF64: return 8;
}
llvm_unreachable("unexpected enum value");
}
> uint64_t getBaseAddress() const { return BaseAddr; }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list