History log of /llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp (Results 1 – 4 of 4)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 39a72be5 29-Jan-2025 Sirraide <aeternalmail@gmail.com>

[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor` (reland) (#124821)

This relands #122991 (eeefa72).

The last attempt at landing this caused some problems; I’m not entirely
sure what happen

[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor` (reland) (#124821)

This relands #122991 (eeefa72).

The last attempt at landing this caused some problems; I’m not entirely
sure what happened, but it might have been due to an unnecessary use
of the `template` keyword in a few places. This removes that and attempts
to land the change again.

show more ...


Revision tags: llvmorg-21-init
# 7873d3b5 28-Jan-2025 Sirraide <aeternalmail@gmail.com>

Revert "[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor`" (#124667)

Reverts llvm/llvm-project#122991

One of the bots is breaking; I’ll have to investigate what the issue is;
this might be

Revert "[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor`" (#124667)

Reverts llvm/llvm-project#122991

One of the bots is breaking; I’ll have to investigate what the issue is;
this might be because I haven’t updated the branch in a while.

show more ...


# eeefa72f 28-Jan-2025 Sirraide <aeternalmail@gmail.com>

[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor` (#122991)

After some discussion around #116823, it was decided that it would be
nice to have a `const` variant of `DynamicRecursiveASTVisito

[Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor` (#122991)

After some discussion around #116823, it was decided that it would be
nice to have a `const` variant of `DynamicRecursiveASTVisitor`, so this
pr does exactly that by making the main DRAV implementation a template
with a single `bool` template parameter that turns several function
parameters from a `T*` or `T&` to a `const T*` or `const T&`.

Since that made the implementation of a bunch of DRAV functions quite a
bit more verbose, I’ve moved most of them to be stamped out by a macro,
which imo makes it easier to understand what’s actually going on there.

For functions which already accepted `const` parameters in the original
RAV implementation, the parameter is `const` in both versions (e.g.
`TraverseTemplateArgument()` always takes a `const TemplateArgument&`);
conversely, parameters that are passed by value (e.g. in
`TraverseType()`, which takes a `QualType` by value) are *not* `const`
in either variant (i.e. the `QualType` argument is always just a
`QualType`, never a `const QualType`).

As a sanity check, I’ve also migrated some random visitor in the static
analyser to the `const` version (and indeed, it ends up simplifying the
code around that particular visitor actually). It would make sense to do
a pass over all visitors and change all which can be `const` use the
`const` version, but that can be done in a follow-up pr.

The [performance
impact](https://llvm-compile-time-tracker.com/compare.php?from=e3cd88a7be1dfd912bb6e7c7e888e7b442ffb5de&to=d55c5afe4a485b6d0431386e6f45cb44c1fc8883&stat=instructions:u)
of this change seems to be negligible. Clang’s binary size went up by
0.5%, but that’s expected considering that this effectively adds an
extra instantiation of `RecursiveASTVisitor`. Fortunately, this is of
course a one-time cost.

show more ...


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# ff5551cd 05-Nov-2024 Sirraide <aeternalmail@gmail.com>

[Clang] [NFC] Introduce `DynamicRecursiveASTVisitor` (#110040)

See #105195 as well as the big comment in DynamicRecursiveASTVisitor.cpp
for more context.