[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->

[clang-tools-extra] [clang-tidy] add AllowedTypes option to misc-const-correctness (PR #122951)

2025-06-11 Thread Matheus Izvekov via cfe-commits
@@ -0,0 +1,180 @@ +// RUN: %check_clang_tidy %s misc-const-correctness %t -- \ +// RUN: -config="{CheckOptions: {\ +// RUN: misc-const-correctness.AllowedTypes: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$;qualified::Type;::fully::QualifiedType;ConstTemplate', \ +// RUN: misc

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t literals be typedefs instead of built-in types (PR #143653)

2025-06-11 Thread Matheus Izvekov via cfe-commits
@@ -320,6 +321,69 @@ bool clang::analyze_format_string::ParseUTF8InvalidSpecifier( // Methods on ArgType. //===--===// +static bool namedTypeToLengthModifierKind(QualType QT, +

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t literals be typedefs instead of built-in types (PR #143653)

2025-06-11 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 result type of sizeof/pointer subtraction/size_t literals be typedefs instead of built-in types (PR #143653)

2025-06-10 Thread Matheus Izvekov via cfe-commits
@@ -6726,17 +6726,63 @@ QualType ASTContext::getTagDeclType(const TagDecl *Decl) const { return getTypeDeclType(const_cast(Decl)); } +// Inject __size_t, __signed_size_t, and __ptrdiff_t to provide portable hints +// and diagnostics. In C and C++, expressions of type size_t

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t literals be typedefs instead of built-in types (PR #143653)

2025-06-10 Thread Matheus Izvekov via cfe-commits
@@ -1961,11 +1969,20 @@ class ASTContext : public RefCountedBase { /// . /// /// The sizeof operator requires this (C99 6.5.3.4p4). - CanQualType getSizeType() const; + QualType getSizeType() const; mizvekov wrote: Can you provide `CanQualType getCanon

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t literals be typedefs instead of built-in types (PR #143653)

2025-06-10 Thread Matheus Izvekov via cfe-commits
@@ -320,6 +321,69 @@ bool clang::analyze_format_string::ParseUTF8InvalidSpecifier( // Methods on ArgType. //===--===// +static bool namedTypeToLengthModifierKind(QualType QT, +

[clang] Reland: "[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)" (PR #143614)

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

[clang] Reland: "[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)" (PR #143614)

2025-06-10 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM. So what changed since the last commit is that preprocessing-only mode doesn't imply the semantics of this flag anymore. I think It's good practice to mention what changed since original landing. https://github.com/llvm/llvm-project

[clang] Reland: "[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)" (PR #143614)

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

[clang] [Clang] Add a `value_or` helper to `UnsignedOrNone` (PR #143516)

2025-06-10 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: No strong objections, but I'd prefer to wait as well. This was one thing I looked into adding when I initially implemented it, but all potential uses turned out better without it. https://github.com/llvm/llvm-project/pull/143516 ___ c

[clang] add6acc - NFC: stray whitespace cleanup from clang/test/SemaCXX/destructor.cpp

2025-06-09 Thread Matheus Izvekov via cfe-commits
Author: Matheus Izvekov Date: 2025-06-09T19:08:15-03:00 New Revision: add6acc333740542705eedd185f45f69e3d25f30 URL: https://github.com/llvm/llvm-project/commit/add6acc333740542705eedd185f45f69e3d25f30 DIFF: https://github.com/llvm/llvm-project/commit/add6acc333740542705eedd185f45f69e3d25f30.dif

[clang] [Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (PR #142409)

2025-06-09 Thread Matheus Izvekov via cfe-commits
@@ -324,6 +324,8 @@ New Compiler Flags - New option ``-Wnrvo`` added and disabled by default to warn about missed NRVO opportunities. +- New option ``-ignore-pch`` added to disable precompiled headers, override ``-emit-pch`` and ``-include-pch`` (#GH142409, `PCHDocs

[clang] [Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (PR #142409)

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

[clang] [C++20][Modules] Fix false compilation error with constexpr (PR #143168)

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

[clang] [C++20][Modules] Fix false compilation error with constexpr (PR #143168)

2025-06-08 Thread Matheus Izvekov via cfe-commits
@@ -6781,7 +6781,7 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This, // and make sure we've initialized every step along it. auto IndirectFieldChain = IFD->chain(); for (auto *C : IndirectFieldChain) { -FD = cast(C); +FD

[clang] [clang] AST: fix dependency calculation for TypedefTypes (PR #143291)

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

[clang] [clang] AST: fix dependency calculation for TypedefTypes (PR #143291)

2025-06-08 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/143291 >From d623054729e75adc5299ecd426b19863962cafbc Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 7 Jun 2025 21:33:07 -0300 Subject: [PATCH] [clang] AST: fix dependency calculation for TypedefTypes The

  1   2   3   4   5   6   7   8   9   10   >