[llvm-commits] [llvm] r169728 - in /llvm/trunk: include/llvm/Analysis/PtrUseVisitor.h lib/Analysis/CMakeLists.txt lib/Analysis/PtrUseVisitor.cpp lib/Transforms/Scalar/SROA.cpp

Chandler Carruth chandlerc at google.com
Mon Dec 10 01:49:55 PST 2012


On Mon, Dec 10, 2012 at 1:45 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Chandler,
>
>
>          +    /// \brief Mark the visit as aborted. Intended for use in a
>> void
>>         return.
>>
>>
>>     Intended for use in a void return?  What does this mean?  What
>> happens if I is
>>     used for an instruction that is not a void return?
>>
>>
>> The 'set' methods are intended to work cleanly with code like:
>>
>> void visitMyInstruction(**MyInstruction &I) {
>>    // .. some code ..
>>
>>    if (detectErrorCondition())
>>      return PI.setAborted(&I);
>>
>>    // .. rest of my code ..
>> }
>>
>> Thus, they are designed to be called within a void-type return statement
>> by the
>> implementor of the visitor. Does that clarify? It has nothing to do with
>> the
>> return of the LLVM IR under analysis.
>>
>
> are you saying that the user should not continue to use the visitor after
> having
> called setAborted, and should bail out at once?


Nothing breaks if the user continues to use it. Setting abort just halts
the visit across the uses. Often this is done when the user is no longer
interested in the results, including the visit currently taking place, so
this is expected to be a common pattern but not necessarily a required
pattern.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121210/408f5ee8/attachment.html>


More information about the llvm-commits mailing list