[all-commits] [llvm/llvm-project] 6aca60: [AST] Include the TranslationUnitDecl when travers...
Sam McCall via All-commits
all-commits at lists.llvm.org
Fri Jun 11 05:30:06 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6aca6032c5b62b5d26999da5f55779a1b08ec6a2
https://github.com/llvm/llvm-project/commit/6aca6032c5b62b5d26999da5f55779a1b08ec6a2
Author: Sam McCall <sam.mccall at gmail.com>
Date: 2021-06-11 (Fri, 11 Jun 2021)
Changed paths:
M clang-tools-extra/clangd/DumpAST.cpp
M clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
M clang-tools-extra/clangd/unittests/TestTU.cpp
M clang/include/clang/AST/ASTContext.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/unittests/AST/ASTContextParentMapTest.cpp
M clang/unittests/Tooling/RecursiveASTVisitorTests/TraversalScope.cpp
Log Message:
-----------
[AST] Include the TranslationUnitDecl when traversing with TraversalScope
Given `int foo, bar;`, TraverseAST reveals this tree:
TranslationUnitDecl
- foo
- bar
Before this patch, with the TraversalScope set to {foo}, TraverseAST yields:
foo
After this patch it yields:
TranslationUnitDecl
- foo
Also, TraverseDecl(TranslationUnitDecl) now respects the traversal scope.
---
The main effect of this today is that clang-tidy checks that match the
translationUnitDecl(), either in order to traverse it or check
parentage, should work.
Differential Revision: https://reviews.llvm.org/D104071
More information about the All-commits
mailing list