[all-commits] [llvm/llvm-project] ef18c2: [Clang][RAV] Visit components of __builtin_offseto...
Jakob Linke via All-commits
all-commits at lists.llvm.org
Mon Apr 27 08:50:44 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ef18c253321fa5c0ca9f2200b9bd1f954a2b6d34
https://github.com/llvm/llvm-project/commit/ef18c253321fa5c0ca9f2200b9bd1f954a2b6d34
Author: Jakob Linke <jakob at linke.cx>
Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths:
M clang/include/clang/AST/ASTFwd.h
M clang/include/clang/AST/ASTTypeTraits.h
M clang/include/clang/AST/DynamicRecursiveASTVisitor.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/lib/AST/ASTTypeTraits.cpp
M clang/lib/AST/DynamicRecursiveASTVisitor.cpp
M clang/unittests/Tooling/CMakeLists.txt
A clang/unittests/Tooling/RecursiveASTVisitorTests/OffsetOfExpr.cpp
Log Message:
-----------
[Clang][RAV] Visit components of __builtin_offsetof designators (#194122)
`RecursiveASTVisitor` previously only traversed the type operand of an
`OffsetOfExpr,` ignoring the field/identifier/base/array-index
components of the designator. This meant tools built on RAV (clang-tidy,
clangd, indexers, ...) silently missed every field reference inside
`__builtin_offsetof(T, a.b.c)`.
Add a `TraverseOffsetOfNode / VisitOffsetOfNode` pair following the same
pattern used for `ConceptReference`, `ObjCProtocolLoc`, and friends. The
`DEF_TRAVERSE_STMT` for `OffsetOfExpr` now invokes
`TraverseOffsetOfNode` for each component; array index expressions
continue to be reached via the existing children() traversal. Default
visitation is a no-op, so the change is opt-in for consumers and
behavior-preserving otherwise.
Also expose `OffsetOfNode` as a `DynTypedNode` kind via `ASTTypeTraits`
so that downstream machinery (`SelectionTree`, parent maps, matchers)
can reference these nodes uniformly.
The same gap exists for Designator inside `DesignatedInitExpr` and can
follow this recipe in a follow-up.
Related: https://github.com/llvm/llvm-project/pull/192953. The current
PR enables precise component resolves in clangd (support to be added in
a followup).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list