-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[clang] Improve nested name specifier AST representation #147835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Yeah, I think the plan is a reasonable one.
Okay, if this is just a temporary oddity, that's fine. My big concern is that "original" implies "first" and that doesn't match the comment on what's returned. Because temporary measures have a tendency to ossify sometimes, it might make sense to add some more comments to clarify the situation. WDYT? |
FYI bisecting #153770 leads to this patch |
Yeah sure, it would have been a good idea to add a FIXME explaining this, I will do. |
…#153996) In C++, it can be assumed the same linkage will be computed for all redeclarations of an entity, and we have assertions to check this. However, the linkage for a declaration can be requested in the middle of deserealization, and at this point the redecl chain is not well formed, as computation of the most recent declaration is deferred. This patch makes that assertion work even in such conditions. This fixes a regression introduced in #147835, which was never released, so there are no release notes for this. Fixes #153933
…consistency (#153996) In C++, it can be assumed the same linkage will be computed for all redeclarations of an entity, and we have assertions to check this. However, the linkage for a declaration can be requested in the middle of deserealization, and at this point the redecl chain is not well formed, as computation of the most recent declaration is deferred. This patch makes that assertion work even in such conditions. This fixes a regression introduced in llvm/llvm-project#147835, which was never released, so there are no release notes for this. Fixes #153933
These are fixed by: #154395 |
…54430) Makes sure UnconventionalAssignOperatorCheck checks if the types reference the same entity, not the exact declaration. This adds a new matcher to support this check. This fixes a regression introduced by #147835. Since this regression was never released, there are no release notes. Fixes #153770
When building the base type for constructor initializer, the case of an UnresolvedUsingType was not being handled. For the non-dependent case, we are also skipping adding the UsingType, but this is just missing information in the AST. A FIXME for this is added. This fixes a regression introduced in #147835, which was never released, so there are no release notes. Fixes #154436
When building the base type for constructor initializer, the case of an UnresolvedUsingType was not being handled. For the non-dependent case, we are also skipping adding the UsingType, but this is just missing information in the AST. A FIXME for this is added. This fixes a regression introduced in #147835, which was never released, so there are no release notes. Fixes #154436
llvm/llvm-project#147835 makes minor diagnostic changes. Accept the previous and new diagnostic messages. Bug: 437910658 Change-Id: Iec24f4e20944465fe12a87539822c095bb88979f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6842043 Reviewed-by: Nico Weber <[email protected]> Commit-Queue: Arthur Eubanks <[email protected]> Cr-Commit-Position: refs/heads/main@{#1500458} CrOS-Libchrome-Original-Commit: 83aa2e61488debc4572256e81768123605224687
I'm trying to reduce a crash that only reproduces w/ in module builds. Does this sound familiar?
|
Haven't seen this one yet. That may have something to do with demoted definitions, a repro would be helpful. |
I'm trying to reduce it now, but because it's a modules issue/involves multiple files, it's much harder. I created #154840 to track this. If you have any theories you want me to try out, e.g. places to add an assert or calls to dump(), I can patch it in and see what happens. But that's obviously a very inefficient way to debug this, so hopefully I have luck w/ reducing this. |
FWIW if that helps, cvise can reduce multiple files in one go. You can use it to go as far as reducing a whole cmake project at once, but that can be slow unless you do some amount of manual reduction first.
Looking a bit more, this one is a bit less obvious because we do search for a definition in |
Hi, I'm helping fix some clang-as-a-library users and I'm running into some issues with the TypePrinter after this commit. Specifically the clang generator in sandboxed-api is broken (https://github.com/google/sandboxed-api/tree/main). After doing the trivial fixes ( There are two specific tests failing in that test,
and is getting
While
and is getting
Related, I think the change to If you need more information feel free to reach out, I'm happy to connect you with the relevant people. |
The NestedAnonymousStruct case seems to be missing a |
Can you give me an example of that? We shouldn't be printing a keyword unless the type was written / created with a keyword. |
Seems like |
I don't see that happening. Example: https://compiler-explorer.com/z/z9cMxPWva |
Ah, sorry. I tested on IWYU and get confused because it transforms a declaration to the definition later. |
This is a major change on how we represent nested name qualifications in the AST.
This patch offers a great performance benefit.
It greatly improves compilation time for stdexec. For one datapoint, for
test_on2.cpp
in that project, which is the slowest compiling test, this patch improves-c
compilation time by about 7.2%, with the-fsyntax-only
improvement being at ~12%.This has great results on compile-time-tracker as well:

This patch also further enables other optimziations in the future, and will reduce the performance impact of template specialization resugaring when that lands.
It has some other miscelaneous drive-by fixes.
About the review: Yes the patch is huge, sorry about that. Part of the reason is that I started by the nested name specifier part, before the ElaboratedType part, but that had a huge performance downside, as ElaboratedType is a big performance hog. I didn't have the steam to go back and change the patch after the fact.
There is also a lot of internal API changes, and it made sense to remove ElaboratedType in one go, versus removing it from one type at a time, as that would present much more churn to the users. Also, the nested name specifier having a different API avoids missing changes related to how prefixes work now, which could make existing code compile but not work.
How to review: The important changes are all in
clang/include/clang/AST
andclang/lib/AST
, with also important changes inclang/lib/Sema/TreeTransform.h
.The rest and bulk of the changes are mostly consequences of the changes in API.
PS: TagType::getDecl is renamed to
getOriginalDecl
in this patch, just for easier to rebasing. I plan to rename it back after this lands.Fixes #136624
Fixes #43179
Fixes #68670
Fixes #92757