[clang] [clang] fix obtaining EnumDecl for UsingEnumDecl (PR #156127)

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

[clang] [clang] fix obtaining EnumDecl for UsingEnumDecl (PR #156127)

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

[clang] [clang] fix obtaining EnumDecl for UsingEnumDecl (PR #156127)

2025-08-29 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/156127 Use the castAs acessor for the type for a UsingEnumDecl, as it can be sugar for an EnumType. Fixes a regression reported here: https://github.com/llvm/llvm-project/pull/155313#issuecomment-3238482327 Since t

[clang] [clang-tools-extra] [clang][AST] Fix source range of class template implicit instantiations. (PR #156011)

2025-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > The most important part for me, is that if > `TagDecl::isThisDeclarationADefinition()` returns true, then I need > `getSourceRange()` to return the content of the definition. That's a more interesting limited part of the problem. It seems strange to me that we produce a temp

[clang] [clang][AST] Fix source range of class template implicit instantiations. (PR #156011)

2025-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Thanks for the feedback @mizvekov. I propose this change for the following > reasons: > > * Class template implicit instantiations have technically no source range > anywhere, which is why I think having the same behavior as function template > implicit instantiations or var

[clang] Using type deduction to define __SIZE_TYPE__ and __PTRDIFF_TYPE__ (PR #155979)

2025-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Which file is appropriate to add it to? Or should I create a new file? For common-type concerns, you can add it to `Sema/sugar-common-types.c` for C code, or `clang/test/SemaCXX/sugar-common-types.cpp` for C++. For AST dumps, I don't see a great fit anywhere, so if you create

[clang] Using type deduction to define __SIZE_TYPE__ and __PTRDIFF_TYPE__ (PR #155979)

2025-08-29 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: You could include your opening snippet as a test case within the patch. Or even a simple AST dump test case showing these types contain __size_t et al as bottom-level sugar. https://github.com/llvm/llvm-project/pull/155979 ___ cfe-com

[clang] [clang][AST] Fix source range of class template implicit instantiations. (PR #156011)

2025-08-29 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Why is this the correct behavior, rather than the other way around? The patch seems to leave no way to query the source range of this declaration, rather than the definition. On the other hand, querying the source range of the definition is currently pos

[clang] [clang-tools-extra] [lldb] [clang] NFC: rename clang/include/clang/AST/Type.h to TypeBase.h (PR #155049)

2025-08-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > If they are including `Type.h` in files that only exist downstream that will > force them to deal with this both times around, unless I am missing something. No, they would only have had to do that if they had rebased in between this commit landing and the next one, but that

[clang] [clang] fix nested tags of the same name not being included in their … (PR #155965)

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

[clang] [clang] fix nested tags of the same name not being included in their context (PR #155965)

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

[clang] [clang] fix nested tags of the same name not being included in their context (PR #155965)

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

[clang] [clang] fix nested tags of the same name not being included in their context (PR #155965)

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

[clang] [clang] fix nested tags of the same name not being included in their … (PR #155965)

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

[clang] [clang] fix nested tags of the same name not being included in their … (PR #155965)

2025-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155965 …context Fix an error in the logic meant to handle a redeclaration such as: ```C++ struct A { struct __attribute__((foo)) A *ptr; }; ``` In the declaration of ptr, we must introduce a new redeclaration of A i

[clang] [clang] NFC: remove leftover from injected class name redecl (PR #155959)

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

[clang] [clang] NFC: remove leftover from injected class name redecl (PR #155959)

2025-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155959 The code being removed became non-functional when injected class names were removed from the redecl chain in 470c454a6176ef31474553e408c90f5ee630df89, but that commit didn't clean the code base out of all the

[clang] [clang] fix obtaining underlying type for demoted enum definitions (PR #155900)

2025-08-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Hi -- sidenote, but I noticed that this commit -- and many other of your > commits -- are missing the entire commit message other than the PR title. I > don't know if that's a github preference or something you're doing manually, > but it's really unfortunate because then I c

[clang] [clang] fix uniquing of some TagTypes created from the injected class name (PR #155347)

2025-08-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I don't think that helps, however the patch is a bit simple, so you could maybe sort of reverse engineer what could have gone wrong from it. For example, before this patch we would have produced non-identical CXXRecordTypes from basically the same information. There is probab

[clang] [clang] fix regression parsing C enum which doesn't declare anything (PR #155904)

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

[clang] [clang] fix obtaining underlying type for demoted enum definitions (PR #155900)

2025-08-28 Thread Matheus Izvekov via cfe-commits
@@ -18544,8 +18544,14 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, if (PrevDecl) CheckRedeclarationInModule(New, PrevDecl); - if (TUK == TagUseKind::Definition && (!SkipBody || !SkipBody->ShouldSkip)) -New->startDefinition();

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @jyknight thanks, this will be fixed here: https://github.com/llvm/llvm-project/pull/155900 https://github.com/llvm/llvm-project/pull/155028 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [clang] fix obtaining underlying type for demoted enum definitions (PR #155900)

2025-08-28 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155900 Clang skips parsing a TagDecl definition in case a definition was already parsed in another module. In those cases, an EnumDecl might be left without an IntegerType. Take this into account when getting the un

[clang] [clang] MicrosoftMangle: pick correct tagdecl for mangling tagkind (PR #155662)

2025-08-28 Thread Matheus Izvekov via cfe-commits
@@ -3246,13 +3246,17 @@ void MicrosoftCXXNameMangler::mangleTagTypeKind(TagTypeKind TTK) { } void MicrosoftCXXNameMangler::mangleType(const EnumType *T, Qualifiers, SourceRange) { - mangleType(cast(T)->getOriginalDecl()->getDefinitionO

[clang] [clang-tools-extra] [clang] NFC: change more places to use Type::getAsTagDecl and friends (PR #155313)

2025-08-28 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: It was split off from another PR, which had reviewers. https://github.com/llvm/llvm-project/pull/155313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] fix regression printing constructor/destructor names (PR #155688)

2025-08-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Should this be a new issue? I vaguely remember having created such an issue in the past, but I can't find it, so I created a new one in any case: https://github.com/llvm/llvm-project/issues/155709 https://github.com/llvm/llvm-project/pull/155688 _

[clang] [clang] fix regression printing constructor/destructor names (PR #155688)

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

[clang] [clang] fix regression printing constructor/destructor names (PR #155688)

2025-08-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155688 This makes the type printer not qualify constructor and destructor names. These are represented as canonical types and the type printer is used, but unlike canonical types which we normally print as fully qual

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

2025-08-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: The MSVC mangling issue is resolved here: https://github.com/llvm/llvm-project/pull/155662 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] [clang] MicrosoftMangle: pick correct tagdecl for mangling tagkind (PR #155662)

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

[clang] [clang] NFC: Provide inline definitions for {get, cast}TagDecl and friends (PR #155051)

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

[clang] [clang-tools-extra] [lldb] [clang] NFC: rename clang/include/clang/AST/Type.h to TypeBase.h (PR #155049)

2025-08-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/155049 ___ 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-08-27 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > (I think this was covered by tests even, right?) No, this patch didn't change any existing mangling tests at all, the behavior in question here was untested. https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing l

[clang] [clang] NFC: Provide inline definitions for {get, cast}TagDecl and friends (PR #155051)

2025-08-27 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155051 >From c5d57c558d63380f726260d1c14d6f40162e9114 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Fri, 22 Aug 2025 15:16:27 -0300 Subject: [PATCH] [clang] NFC: Provide inline definitions for {get,cast}TagDecl

[clang] [clang-tools-extra] [lldb] [clang] NFC: reintroduce clang/include/clang/AST/Type.h (PR #155050)

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

[clang] [clang-tools-extra] [lldb] [clang] NFC: Provide inline definitions for {get,cast}TagDecl and friends (PR #155051)

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

[clang] [clang-tools-extra] [lldb] [clang] NFC: reintroduce clang/include/clang/AST/Type.h (PR #155050)

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

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

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

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155028 >From 63542d5cdeccb17b9125430d0a984f45d58e208c Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Fri, 22 Aug 2025 19:10:05 -0300 Subject: [PATCH 1/2] meat and potatoes --- clang/include/clang/AST/Type.h

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

2025-08-26 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @aeubanks I see, so that's unfortunate MSVC mangles the struct / class difference. This is a different problem than I had in mind. So MSVC mangles according to the tag kind of the first declaration, clang after this changes now mangles it according to thedeclaration found

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-26 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I did another offloading of NFC changes to another patch. This PR is tiny now in comparison. https://github.com/llvm/llvm-project/pull/155028 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-26 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155028 >From 7a334282f87fa5a2135cc35771cc7d99724d89ac Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Fri, 22 Aug 2025 19:10:05 -0300 Subject: [PATCH 1/2] meat and potatoes --- clang/include/clang/AST/Type.h

[clang] [clang-tools-extra] [clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all TagDecls (PR #155463)

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

[clang] [clang-tools-extra] [clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all TagDecls (PR #155463)

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

[clang] [clang-tools-extra] [clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all TagDecls (PR #155463)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-26 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Great see commit > [`af63956`](https://github.com/llvm/llvm-project/pull/148914/commits/af6395691ad98c3763d89e4794f353e77f0e3d9b). > I just stole the pattern from the array canonicalization code. Added tests > too. Great, there are other places that need to be updated to han

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-26 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I'm getting conflicting ideas from this sentence. Do you mean to say that the > two types from your example should be the _same_ type? Yes. https://github.com/llvm/llvm-project/pull/148914 ___ cfe-commits mailing list cfe-commits@li

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

2025-08-25 Thread Matheus Izvekov via cfe-commits
@@ -5254,153 +5253,297 @@ ASTContext::getPredefinedSugarType(PredefinedSugarType::Kind KD) const { return QualType(New, 0); } -#ifndef NDEBUG -static bool NeedsInjectedClassNameType(const RecordDecl *D) { - if (!isa(D)) return false; - const auto *RD = cast(D); - if (isa

[clang] [clang] fix uniquing of some TagTypes created from the injected class name (PR #155347)

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

[clang] [clang] fix TemplateName Subst* nodes transform (PR #155342)

2025-08-25 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/155342 ___ 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-08-25 Thread Matheus Izvekov via cfe-commits
@@ -5254,153 +5253,297 @@ ASTContext::getPredefinedSugarType(PredefinedSugarType::Kind KD) const { return QualType(New, 0); } -#ifndef NDEBUG -static bool NeedsInjectedClassNameType(const RecordDecl *D) { - if (!isa(D)) return false; - const auto *RD = cast(D); - if (isa

[clang] [clang] fix uniquing of some TagTypes created from the injected class name (PR #155347)

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

[clang] [clang] fix uniquing of some TagTypes created from the injected class name (PR #155347)

2025-08-25 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155347 This fixes a bug in the fast path for the creation of TagTypes from injected class names. The creation of TagTypes has a fast path which, when there is no elaboration, uses storage in the declaration itself f

[clang] [clang] fix TemplateName Subst* nodes transform (PR #155342)

2025-08-25 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155342 This makes sure NestedNameSpecifierLocs don't apply to the replacement TemplateName of SubstTemplate* nodes. Also removes improper name qualification over these Subst Nodes, causing some canonical TemplateNam

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

2025-08-25 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @michaelrj-google > ``` >::sapi::v::IntBase v_type__(type__); > ``` > > which clang errors on. And that enum type, is that created by Sema, or is that synthesized by code from within your project? If you are creating that type as a canonical type, or that type is being c

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

2025-08-25 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: @aeubanks can you get us a reproducer? 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] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-25 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > If the change breaks LLDB then you should also fix that break as well. Yes of course, but the parts already in the PR can be reviewed independently of that. https://github.com/llvm/llvm-project/pull/155120 ___ cfe-commits mailing li

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

2025-08-25 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > The previous revision compiles the reduced successfully. Can you please take > a look? Fixed in https://github.com/llvm/llvm-project/pull/155272 https://github.com/llvm/llvm-project/pull/147835 ___ cfe-commits mailing list cfe-commi

[clang] [clang] fix runtime check listing types which can appear in a NestedNameSpecifier (PR #155272)

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

[clang] [clang] fix runtime check listing types which can appear in a NestedNameSpecifier (PR #155272)

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

[clang] [clang] fix runtime check listing types which can appear in a NestedNameSpecifier (PR #155272)

2025-08-25 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155272 Through alias templates, followed by canonicalization, any canonical dependent type can appear in a NestedNameSpecifier. Remove the list as a practical matter. This fixes a regression reported here: https://g

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-24 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > The only thing that "leaf type" means is that there's no point in doing > anything except `dyn_cast`ing the canonical type. It's not a real language > concept, and we don't use the type property for any purpose except these > `getAs` specializations. So if the specializations

[clang] [llvm] Singleton hack of fixing static initialisation order fiasco (PR #154541)

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

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
@@ -95,24 +95,25 @@ TC https://github.com/llvm/llvm-project/pull/155120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155120 >From e1c4ead49256ce93ca35dda58b57d96fdb7e001d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 9 Aug 2025 18:14:46 -0300 Subject: [PATCH] [clang] remove isDefaulted bit from TemplateArgument The IsDe

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155120 >From 6f039d0a53ef53436624b6493bfcf3b6c9ba36cb Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 9 Aug 2025 18:14:46 -0300 Subject: [PATCH] [clang] remove isDefaulted bit from TemplateArgument The IsDe

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155120 >From 85ba1ffd8726a1596dfd3aebfd56ebed0460cf77 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 9 Aug 2025 18:14:46 -0300 Subject: [PATCH] [clang] remove isDefaulted bit from TemplateArgument The IsDe

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155120 >From f31c4e385a66cf3e6c7aab499bcba7bd271902fb Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 9 Aug 2025 18:14:46 -0300 Subject: [PATCH] [clang] remove isDefaulted bit from TemplateArgument The IsDe

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/155120 >From 3996f1f23d55e5d3fa121a75e015ce7fbd3624ca Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 9 Aug 2025 18:14:46 -0300 Subject: [PATCH] [clang] remove isDefaulted bit from TemplateArgument The IsDe

[clang] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: As I explained in the commit message, this is not removing the feature. The information about which arguments were defaulted was already available in the AST before this bit was added. And the bit is not correct as I said, being part of the canonical type means that this infor

[clang] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/155120 The IsDefaulted bit being part of a canonical TemplateArgument doesn't make sense, as that information is not information a canonical type should have. In C++, all template specialization types for ther same t

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

2025-08-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Seems like `getOriginalDecl()` always returns the full definition for > enumerations (and not an opaque declaration for enums with fixed underlying > type), at least in the C language mode. Is it guaranteed? I don't see that happening. Example: https://compiler-explorer.com/z

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

2025-08-23 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > Related, I think the change to [`void TypePrinter::printUsingBefore(const > UsingType *T, raw_ostream > &OS)`](https://github.com/llvm/llvm-project/blame/d439c9ea4a19bf783120d8efee5e67131550/clang/lib/AST/TypePrinter.cpp#L1227) > might be causing similar issues. The `getK

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

2025-08-22 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > 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 (

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: How about inner qualifiers? The patch doesn't address the situation. For a test like: ```C++ using ConstInt = const int; using WrapConstInt1 = ConstInt __attribute__((overflow_behavior(wrap))); using WrapConstInt2 = const int __attribute__((overflow_behavio

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -5776,6 +5826,51 @@ QualType ASTContext::getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, return QualType(Ty, 0); } +QualType ASTContext::getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, + QualType Underlying) co

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -2844,6 +2872,8 @@ inline T TypeLoc::getAsAdjusted() const { Cur = ATL.getModifiedLoc(); else if (auto ATL = Cur.getAs()) Cur = ATL.getWrappedLoc(); +// else if (auto ATL = Cur.getAs()) +// Cur = ATL.getWrappedLoc(); mizvekov wrote:

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -8914,6 +8975,12 @@ inline bool Type::isIntegerType() const { return IsEnumDeclComplete(ET->getOriginalDecl()) && !IsEnumDeclScoped(ET->getOriginalDecl()); } + + if (isOverflowBehaviorType()) +return cast(CanonicalType) +->getUnderlyingType() +

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -9120,6 +9191,8 @@ template const T *Type::getAsAdjusted() const { Ty = A->getModifiedType().getTypePtr(); else if (const auto *A = dyn_cast(Ty)) Ty = A->getWrappedType().getTypePtr(); +// else if (const auto *A = dyn_cast(Ty)) +// Ty = A->getWrap

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -405,6 +405,10 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const { argTy = PT->getPointeeType(); } + if (const OverflowBehaviorType *OBT = + dyn_cast(argTy.getCanonicalType())) +argTy = OBT->getUnderlyingType(); + mizvekov wro

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -74,6 +74,13 @@ QualType clang::desugarForDiagnostic(ASTContext &Context, QualType QT, QT = AT->desugar(); continue; } +// ... or an overflow behavior type. +if (const OverflowBehaviorType *OBT = dyn_cast(Ty)) { + if (!OBT->isSugared()) +

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -6660,6 +6672,51 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class OverflowBehaviorType : public Type, public llvm::FoldingSetNode { +public: + enum OverflowBehaviorKind { Wrap, NoWrap }; + +private: + friend class ASTContext; // AS

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -11710,6 +11809,48 @@ QualType ASTContext::mergeTagDefinitions(QualType LHS, QualType RHS) { return Ctx.IsEquivalent(LHS, RHS) ? LHS : QualType{}; } +std::optional ASTContext::tryMergeOverflowBehaviorTypes( +QualType LHS, QualType RHS, bool OfBlockPointer, bool Unqua

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -870,6 +870,42 @@ ASTContext::insertCanonicalTemplateTemplateParmDeclInternal( return CanonTTP; } +/// For the purposes of overflow pattern exclusion, does this match the +/// while(i--) pattern? +static bool matchesPostDecrInWhile(const UnaryOperator *UO, ASTContext &Ct

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -649,6 +649,10 @@ template <> const CountAttributedType *Type::getAs() const { return getAsSugar(this); } +template <> const OverflowBehaviorType *Type::getAs() const { + return getAsSugar(this); +} mizvekov wrote: The `OverflowBehaviorType` is never a

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -14308,6 +14455,12 @@ static QualType getCommonNonSugarTypeNode(const ASTContext &Ctx, const Type *X, getCommonTypeKeyword(NX, NY, /*IsSame=*/true), getCommonQualifier(Ctx, NX, NY, /*IsSame=*/true), NX->getIdentifier()); } + case Type::OverflowBehavior: {

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Some comments, I will try a more through review later. https://github.com/llvm/llvm-project/pull/148914 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -3780,6 +3780,11 @@ void MicrosoftCXXNameMangler::mangleType(const HLSLInlineSpirvType *T, llvm_unreachable("HLSL uses Itanium name mangling"); } +void MicrosoftCXXNameMangler::mangleType(const OverflowBehaviorType *T, + Qualifiers

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

2025-08-22 Thread Matheus Izvekov via cfe-commits
@@ -2586,8 +2561,9 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty, } case Type::InjectedClassName: -mangleSourceNameWithAbiTags( -cast(Ty)->getDecl()); +mangleSourceNameWithAbiTags(cast(Ty) +->getOrig

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

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

[clang] [clang-tools-extra] [clang] AST: fix getAs canonicalization of leaf types (PR #155028)

2025-08-22 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/155028 ___ 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-08-21 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: > I'm trying to reduce a crash that only reproduces w/ in module builds. Does > this sound familiar? > > ``` > assertion failed at clang/lib/AST/RecordLayoutBuilder.cpp:3380 in const > ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const RecordDecl *) > const: D && "Ca

[clang] [clang-tools-extra] Revert "[Clang] Add a builtin that deduplicate types into a pack (#106730)" (PR #154606)

2025-08-20 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: FWIW all of these switches have "not handled" cases, where it would be easy to just throw another case for the new type node in there. https://github.com/llvm/llvm-project/pull/154606 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [clang] build UnresolvedUsingType for constructor initializers (PR #154592)

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

[clang] [clang] build UnresolvedUsingType for constructor initializers (PR #154592)

2025-08-20 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/154592 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 missi

[clang] [llvm] Singleton hack of fixing static initialisation order ficaso (PR #154541)

2025-08-20 Thread Matheus Izvekov via cfe-commits
@@ -126,7 +130,7 @@ const TensorSpec llvm::DefaultDecisionSpec = TensorSpec::createSpec(DefaultDecisionName, {1}); const char *const llvm::RewardName = "delta_size"; -CallBase *getInlinableCS(Instruction &I) { +static CallBase *getInlinableCS(Instruction &I) {

[clang] [llvm] Singleton hack of fixing static initialisation order ficaso (PR #154541)

2025-08-20 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov approved this pull request. LGTM, Thanks. The changes are a strict improvement. Pre-existing problem, but it sure looks iffy to me that these data structures are global, not attached to any context. https://github.com/llvm/llvm-project/pull/154541 _

[clang] [llvm] Singleton hack of fixing static initialisation order ficaso (PR #154541)

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

[clang] Skip test added in #154418 to work when the default is C++20. (PR #154463)

2025-08-19 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: That's also better than disabling the test, but we don't need to test that we produce this warning, this test is not about that. It's a regression test for a crash and the warning is irrelevant. https://github.com/llvm/llvm-project/pull/154463

  1   2   3   4   5   6   7   8   9   10   >