[cfe-dev] Libclang visitChildren does not properly handle aborting the visit

palparni palparni at gmail.com
Thu Apr 9 02:34:20 PDT 2015


Hi All,

I found that CursorVisitor::VisitChildren() does not properly honor the
user's request to break the visiting by returning CXChildVisit_Break from
the visitor callback. This can be a problem in certain scenarios, like when
there is an out of memory error and the user wants to abort the visiting
immediately.

The block of code causing the problem seems to be the following:
// Walk the preprocessing record.
if (CXXUnit->getPreprocessor().getPreprocessingRecord())
  visitPreprocessedEntitiesInRegion();

which as far as I can tell needs to be changed based on how other visiting
calls are made (to stop the 'for' loop):
if (CXXUnit->getPreprocessor().getPreprocessingRecord())
  if (visitPreprocessedEntitiesInRegion())
    return true;

Thank you,
Alpar



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Libclang-visitChildren-does-not-properly-handle-aborting-the-visit-tp4044893.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list