<div dir="ltr"><div class="gmail_extra">With regards to the tests, those already exist.  They are in the warn-consumed-parsing.cpp file.  As for the switch statements, I'll move those to fully-covered switches.<br><br>
</div><div class="gmail_extra">I was not claiming that keeping patches limited is a bad idea, or was of limited benefit in general.  Yes, I should have submitted this as multiple patches, but to go back now and dig the different parts out of the commit out would be time consuming, for very little benefit <i>in this case</i>.  All of the things touched are inside my experimental code, or are the removal of simple asserts.  I'd really like to focus on producing actual work, and keep this as a lesson for next time.<br>
<br></div><div class="gmail_extra">- Chris<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 21, 2013 at 9:19 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On Wed, Aug 21, 2013 at 6:54 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Tue, Aug 20, 2013 at 7:16 PM, Christian Wailes<br>

</div><div><div class="h5"><div><div><<a href="mailto:chriswailes@google.com" target="_blank">chriswailes@google.com</a>> wrote:<br>
>> > +<br>
>> > +  if (!FunDecl->hasAttr<CallableWhenUnconsumedAttr>()) return;<br>
>> > +<br>
>> > +  if (PState.IsVar) {<br>
>> > +    const VarDecl *Var = PState.getVar();<br>
>> > +<br>
>> > +    switch (StateMap->getState(Var)) {<br>
>> > +    case CS_Consumed:<br>
>> > +      Analyzer.WarningsHandler.warnUseWhileConsumed(<br>
>> > +        FunDecl->getNameAsString(), Var->getNameAsString(),<br>
>> > +        Call->getExprLoc());<br>
>> > +      break;<br>
>> > +<br>
>> > +    case CS_Unknown:<br>
>> > +      Analyzer.WarningsHandler.warnUseInUnknownState(<br>
>> > +        FunDecl->getNameAsString(), Var->getNameAsString(),<br>
>> > +        Call->getExprLoc());<br>
>> > +      break;<br>
>> > +<br>
>> > +    default:<br>
>> > +      break;<br>
>><br>
>> Should the default be unreachable?<br>
>><br>
><br>
> No, there are other cases besides Consumed and Unknown.  I just don't want<br>
> to do anything for those cases.<br>
<br>
</div></div>I worry that this will cause extra warnings in some of the build bots<br>
because the other enumerants are not covered in the switch statement.<br>
The same is true elsewhere.</div></div></blockquote><div><br></div><div>It is a bit of a clang coding convention to use fully-covered switches with no default.  That way, when someone adds an enum value, the compiler will warn on all of the switches missing cases.<br>

</div><div><br></div><div>We shouldn't get warnings for a partially covered switch with a default (like this one), although we will for fully covered switches with a default.</div><div><br></div><div>There are only two enums vs one default, so I'd cover the switch to leverage the warning.</div>

</div></div></div>
</blockquote></div><br></div></div>