This is an archive of the discontinued LLVM Phabricator instance.

[Clang][ASan] Correct AsanDtorKindToString to return non-void in default case
ClosedPublic

Authored by cryptoad on Feb 25 2021, 1:31 PM.

Details

Summary

Post D96572, a warning started showing up for me:
clang/lib/Basic/Sanitizers.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]

So this adds a default to the case to return invalid, which seems appropriate,
and appears to correct the issue.

Diff Detail

Event Timeline

cryptoad created this revision.Feb 25 2021, 1:31 PM
cryptoad requested review of this revision.Feb 25 2021, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2021, 1:31 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cryptoad updated this revision to Diff 326516.Feb 25 2021, 2:41 PM

Opt for a version that satisfies clang-diagnostic-covered-switch-default

vitalybuka accepted this revision.Feb 25 2021, 2:44 PM
This revision is now accepted and ready to land.Feb 25 2021, 2:44 PM

@cryptoad Thanks.

LGTM

Originally this code had a default case in the switch but clang complained about it being unnecessary because it was exhaustive, so I removed it... It seems this is causing problems with your compiler :(

delcypher accepted this revision.Feb 25 2021, 3:22 PM
This revision was landed with ongoing or failed builds.Feb 25 2021, 3:32 PM
This revision was automatically updated to reflect the committed changes.