Skip to content

Instantly share code, notes, and snippets.

@andydude
Created April 25, 2013 00:39
Show Gist options
  • Save andydude/5456709 to your computer and use it in GitHub Desktop.
Save andydude/5456709 to your computer and use it in GitHub Desktop.
My attempt at adding a function to help with the bubbling phase of walking the AST.
unsigned clang_visitChildrenWithPost(CXCursor parent,
CXCursorVisitor visitor,
CXPostChildrenVisitor post_visitor,
CXClientData client_data) {
clang::cxcursor::CursorVisitor CursorVis(clang_Cursor_getTranslationUnit(parent), visitor, client_data,
/*VisitPreprocessorLast=*/false,
/*VisitIncludedPreprocessingEntries=*/false,
/*RegionOfInterest=*/clang::SourceRange(),
/*VisitDeclsOnly=*/false,
/*PostChildrenVisitor=*/post_visitor);
return CursorVis.VisitChildren(parent);
}
#ifdef __cplusplus
extern "C" {
#endif
typedef bool CXPostChildVisitResult;
bool CXPostChildVisit_Continue = false;
bool CXPostChildVisit_Break = true;
// copy of
// clang::cxcursor::CursorVisitor::PostChildrenVisitorTy
typedef CXPostChildVisitResult (*CXPostChildrenVisitor)(CXCursor cursor, CXClientData client_data);
unsigned clang_visitChildrenWithPost(CXCursor parent,
CXCursorVisitor visitor,
CXPostChildrenVisitor post_visitor,
CXClientData client_data);
#ifdef __cplusplus
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment