Skip to content

[PATCH 1/4] [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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ABI Changes in This Version
AST Dumping Potentially Breaking Changes
----------------------------------------

- How nested name specifiers are dumped and printed changes, keeping track of clang AST changes.
- Added support for dumping template arguments of structural value kinds.

Clang Frontend Potentially Breaking Changes
Expand Down Expand Up @@ -490,6 +491,7 @@ Improvements to Clang's diagnostics
under the subgroup ``-Wunsafe-buffer-usage-in-libc-call``.
- Diagnostics on chained comparisons (``a < b < c``) are now an error by default. This can be disabled with
``-Wno-error=parentheses``.
- Fix duplicate diagnostics for incomplete type in nested name specifier. (#GH147000)
- Similarly, fold expressions over a comparison operator are now an error by default.
- Clang now better preserves the sugared types of pointers to member.
- Clang now better preserves the presence of the template keyword with dependent
Expand Down Expand Up @@ -671,7 +673,7 @@ Improvements to Clang's diagnostics
#GH142457, #GH139913, #GH138850, #GH137867, #GH137860, #GH107840, #GH93308,
#GH69470, #GH59391, #GH58172, #GH46215, #GH45915, #GH45891, #GH44490,
#GH36703, #GH32903, #GH23312, #GH69874.

- Clang no longer emits a spurious -Wdangling-gsl warning in C++23 when
iterating over an element of a temporary container in a range-based
for loop.(#GH109793, #GH145164)
Expand Down Expand Up @@ -963,8 +965,11 @@ Bug Fixes to AST Handling
- Fixed a malformed printout of ``CXXParenListInitExpr`` in certain contexts.
- Fixed a malformed printout of certain calling convention function attributes. (#GH143160)
- Fixed dependency calculation for TypedefTypes (#GH89774)
- Fix incorrect name qualifiers applied to alias CTAD. (#GH136624)
- The ODR checker now correctly hashes the names of conversion operators. (#GH143152)
- Fixed the right parenthesis source location of ``CXXTemporaryObjectExpr``. (#GH143711)
- Fixed ElaboratedTypes appearing within NestedNameSpecifier, which was not a
legal representation. This is fixed because ElaboratedTypes don't exist anymore. (#GH43179) (#GH68670) (#GH92757)
- Fixed a crash when performing an ``IgnoreUnlessSpelledInSource`` traversal of ASTs containing ``catch(...)`` statements. (#GH146103)

Miscellaneous Bug Fixes
Expand Down Expand Up @@ -1118,6 +1123,8 @@ AST Matchers
------------

- Ensure ``isDerivedFrom`` matches the correct base in case more than one alias exists.
- Removed elaboratedType matchers, and related nested name specifier changes,
following the corresponding changes in the clang AST.
- Extend ``templateArgumentCountIs`` to support function and variable template
specialization.

Expand Down
9 changes: 2 additions & 7 deletions clang/include/clang/AST/ASTConcept.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define LLVM_CLANG_AST_ASTCONCEPT_H

#include "clang/AST/DeclarationName.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/NestedNameSpecifierBase.h"
#include "clang/AST/TemplateBase.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/UnsignedOrNone.h"
Expand Down Expand Up @@ -175,12 +175,7 @@ class ConceptReference {

SourceLocation getLocation() const { return getConceptNameLoc(); }

SourceLocation getBeginLoc() const LLVM_READONLY {
// Note that if the qualifier is null the template KW must also be null.
if (auto QualifierLoc = getNestedNameSpecifierLoc())
return QualifierLoc.getBeginLoc();
return getConceptNameInfo().getBeginLoc();
}
SourceLocation getBeginLoc() const LLVM_READONLY;

SourceLocation getEndLoc() const LLVM_READONLY {
return getTemplateArgsAsWritten() &&
Expand Down
Loading
Loading