[PATCH] D97496: [Clang][ASan] Correct AsanDtorKindToString to return non-void in default case

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 13:31:09 PST 2021


cryptoad created this revision.
cryptoad added reviewers: delcypher, vitalybuka.
Herald added a subscriber: dexonsmith.
cryptoad requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Post D96572 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97496

Files:
  clang/lib/Basic/Sanitizers.cpp


Index: clang/lib/Basic/Sanitizers.cpp
===================================================================
--- clang/lib/Basic/Sanitizers.cpp
+++ clang/lib/Basic/Sanitizers.cpp
@@ -68,6 +68,8 @@
   case llvm::AsanDtorKind::Global:
     return "global";
   case llvm::AsanDtorKind::Invalid:
+    LLVM_FALLTHROUGH;
+  default:
     return "invalid";
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97496.326479.patch
Type: text/x-patch
Size: 355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/3cab7510/attachment.bin>


More information about the llvm-commits mailing list