<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Thanks for the suggestion.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Updated llvm_unreachable.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The static_cast not only check the switch cases all covered, also make sure 2 enums not out of sync.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows</p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:dblaikie@gmail.com">David Blaikie</a><br>
<b>Sent: </b>Monday, October 17, 2022 5:42 PM<br>
<b>To: </b><a href="mailto:python3kgae@outlook.com">Xiang Li</a>; <a href="mailto:llvmlistbot@llvm.org">
Xiang Li</a><br>
<b>Cc: </b><a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<b>Subject: </b>Re: [clang] 0674f2e - [NFC] Fix warning on no return after switch.</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Also the static_assert is probably not needed - Clang builds with<br>
-Wswitch-enum, which will warn if a switch over an enum doesn't cover<br>
all the enumerators. We have lots of other switches over enums that<br>
depend on this warning to detect code that needs to be updated when an<br>
enum is modified.<br>
<br>
On Mon, Oct 17, 2022 at 5:40 PM David Blaikie <dblaikie@gmail.com> wrote:<br>
><br>
> If the switch is exhaustive (covers all the enumerators in an<br>
> enumeration), we usually use an llvm_unreachable at the end, rather<br>
> than a return. Could you change this to an llvm_unreachable?<br>
><br>
> On Mon, Oct 17, 2022 at 3:52 PM Xiang Li via cfe-commits<br>
> <cfe-commits@lists.llvm.org> wrote:<br>
> ><br>
> ><br>
> > Author: Xiang Li<br>
> > Date: 2022-10-17T15:52:23-07:00<br>
> > New Revision: 0674f2ec96422131abde0c042fbf2c11267db210<br>
> ><br>
> > URL: <a href="https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210">
https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210</a><br>
> > DIFF: <a href="https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210.diff">
https://github.com/llvm/llvm-project/commit/0674f2ec96422131abde0c042fbf2c11267db210.diff</a><br>
> ><br>
> > LOG: [NFC] Fix warning on no return after switch.<br>
> ><br>
> > Added:<br>
> ><br>
> ><br>
> > Modified:<br>
> >     clang/lib/CodeGen/CGHLSLRuntime.cpp<br>
> ><br>
> > Removed:<br>
> ><br>
> ><br>
> ><br>
> > ################################################################################<br>
> > diff  --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp<br>
> > index 7a80dedb8133..6f32136b49de 100644<br>
> > --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp<br>
> > +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp<br>
> > @@ -270,6 +270,7 @@ castResourceShapeToResourceKind(HLSLResourceAttr::ResourceKind RK) {<br>
> >        static_cast<uint32_t>(<br>
> >            HLSLResourceAttr::ResourceKind::FeedbackTexture2DArray) ==<br>
> >        (static_cast<uint32_t>(llvm::hlsl::ResourceKind::NumEntries) - 2));<br>
> > +  return llvm::hlsl::ResourceKind::Invalid;<br>
> >  }<br>
> ><br>
> >  void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {<br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > cfe-commits mailing list<br>
> > cfe-commits@lists.llvm.org<br>
> > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>