[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall requested changes to this pull request. Flagging as changes requested to at least verify that this doesn't change ABI for Darwin. https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lis

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-17 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Thanks, that addresses my testing concern. https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -5238,6 +5238,14 @@ inline bool IsEnumDeclScoped(EnumDecl *ED) { return ED->isScoped(); } +/// Return the integer type corresponding to the given decl. +/// +/// We use this function to break a cycle between the inline definitions in +/// Type.h and Decl.h. +inline QualTy

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2774,7 +2774,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { bool hasFloatingRepresentation() const; /// Determine whether this type has a boolean representation - /// of some sort. + /// of some sort, e.g., it is a boolean type or a vector

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-22 Thread John McCall via cfe-commits
rjmccall wrote: That's fine with me, yeah. https://github.com/llvm/llvm-project/pull/136038 ___ 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 lit… (PR #136542)

2025-04-23 Thread John McCall via cfe-commits
rjmccall wrote: > > At least, it must ensure that `__size_t` is equivalent to `size_t` and > > generates the same mangled name. > > Is that possible? @rjmccall If `size_t` is a different type from `__size_t`, then `void foo(size_t);` declares a different entity from `void foo(__size_t);`. The

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-23 Thread John McCall via cfe-commits
rjmccall wrote: That is not possible, and this is exactly what I'm worried about with all this discussion about making `size_t` more "built-in". `size_t` is specified to be a typedef of a (platform-dependent) standard integer type, and it needs to continue to behave that way; we cannot actuall

[clang] [clang][headers][Apple] Don't include_next float.h to avoid an unnecessary module dependency (PR #137432)

2025-04-29 Thread John McCall via cfe-commits
rjmccall wrote: Messing around with `#include_next` is scary, but the problems are always thorny reasons that only come up in intense testing; I don't see anything obviously wrong, and I trust @ian-twilightcoder to have done the investigation properly. LGTM. https://github.com/llvm/llvm-proje

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-30 Thread John McCall via cfe-commits
rjmccall wrote: > > Similarly, ObjC selector components exist outside of the normal keyword > > rules, and the warning should never kick in on them. > > I don't know about selectors all that much; can you give me a test case that > you think I should handle? In general: look at `ParseObjCSele

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-30 Thread John McCall via cfe-commits
rjmccall wrote: Yeah, triggering this at the preprocessor level is not going to let you do in properly in Objective-C, where keywords are effectively context-sensitive. If that's the only reasonable way to implement it, you should just turn it off in Objective-C completely. https://github.com

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Functionality seems fine. A couple minor requests, then LGTM. https://github.com/llvm/llvm-project/pull/136867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
@@ -6001,8 +6001,18 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, for (auto it = EHStack.find(CurrentCleanupScopeDepth); it != EHStack.end(); ++it) { EHCleanupScope *Cleanup = dyn_cast(&*it); - if (!(Cleanup && Cleanup->getCleanup(

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
@@ -0,0 +1,56 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -emit-llvm -fextend-variable-liveness -o - %s | FileCheck %s + +/// Tests that when we have fake uses in a function ending in a musttail call,

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/136867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr rjmccall wrote: I think Eli is asking for you to note in the text tha

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-15 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-15 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-29 Thread John McCall via cfe-commits
rjmccall wrote: The ObjC `@` is essentially an escape into a completely different grammar, and it doesn't matter whether the following identifier is a keyword or not in the base language. This warning should never kick in on that identifier. Similarly, ObjC selector components exist outside of

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-05-01 Thread John McCall via cfe-commits
rjmccall wrote: > For what it's worth, the existing "keyword from language you're not using" > warnings [already fire for analogous Objective-C++ > cases](https://godbolt.org/z/3K6835PPK)... which in those cases is correct, > since Clang does _not_ accept C++11-onwards keywords as selector nam

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-21 Thread John McCall via cfe-commits
rjmccall wrote: It's fine to make these operators look up and use the `size_t` / `ptrdiff_t` typedefs if they're available and have the right type. We would need to apply an allowlist to the attributes on the typedef, too — it would be quite abusive, but someone could use an `aligned` attribut

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-17 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID:

[clang] Allow direct dispatch for the ObjFW runtime (PR #126382)

2025-03-06 Thread John McCall via cfe-commits
@@ -,6 +,96 @@ class CGObjCObjFW: public CGObjCGNU { return ClassSymbol; } + void GenerateDirectMethodPrologue( + CodeGenFunction &CGF, llvm::Function *Fn, const ObjCMethodDecl *OMD, + const ObjCContainerDecl *CD) override { +auto &Builder = CGF.Bu

[clang] Allow direct dispatch for the ObjFW runtime (PR #126382)

2025-03-06 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/126382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-03-05 Thread John McCall via cfe-commits
@@ -73,7 +73,7 @@ namespace { // value of the expression to the unqualified, non-atomic version of // the named type. if (!S.Context.getLangOpts().ObjC && !DestType->isRecordType() && - !DestType->isArrayType()) { + !DestType->isArrayType

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-03-11 Thread John McCall via cfe-commits
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s + +template struct G { + T __ptrauth(0,0,1234) test; +

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-04-03 Thread John McCall via cfe-commits
@@ -0,0 +1,142 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s + +#define AQ __ptrauth

[clang] [ItaniumMangle] Make sure class types are added to the dictionary of substitution candidates when compiling for older ABIs (PR #138947)

2025-05-07 Thread John McCall via cfe-commits
rjmccall wrote: Can you confirm that the intent here is to restore mangler behavior to what it was prior to #132401, making the pair of PRs ABI-neutral? https://github.com/llvm/llvm-project/pull/138947 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] clang: Remove dest LangAS argument from performAddrSpaceCast (PR #138866)

2025-05-09 Thread John McCall via cfe-commits
rjmccall wrote: Merging this was fine because it was just removing the redundant LangAS argument, not removing the abstract handling of address-space conversions in IRGen. I just wanted to note my opposition to the idea of taking that second step, since it had come up in the review. https://g

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2025-05-16 Thread John McCall via cfe-commits
rjmccall wrote: The AMDGPU `TargetInfo` is responsible for ensuring that the choices it makes match the ABI. It is inconceivable that just dropping in the converted struct type that Clang IRGen uses as a direct parameter or result type would be a correct way to implement this; even if by chanc

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-15 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: I'm surprised we need all this. Since we don't distinguish arrays from their elements in TBAA, is it not sufficient to just make sure that array subscript expressions produce an l-value with the same TBAA metadata as their base l-value? https://github.co

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-22 Thread John McCall via cfe-commits
rjmccall wrote: Okay, it sounds like this is where we've left off: - The standard is using an odd formulation in [[class.cdtor]p2](https://eel.is/c++draft/class.cdtor) that we're not sure how to interpret. It's possible that it's formally slightly weaker than `restrict` might be, which would m

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-20 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
@@ -4503,7 +4503,29 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, E->getType(), !getLangOpts().PointerOverflowDefined, SignedIndices, E->getExprLoc(), &arrayType, E->getBase()); EltBaseInfo = ArrayLV.getBaseInfo(); -EltT

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Thanks, those seem like good reasons. https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][OpenCL][AMDGPU] Allow a kernel to call another kernel (PR #115821)

2025-05-27 Thread John McCall via cfe-commits
rjmccall wrote: It's not actually clang's responsibility to not break your transformation. We don't want to break it gratuitously, but if clang is generating correct code, your transformation needs to be flexible enough to handle it. If there's something easy we can do to help your transformat

[clang] [llvm] [clang][CodeGen][AA] Add `!llvm.errno.tbaa` gathering int-compatible TBAA nodes (PR #125258)

2025-05-27 Thread John McCall via cfe-commits
rjmccall wrote: Sorry, can you back up and explain the root problem you're trying to solve? You have a platform where we're emitting accesses to `errno` as if it weren't an `int`? What does it look like in source? https://github.com/llvm/llvm-project/pull/125258 ___

[clang] [llvm] [clang][CodeGen][AA] Add `!llvm.errno.tbaa` gathering int-compatible TBAA nodes (PR #125258)

2025-05-28 Thread John McCall via cfe-commits
rjmccall wrote: > Oh, sorry for not providing context earlier. The reasoning behind is to allow > certain optimizations involving errno-writing libcalls (marked as > `memory(errnomem: write)`) to occur, if we are able to prove the involved > memory location does not alias errno (e.g., because

<    6   7   8   9   10   11