[clang] [PATCH 1/7] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/7] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/7] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-21 Thread Matheus Izvekov via cfe-commits
@@ -181,14 +181,14 @@ template class DynamicRecursiveASTVisitorBase { /// /// \returns false if the visitation was terminated early, true /// otherwise (including when the argument is a Null type). - virtual bool TraverseType(QualType T); + virtual bool TraverseType(Q

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Matheus Izvekov via cfe-commits
@@ -876,6 +876,15 @@ class ASTContext : public RefCountedBase { QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const; + /// getGCCCompatibleIntTypeForBitwidth - + /// sets integer QualTy according to specified details:

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Matheus Izvekov via cfe-commits
@@ -12901,25 +12901,9 @@ QualType Sema::GetSignedVectorType(QualType V) { return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements()); } - if (TypeSize == Context.getTypeSize(Context.Int128Ty)) -return Context.getVectorType(Context.Int128Ty, VTy->getN

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM sans the nits already pointed out. Thanks! https://github.com/llvm/llvm-project/pull/148954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

2025-07-21 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/148954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a partial ordering bug involving CTAD injected template arguments (PR #149782)

2025-07-21 Thread Matheus Izvekov via cfe-commits
@@ -5525,6 +5525,8 @@ static TemplateDeductionResult CheckDeductionConsistency( // FIXME: A substitution can be incomplete on a non-structural part of the // type. Use the canonical type for now, until the TemplateInstantiator can // deal with that. + if (auto *Injected

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-20 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I have further split up this patch series, now the changes related to the NNS representation are moved last in the patch series: https://github.com/llvm/llvm-project/pull/149748 I have also moved some of the trivial changes into yet another patch: https://github.com/llvm/llvm-

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-20 Thread Matheus Izvekov via cfe-commits
@@ -326,7 +326,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) { const auto *RT = Spec.getType()->getAs(); if (!RT) return nullptr; - const RecordDecl *BD = RT->getDecl(); + const RecordDecl *BD = RT->getOriginalDecl()->getDefinitionO

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-20 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-20 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-20 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [lldb] Reland [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types (PR #149613)

2025-07-18 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/149613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [lldb] Reland [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types (PR #149613)

2025-07-18 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. Thanks. It would be awesome to get the more strict check ironed out in another patch, and you can probably put it into a different warning group, not part of Wall. I am sure we can also come up with something to solve the common sugar pro

[clang] [clang-tools-extra] [libcxx] [lldb] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-17 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][P1061] Fix template arguments in local classes (PR #121225)

2025-07-13 Thread Matheus Izvekov via cfe-commits
@@ -4433,8 +4433,12 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, // No need to instantiate in-class initializers during explicit // instantiation. if (Field->hasInClassInitializer() && TSK == TSK_ImplicitInstantiation) { +// H

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,585 @@ +//===- NestedNameSpecifier.h - C++ nested name specifiers ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)

2025-07-11 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM For reference, this takes this change out of https://github.com/llvm/llvm-project/pull/147835, which reduces the size of that PR a little bit. https://github.com/llvm/llvm-project/pull/148195

[clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)

2025-07-11 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > These files test demangling `RecordDecl::isInjectedClassName`, which will be > out-of-date (I think) after merging this PR. This file uses these symbols as test cases, but they are just examples and aren't coupled to the clang implementation at all, the tests are still valid,

[clang] [Clang] Consider default template arguments when synthesizing CTAD guides (PR #147675)

2025-07-11 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, but it would be good leaving a FIXME. https://github.com/llvm/llvm-project/pull/147675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [Clang] Consider default template arguments when synthesizing CTAD guides (PR #147675)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -1061,15 +1061,36 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, SmallVector DeduceResults( F->getTemplateParameters()->size()); + // We don't have to deduce against the alias template specialization, + // if the source template is a synthesized alias deduction

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -2068,7 +2080,9 @@ class ASTContext : public RefCountedBase { /// if it hasn't yet been built. QualType getRawCFConstantStringType() const { if (CFConstantStringTypeDecl) - return getTypedefType(CFConstantStringTypeDecl); + return getTypedefType(ElaboratedT

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,585 @@ +//===- NestedNameSpecifier.h - C++ nested name specifiers ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -6,534 +6,266 @@ // //===--===// // -// This file defines the NestedNameSpecifier class, which represents -// a C++ nested-name-specifier. +// This file completes the definition of the NestedNameSpecifie

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,585 @@ +//===- NestedNameSpecifier.h - C++ nested name specifiers ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [Clang][P1061] Fix template arguments in local classes (PR #121225)

2025-07-11 Thread Matheus Izvekov via cfe-commits
@@ -4433,8 +4433,12 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, // No need to instantiate in-class initializers during explicit // instantiation. if (Field->hasInClassInitializer() && TSK == TSK_ImplicitInstantiation) { +// H

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > For obvious reasons, I wasn't able to make even a reasonably thorough review > here, but I came across a few things that seemed like good ideas. All 4 of > the patches are STILL huge. > > IMO, unless this can be more bite-sized changes, I don't know how to proceed > here. Y

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,585 @@ +//===- NestedNameSpecifier.h - C++ nested name specifiers ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > You should at minimum be able to layer the `NestedNameSpecifier` change on > top of the `TagType` change. I can't see why that wouldn't work. > > 1. Add the structure for sugary `TagType`s. > 2. Replace `ElaboratedType` with sugary `TagType`s. > 3. Change the representation of

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I'm definitely OK with accepting all of that, and would very much appreciate > it. Done. https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH 1/4] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

2025-07-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Is there ANYTHING we can do to split this up? This is so huge that github is > refusing to load half the changes. I broke the commit down into others, now the first commit only has the AST and TreeTransform changes. https://github.com/llvm/llvm-project/pull/147835 __

[clang] [Clang] Do not skip over `RequiresExprBodyDecl` when creating lambdas (PR #147764)

2025-07-10 Thread Matheus Izvekov via cfe-commits
@@ -1088,6 +1088,9 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD, return; } + while (DC->isRequiresExprBody()) +DC = DC->getParent(); mizvekov wrote: With a compound expression you can introduce lots of other kinds of DeclContexts he

[clang] [Clang] Consider default template arguments when synthesizing CTAD guides (PR #147675)

2025-07-09 Thread Matheus Izvekov via cfe-commits
@@ -1061,15 +1061,36 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, SmallVector DeduceResults( F->getTemplateParameters()->size()); + // We don't have to deduce against the alias template specialization, + // if the source template is a synthesized alias deduction

[clang] [Clang] Do not mark ambiguous specialization invalid. (PR #147275)

2025-07-07 Thread Matheus Izvekov via cfe-commits
@@ -4111,7 +4111,10 @@ static ActionResult getPatternForClassTemplateSpecialization( if (Ambiguous) { // Partial ordering did not produce a clear winner. Complain. Inst.Clear(); - ClassTemplateSpec->setInvalidDecl(); + + if (!S.isS

[clang] [Clang] Do not mark ambiguous specialization invalid. (PR #147275)

2025-07-07 Thread Matheus Izvekov via cfe-commits
@@ -4111,7 +4111,10 @@ static ActionResult getPatternForClassTemplateSpecialization( if (Ambiguous) { // Partial ordering did not produce a clear winner. Complain. Inst.Clear(); - ClassTemplateSpec->setInvalidDecl(); + + if (!S.isS

[clang] [Clang] Do not mark ambiguous specialization invalid. (PR #147275)

2025-07-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: I think marking declarations as invalid even in non-immediate context errors should not be an issue, as the declaration should not end up being used anyway. I think this is a pretty common pattern in other places. Why do we end up crashing only with this

[clang] [Clang] Do not mark ambiguous specialization invalid. (PR #147275)

2025-07-07 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/147275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [lldb] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-07 Thread Matheus Izvekov via cfe-commits
@@ -7248,6 +7248,12 @@ QualType TreeTransform::TransformDependentBitIntType( return Result; } +template +QualType TreeTransform::TransformPredefinedSugarType( +TypeLocBuilder &TLB, PredefinedSugarTypeLoc TL) { + llvm_unreachable("This type does not need to be transfor

[clang] [clang-tools-extra] [libcxx] [lldb] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-07 Thread Matheus Izvekov via cfe-commits
@@ -2258,6 +2258,30 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned NumExpansions; }; + enum class PredefinedSugarKind { +/// The "size_t" type. +SizeT, + +/// The signed integer type corresponding to "size_t". +SignedSiz

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-05 Thread Matheus Izvekov via cfe-commits
@@ -3454,9 +3454,11 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, if (Func->getNumParams() == Params.size()) { llvm::SmallVector FuncParams; for (auto *P : Func->parameters()) - FuncParams.push_back( - Context.g

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-05 Thread Matheus Izvekov via cfe-commits
@@ -3454,9 +3454,11 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, if (Func->getNumParams() == Params.size()) { llvm::SmallVector FuncParams; for (auto *P : Func->parameters()) - FuncParams.push_back( - Context.g

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-05 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
@@ -3455,9 +3454,12 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, if (Func->getNumParams() == Params.size()) { llvm::SmallVector FuncParams; for (auto *P : Func->parameters()) - FuncParams.push_back( - Context.g

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
@@ -3455,9 +3454,12 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, if (Func->getNumParams() == Params.size()) { llvm::SmallVector FuncParams; for (auto *P : Func->parameters()) - FuncParams.push_back( - Context.g

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
@@ -3397,7 +3397,8 @@ void Sema::DeclareGlobalNewDelete() { GlobalNewDeleteDeclared = true; QualType VoidPtr = Context.getPointerType(Context.VoidTy); - QualType SizeT = Context.getSizeType(); + // FIXME: Why is 'Canonical'SizeType needed here? + QualType SizeT = Contex

[clang] [Clang][Sema] Avoid duplicate diagnostics for incomplete types in nested name specifier (C++20+) (PR #147036)

2025-07-04 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I have a work in progress patch which fixes this issue, and doesn't need to take this approach of storing diagnosed entities. It's a big patch that doesn't target this issue specifically, but I remember I encountered this problem while refactoring things, and I removed the dupl

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. I think this looks good, sans a single nit, thanks! https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
@@ -2258,6 +2258,30 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned NumExpansions; }; + enum class PredefinedSugarKind { +/// The "size_t" type. +SizeT, + +/// The signed integer type corresponding to "size_t". +SignedSiz

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-07-04 Thread Matheus Izvekov via cfe-commits
@@ -3397,7 +3397,8 @@ void Sema::DeclareGlobalNewDelete() { GlobalNewDeleteDeclared = true; QualType VoidPtr = Context.getPointerType(Context.VoidTy); - QualType SizeT = Context.getSizeType(); + // FIXME: Why is 'Canonical'SizeType needed here? + QualType SizeT = Contex

[clang] [clang] odr-checker fix for conversion operators (PR #146153)

2025-06-30 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/146153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] odr-checker fix for conversion operators (PR #146153)

2025-06-30 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Thanks! I don't know if similar problems (ODR confused by the > canonicalization merging decltypes with different names of template > parameters) can show up in other cases, but as the PR fixes this particular > case LGTM. Sure, please file bug reports for any other similar

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-30 Thread Matheus Izvekov via cfe-commits
@@ -2767,6 +2767,10 @@ class DependentBitIntTypeLoc final : public InheritingConcreteTypeLoc {}; +class PredefinedSugarTypeLoc final +: public InheritingConcreteTypeLoc {}; mizvekov wrote: One thing is having to define a class, another thing is if that

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-28 Thread Matheus Izvekov via cfe-commits
@@ -5216,6 +5230,38 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, return QualType(New, 0); } +QualType +ASTContext::getPredefinedSugarType(PredefinedSugarType::Kind KD) const { + llvm::FoldingSetNodeID ID; + PredefinedSugarType::Profile(ID, llvm::to_unde

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-28 Thread Matheus Izvekov via cfe-commits
@@ -7248,6 +7250,22 @@ QualType TreeTransform::TransformDependentBitIntType( return Result; } +template +QualType TreeTransform::TransformPredefinedSugarType( +TypeLocBuilder &TLB, PredefinedSugarTypeLoc TL) { + const PredefinedSugarType *EIT = TL.getTypePtr(); + Qua

[clang] [clang-tools-extra] [libcxx] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-28 Thread Matheus Izvekov via cfe-commits
@@ -2767,6 +2767,10 @@ class DependentBitIntTypeLoc final : public InheritingConcreteTypeLoc {}; +class PredefinedSugarTypeLoc final +: public InheritingConcreteTypeLoc {}; mizvekov wrote: Yeah, but for the current uses of PredefinedSugarType in this p

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -1516,6 +1516,23 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, MSGuidTagDecl = buildImplicitRecord("_GUID"); getTranslationUnitDecl()->addDecl(MSGuidTagDecl); } + + // size_t (C99TC3 6.5.3.4), signed size_t (C++23 5.13.2) and + // ptrdiff_t (C99

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -2258,6 +2258,27 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned NumExpansions; }; + enum class PredefinedSugarKind { +/// The "size_t" type. +SizeT, + +/// The "signed size_t" type. mizvekov wrote: Well

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -6796,14 +6836,25 @@ QualType ASTContext::getTagDeclType(const TagDecl *Decl) const { /// getSizeType - Return the unique type for "size_t" (C99 7.17), the result /// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and /// needs to agree with the defin

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -1567,6 +1567,8 @@ class ASTContext : public RefCountedBase { /// and bit count. QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const; + QualType getPredefinedSugarType(uint32_t KD) const; mizvekov wrote: You can use enums in TypePrope

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -2258,6 +2258,27 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned NumExpansions; }; + enum class PredefinedSugarKind { +/// The "size_t" type. +SizeT, + +/// The "signed size_t" type. mizvekov wrote: ```su

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -2767,6 +2767,10 @@ class DependentBitIntTypeLoc final : public InheritingConcreteTypeLoc {}; +class PredefinedSugarTypeLoc final +: public InheritingConcreteTypeLoc {}; mizvekov wrote: These should ideally never be used in practice, as a Predefined

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -5216,6 +5237,25 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, return QualType(New, 0); } +QualType ASTContext::getPredefinedSugarType(uint32_t KD) const { + using Kind = PredefinedSugarType::Kind; + auto getUnderlyingType = [](const ASTContext &Ctx,

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -1480,6 +1480,16 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, return false; break; } + case Type::PredefinedSugar: { +const auto *TP1 = cast(T1); +const auto *TP2 = cast(T2); +if (TP1->getKind() != TP2->getKind()) +

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -6796,14 +6836,25 @@ QualType ASTContext::getTagDeclType(const TagDecl *Decl) const { /// getSizeType - Return the unique type for "size_t" (C99 7.17), the result /// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and /// needs to agree with the defin

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -5622,3 +5622,15 @@ HLSLAttributedResourceType::findHandleTypeOnResource(const Type *RT) { } return nullptr; } + +StringRef PredefinedSugarType::getName() const { + switch (getKind()) { + case Kind::SizeT: +return "__size_t"; + case Kind::SignedSizeT: +return

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -8038,6 +8060,32 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode { } }; +class PredefinedSugarType final : public Type { +public: + friend class ASTContext; + using Kind = PredefinedSugarKind; + +private: + PredefinedSugarType(Kind KD, Qu

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -1567,6 +1567,8 @@ class ASTContext : public RefCountedBase { /// and bit count. QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const; + QualType getPredefinedSugarType(uint32_t KD) const; mizvekov wrote: It would be more helpful and l

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -1516,6 +1516,23 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, MSGuidTagDecl = buildImplicitRecord("_GUID"); getTranslationUnitDecl()->addDecl(MSGuidTagDecl); } + + // size_t (C99TC3 6.5.3.4), signed size_t (C++23 5.13.2) and + // ptrdiff_t (C99

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -5216,6 +5237,25 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, return QualType(New, 0); } +QualType ASTContext::getPredefinedSugarType(uint32_t KD) const { + using Kind = PredefinedSugarType::Kind; + auto getUnderlyingType = [](const ASTContext &Ctx,

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -8038,6 +8060,32 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode { } }; +class PredefinedSugarType final : public Type { +public: + friend class ASTContext; + using Kind = PredefinedSugarKind; + +private: + PredefinedSugarType(Kind KD, Qu

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Thanks, this looks good! It would be awesome to use these in existing cases which we handle with a builtin typedef, as this would be helpful to validate the design, but this is not required and doesn't need to be part of this PR. https://github.com/llvm/

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -7248,6 +7250,22 @@ QualType TreeTransform::TransformDependentBitIntType( return Result; } +template +QualType TreeTransform::TransformPredefinedSugarType( +TypeLocBuilder &TLB, PredefinedSugarTypeLoc TL) { + const PredefinedSugarType *EIT = TL.getTypePtr(); + Qua

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
@@ -14526,6 +14564,9 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, DX->isCountInBytes(), DX->isOrNull(), CDX); } + case Type::PredefinedSugar: +// FIXME: Should this

[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] ODR hashes depth+index and not name of TemplateTypeParm (PR #144796)

2025-06-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: Thanks! This should be fixed by https://github.com/llvm/llvm-project/pull/146153 https://github.com/llvm/llvm-project/pull/144796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang] odr-checker fix for conversion operators (PR #146153)

2025-06-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/146153 This fixes an issue with the ODR checker not using the as-written type of conversion operators. The odr-checker in general should not have to deal with canonical types, as its purpose is to compare same defin

[clang] [clang] ms-abi: member pointer inheritance model lock-down fix (PR #145958)

2025-06-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/145958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] ms-abi: member pointer inheritance model lock-down fix (PR #145958)

2025-06-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/145958 Lock down the inheritance model for member pointers even when converting from nullptr. This fixes a regression introduced in https://github.com/llvm/llvm-project/pull/131966 There are no release notes, since

[clang] [clang] ODR hashes depth+index and not name of TemplateTypeParm (PR #144796)

2025-06-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov requested changes to this pull request. The fix doesn't look quite right. It's not correct to say that canonicalization changes the declaration name. We don't canonicalize declarations after all. It's just that a canonical template parameter type doesn't refer to a

[clang] [clang] NFC: introduce UnsignedOrNone as a replacement for std::optional (PR #134142)

2025-06-19 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Just noticed that this is not using `std::optional`. If this is > good, why don't we put this to `llvm/ADT`? I feel that is a better place. I don't disagree in principle, we just don't need to preempt making this available for all of llvm, if no one has the time to make a pat

[clang] [Clang] Fix the clang/test/PCH/ignored-pch.c test. (PR #144737)

2025-06-18 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. https://github.com/llvm/llvm-project/pull/144737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Thanks for this! I have left a small review, but since I am traveling to the WG21 meeting, I can't look much into it for the next couple of weeks. Also, please try this on the llvm compile time tracker, and take a look at any changes to the amount of AST

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -117,3 +117,4 @@ def PipeType : TypeNode; def AtomicType : TypeNode; def BitIntType : TypeNode; def DependentBitIntType : TypeNode, AlwaysDependent; +def PredefinedSugarType : TypeNode, NeverCanonical; mizvekov wrote: Missing newline at the end of the file.

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -7246,6 +7250,24 @@ QualType TreeTransform::TransformDependentBitIntType( return Result; } +template +QualType TreeTransform::TransformPredefinedSugarType( +TypeLocBuilder &TLB, PredefinedSugarTypeLoc TL) { + const PredefinedSugarType *EIT = TL.getTypePtr(); + Qua

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -1480,6 +1480,14 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, return false; break; } + case Type::PredefinedSugar: { +const auto *TP1 = cast(T1); +const auto *TP2 = cast(T2); + +if (TP1->getKind() != TP2->getKind())

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -5148,6 +5153,14 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, return QualType(New, 0); } +QualType ASTContext::getPredefinedSugarType(uint32_t KD, +QualType UnderlyingType) const { + auto *New = new (*this,

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -2528,8 +2528,13 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { Align = static_cast(Width); } } + break; + case Type::PredefinedSugar: +return getTypeInfo(cast(T)->desugar().getTypePtr()); +break; mizvekov wrote: `

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -8054,6 +8054,41 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode { } }; +class PredefinedSugarType final : public Type { +public: + enum Kind { SizeT, SignedSizeT, PtrdiffT }; + friend class ASTContext; + +private: + Kind K; + QualType U

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -1894,6 +1894,12 @@ ExpectedType clang::ASTNodeImporter::VisitDependentBitIntType( *ToNumBitsExprOrErr); } +ExpectedType clang::ASTNodeImporter::VisitPredefinedSugarType( +const clang::PredefinedSugarType *T) { +

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -8054,6 +8054,41 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode { } }; +class PredefinedSugarType final : public Type { +public: + enum Kind { SizeT, SignedSizeT, PtrdiffT }; + friend class ASTContext; + +private: + Kind K; + QualType U

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/143653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

2025-06-14 Thread Matheus Izvekov via cfe-commits
@@ -14536,6 +14589,9 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, DX->isCountInBytes(), DX->isOrNull(), CDX); } + case Type::PredefinedSugar: { +return QualType(); +

[clang] [clang] Fix bad error recovery when classes are defined inside template (PR #142278)

2025-06-11 Thread Matheus Izvekov via cfe-commits
@@ -220,6 +220,14 @@ static ExprResult EvaluateAtomicConstraint( if (Inst.isInvalid()) return ExprError(); +if (const TemplateTypeParmType *TTPT = + dyn_cast(AtomicExpr->getType().getDesugaredType(S.Context))) { + TemplateTypeParmDecl *TTPD = TTPT->

  1   2   3   4   5   6   7   8   9   10   >