gamesh411 accepted this revision. gamesh411 added a comment. This revision is now accepted and ready to land.
I have found this in ASTContext.h: // A traversal scope limits the parts of the AST visible to certain analyses. // RecursiveASTVisitor::TraverseAST will only visit reachable nodes, and // getParents() will only observe reachable parent edges. // // The scope is defined by a set of "top-level" declarations. // Initially, it is the entire TU: {getTranslationUnitDecl()}. // Changing the scope clears the parent cache, which is expensive to rebuild. std::vector<Decl *> getTraversalScope() const { return TraversalScope; } The setTraversalScope resets the parentmap in ASTContext.cpp: void ASTContext::setTraversalScope(const std::vector<Decl *> &TopLevelDecls) { TraversalScope = TopLevelDecls; getParentMapContext().clear(); } It seems to me that not resetting this cache could very well cause a bad AST being available. Just curious: Is there an example that you are aware of, where this caused an actual problem? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82568/new/ https://reviews.llvm.org/D82568 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits