This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers] Use covering ObjectFormatType switches
ClosedPublic

Authored by hubert.reinterpretcast on Jul 4 2019, 3:07 PM.

Details

Summary

This patch removes the default case from some switches on llvm::Triple::ObjectFormatType, and cases for the missing enumerators (UnknownObjectFormat, Wasm, and XCOFF) are then added.

For UnknownObjectFormat, the effect of the action for the default case is maintained; otherwise, where llvm_unreachable is called, report_fatal_error is used instead.

Where the default case returns a default value, report_fatal_error is used for XCOFF as a placeholder. For Wasm, the effect of the action for the default case in maintained.

The code is structured to avoid strongly implying that the Wasm case is present for any reason other than to make the switch cover all ObjectFormatType enumerator values.

Diff Detail

Repository
rL LLVM

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 4 2019, 3:07 PM
sfertile accepted this revision.Jul 5 2019, 8:14 AM

LGTM.

This revision is now accepted and ready to land.Jul 5 2019, 8:14 AM
This revision was automatically updated to reflect the committed changes.