<div dir="ltr"><div><div>Attached is the final draft of the patch to add consumed analysis to the Clang compiler.<br><br></div><div>Commit message:<br></div><div><br></div>Add the annotations and code needed to support a basic 'consumed' analysis.<br>
<br>Summary:<br>This new analysis is based on academic literature on linear types.  It tracks the state of a value, either as unconsumed, consumed, or unknown.  Methods are then annotated as CallableWhenUnconsumed, and when an annotated method is called while the value is in the 'consumed' state a warning is issued.  A value may be tested in the conditional statement of an if-statement; when this occurs we know the state of the value in the different branches, and this information is added ot our analysis.  The code is still highly experimental, and the names of annotations or the algorithm may be subject to change.<br>
<br></div>- Chris<br></div>