[clang] [SveEmitter] Explicitly merge with `poison` instead of `undef` (PR #124596)

2025-01-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The architecture manual isn't really helpful here... the instruction set doesn't really have any notion of undefined values in this context; the operations in question are always "merging". The intrinsic allows omitting the destination register for convenience, in which c

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/124762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Support member function poiners in Decl::getFunctionType() (PR #125077)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM... but I have a couple comments on things you mentioned in the commit message. > ``` > /// Looks through the Decl's underlying type to extract a FunctionType > /// when possible. Will return null if the type underlying the Decl d

[clang] [Clang][NFC] Add special handling of mfloat8 in initializer lists (PR #125097)

2025-01-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please don't mark this "NFC"; I'd consider this a functional change, even if it doesn't have any obvious effect on non-asserts builds. https://github.com/llvm/llvm-project/pull/125097 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Return larger CXX records in memory (PR #120670)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -1334,6 +1334,16 @@ class X86_64ABIInfo : public ABIInfo { return T.isOSLinux() || T.isOSNetBSD(); } + bool returnCXXRecordGreaterThan128InMem() const { +// Clang <= 20.0 did not do this. +if (getContext().getLangOpts().getClangABICompat() <= +LangOpt

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-01-31 Thread Eli Friedman via cfe-commits
@@ -1596,12 +1596,14 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, QualType ProblemTy; if (T->isAnyPointerType() || T->isReferenceType() || -T->isMemberPointerType()) { +T->isMemberPointerType() || T->isArrayType()) { Qual

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -82,7 +82,7 @@ define void @test_store(ptr %p) { @G = external global ptr define i8 @test_store_capture(ptr %p) { -; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) +; FNATTRS: Functio

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -672,13 +703,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotThrow(F); Changed |= setDoesNotCapture(F, 0); Changed |= setOnlyReadsMemory(F, 0); +Changed |= setOnlyAccessesErrnoMemory(F); break; case LibFunc_ctermid:

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -672,13 +703,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotThrow(F); Changed |= setDoesNotCapture(F, 0); Changed |= setOnlyReadsMemory(F, 0); +Changed |= setOnlyAccessesErrnoMemory(F); efriedma-quic wrote:

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/124742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -703,13 +737,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotCapture(F, 1); Changed |= setOnlyReadsMemory(F, 0); Changed |= setOnlyReadsMemory(F, 1); +Changed |= setOnlyAccessesErrnoMemory(F); break; case LibFunc_fdope

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Please take a second look at your markings: in particular, syscalls with side-effects should be treated as modifying inaccessible memory. https://github.com/llvm/llvm-project/pull/124742 ___ cfe-commits mail

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -703,13 +737,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotCapture(F, 1); Changed |= setOnlyReadsMemory(F, 0); Changed |= setOnlyReadsMemory(F, 1); +Changed |= setOnlyAccessesErrnoMemory(F); efriedma-quic wr

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Even with this fix, the behavior with mixed types still seems really confusing, especially if you mix signed/unsigned inputs. Can we address that somehow? https://github.com/llvm/llvm-project/pull/119423 ___ cfe-commits mailing l

[clang] [Clang][AArch64] Allow FP8 Neon vector types to be used by __builtin_shufflevector (PR #119031)

2024-12-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: My concern here is there's a tradeoff: there's less complexity constructing the type, maybe, but as a result you've scattered checks all over the code for a type that's basically the same as a VectorType. At first glance, this doesn't seem like the right tradeoff. https:

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add a testcase to clang/test/CodeGen/ . Put it in an existing file if there's already some related test. (See also https://llvm.org/docs/Contributing.html#how-to-submit-a-patch ) I don't think EmitAggregateCopy is the right place to call EmitVariablyModifiedType:

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-11 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,62 @@ +//===--- Xtensa.cpp - Implement Xtensa target feature support -===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.

[clang] [Clang][CodeGen] Remove extraneous dot prefixes [NFC] (PR #119275)

2024-12-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/119275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-10 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,141 @@ +//===--- Xtensa.h - Declare Xtensa target feature support ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: C standard rules for va_arg: "[...] if *type* is not compatible with the type of the actual next argument [...], the behavior is undefined [...]". A struct is never compatible with an array, so yes , it's undefined. (See 6.2.7 for what constitutes a "compatible type".)

[clang] [AArch64] Fix argument passing for SVE tuples (PR #118961)

2024-12-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add a test for a struct containing an SVE tuple. https://github.com/llvm/llvm-project/pull/118961 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-16 Thread Eli Friedman via cfe-commits
@@ -5272,8 +5272,11 @@ bool Sema::BuiltinAssumeAligned(CallExpr *TheCall) { { ExprResult FirstArgResult = DefaultFunctionArrayLvalueConversion(FirstArg); -if (checkBuiltinArgument(*this, TheCall, 0)) efriedma-quic wrote: Took another look at

[clang] [cindex] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/120483 None >From 16e84acd0e86bf2653d4b3fa132bcf661a34e62f Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 18 Dec 2024 13:55:40 -0800 Subject: [PATCH] [cindex] Add python binding for clang_Cursor_isAnony

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2024-12-18 Thread Eli Friedman via cfe-commits
@@ -14604,57 +14611,63 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) { } bool Sema::BuiltinElementwiseMath(CallExpr *TheCall, bool FPOnly) { - QualType Res; - if (BuiltinVectorMath(TheCall, Res, FPOnly)) -return true; - TheCall->setType(Res);

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2024-12-18 Thread Eli Friedman via cfe-commits
@@ -14585,11 +14585,18 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) { _2, _3, _4)); } +static ExprResult UsualUnaryConversionsNoPromoteInt(Sema &S, Expr *E) { + // Don't promote integer types + if (QualType Ty = E->getType(); S.getASTContext().is

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2024-12-18 Thread Eli Friedman via cfe-commits
@@ -68,15 +66,18 @@ void test_builtin_elementwise_add_sat(float f1, float f2, double d1, double d2, long long int i2, si8 vi1, si8 vi2, unsigned u1, unsigned u2, u4 vu1, u4 vu2,

[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/114217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cindex] Add API to query more information about base classes. (PR #120300)

2024-12-17 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/120300 The first API is clang_visitCXXBaseClasses: this allows visiting the base classes without going through the generic child visitor (which is awkward, and doesn't work for template instantiations). The sec

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #120449)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #120449)

2024-12-18 Thread Eli Friedman via cfe-commits
@@ -1977,15 +1977,15 @@ def AtomicNandFetch : AtomicBuiltin { let Prototype = "void(...)"; } -def AtomicTestAndSet : Builtin { +def AtomicTestAndSet : AtomicBuiltin { let Spellings = ["__atomic_test_and_set"]; - let Attributes = [NoThrow]; + let Attributes = [NoThrow, C

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #120449)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/120449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] floating-point, pointer, and function types (PR #120484)

2024-12-18 Thread Eli Friedman via cfe-commits
@@ -129,4 +130,224 @@ def PrimitiveInt : AnyTypeOf<[UInt8, UInt16, UInt32, UInt64, SInt8, SInt16, SInt32, SInt64], "primitive int", "::cir::IntType">; +//===--===// +// FloatType +//===

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/120494 None >From 8f2e784333ed7cdd746dd408b18c2f12297378fe Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 15:25:00 -0800 Subject: [PATCH] [libclang/python] Add python bindings for PrintingPol

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2024-12-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120494 >From ec604efdae3e05bf14ade994cbc7d0f1acebd1c6 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 15:25:00 -0800 Subject: [PATCH] [libclang/python] Add python bindings for PrintingPolicy -

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/118008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM with one very minor comment https://github.com/llvm/llvm-project/pull/118008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,112 @@ +//===--- Xtensa.h - Declare Xtensa target feature support ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE

[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If people aren't using the edge cases, they won't notice if we start error'ing out. If they are, it's pretty easy to adapt the code to build with both old and new compilers. A quick GitHub search shows exactly one user of the builtins outside of clang itself, and that co

[clang] [clang] Generate appropriate assume in presence of libc's memcpy (PR #119704)

2024-12-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: On the clang side, we've intentionally ignored the nonnull marking on memcpy and friends for a long time; we made a decision a few years back the optimization wasn't worthwhile compared to the security risk. The updated patch doesn't do anything useful; we can prove the po

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The function in question is part of the Itanium C++ ABI; the ABI itself doesn't say anything about address-spaces, so by default we assume everything related to the C++ ABI is in the flat address-space. If we start messing with that, we'll need to write a specification so

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-13 Thread Eli Friedman via cfe-commits
@@ -20,4 +20,7 @@ void vla(int n, ...) __builtin_va_list ap; void *p; p = __builtin_va_arg(ap, typeof (int (*)[++n])); // CHECK: add nsw i32 {{.*}}, 1 + // Don't crash on some undefined behaviors. + p = __builtin_va_arg(ap, typeof (int [++n])); // expected-warning{{sec

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-13 Thread Eli Friedman via cfe-commits
@@ -6121,6 +6121,8 @@ RValue CodeGenFunction::EmitVAArg(VAArgExpr *VE, Address &VAListAddr, VAListAddr = VE->isMicrosoftABI() ? EmitMSVAListRef(VE->getSubExpr()) : EmitVAListRef(VE->getSubExpr()); QualType Ty = VE->getType(); + if (Ty->

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2024-12-13 Thread Eli Friedman via cfe-commits
@@ -16538,6 +16538,13 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, << TInfo->getTypeLoc().getSourceRange(); } +if (TInfo->getType()->isVariableArrayType()) { efriedma-quic wrote: This should check for any array type; the issu

[clang] [AArch64] Fix argument passing for SVE tuples (PR #118961)

2024-12-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM I somehow thought you could use arm_sve_vector_bits with tuples, but I guess not. https://github.com/llvm/llvm-project/pull/118961 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [clang] Return larger CXX records in memory (PR #120670)

2024-12-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Missing regression test in clang/test/CodeGen. We probably want a release note for this (clang/docs/ReleaseNotes.rst). (If you're interested, there's another x86-64 ABI bug which nobody got around to fixing: #76017.) https://github.com/llvm/llvm-project/pull/120670 __

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120483 >From 4a525f61f9b67fcd887ed64a8c80521f7a21016d Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 18 Dec 2024 13:55:40 -0800 Subject: [PATCH] [cindex] Add python binding for clang_Cursor_isAnonymousRe

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120494 >From 4de2bf3b617538fbc299d5f84d8a8e17d3ff5072 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 15:25:00 -0800 Subject: [PATCH] [libclang/python] Add python bindings for PrintingPolicy T

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120483 >From 226718966fdbd517f288ce6e4de11cde0aa634cc Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 18 Dec 2024 13:55:40 -0800 Subject: [PATCH] [cindex] Add python binding for clang_Cursor_isAnonymousRe

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2024-12-19 Thread Eli Friedman via cfe-commits
@@ -2663,6 +2671,21 @@ def visitor(field, children): conf.lib.clang_Type_visitFields(self, fields_visit_callback(visitor), fields) return iter(fields) +def get_bases(self): +"""Return an iterator for accessing the base classes of this type.""" + +

[clang] Patch series to reapply #118734 and substantially improve it (PR #120534)

2024-12-19 Thread Eli Friedman via cfe-commits
@@ -100,10 +244,17 @@ class Context { /// Return the identifier name for the specified builtin, /// e.g. "__builtin_abs". - llvm::StringRef getName(unsigned ID) const { return getRecord(ID).Name; } + std::string getName(unsigned ID) const; efriedma-quic

[clang] Patch series to reapply #118734 and substantially improve it (PR #120534)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Patch series to reapply #118734 and substantially improve it (PR #120534)

2024-12-19 Thread Eli Friedman via cfe-commits
@@ -100,10 +244,17 @@ class Context { /// Return the identifier name for the specified builtin, /// e.g. "__builtin_abs". - llvm::StringRef getName(unsigned ID) const { return getRecord(ID).Name; } + std::string getName(unsigned ID) const; + + /// Return the identifier

[clang] Patch series to reapply #118734 and substantially improve it (PR #120534)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 448537876f4377686847120a923dd9d443f7d556 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120483 >From ba71a3ddba2ab2f816c6285614aa04ae2614e672 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 18 Dec 2024 13:55:40 -0800 Subject: [PATCH] [cindex] Add python binding for clang_Cursor_isAnonymousRe

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2024-12-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120494 >From 13a9c0b88afae7a5f48a66e86357f7284fdace95 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 15:25:00 -0800 Subject: [PATCH] [libclang/python] Add python bindings for PrintingPolicy T

[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

2024-12-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM I'm a little concerned this is going to lead to other crashes due to exposing more codepaths to "invalid" decls. But it seems like it's doing the right thing in the given cases. https://github.com/llvm/llvm-project/pull/113049

[clang] [llvm] Reimplement constrained 'trunc' using operand bundles (PR #118253)

2024-12-06 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > > llvm.trunc is currently marked IntrNoMem in Intrinsics.td; you'll need to > > update that if you want it to read/modify FP state. (Trying to override the > > default by sticking attributes on top doesn't work properly, as far as I > > know.) > This this the key point

[clang] [Clang] Permit noescape on non-pointer types (PR #117344)

2024-12-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm not sure I understand the intended meaning here. Is noescape on a struct argument supposed to recursively apply to every pointer field of the struct? If that's the intended meaning, should we restrict this to structs that have pointer fields? https://github.com/llvm

[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

2024-12-05 Thread Eli Friedman via cfe-commits
@@ -5563,6 +5563,12 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { assert(Field->hasInClassInitializer()); + // We do not want to aggressively cutoff parsing. Try to recov

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: For reference, the RFC for the LLVM backend was https://discourse.llvm.org/t/rfc-request-for-upstream-tensilica-xtensa-esp32-backend/65355 . Given there's an LLVM backend, I don't think we need a separate clang RFC? Assuming the target doesn't require any exotic frontend

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -9727,6 +9727,51 @@ static TypedefDecl *CreateHexagonBuiltinVaListDecl(const ASTContext *Context) { return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); } +static TypedefDecl * +CreateXtensaABIBuiltinVaListDecl(const ASTContext *Context) { + /

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,62 @@ +//===--- Xtensa.cpp - Implement Xtensa target feature support -===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,62 @@ +//===--- Xtensa.cpp - Implement Xtensa target feature support -===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -358,7 +358,10 @@ class TargetInfo : public TransferrableTargetInfo, //void *__saved_reg_area_end_pointer; //void *__overflow_area_pointer; //} va_list; -HexagonBuiltinVaList +HexagonBuiltinVaList, + +// Tensilica Xtensa +XtensaABIBuiltinV

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -9727,6 +9727,51 @@ static TypedefDecl *CreateHexagonBuiltinVaListDecl(const ASTContext *Context) { return Context->buildImplicitTypedef(VaListTagArrayType, "__builtin_va_list"); } +static TypedefDecl * +CreateXtensaABIBuiltinVaListDecl(const ASTContext *Context) { + /

[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-06 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,141 @@ +//===--- Xtensa.h - Declare Xtensa target feature support ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE

[clang] [clang] Emit @llvm.assume before streaming_compatible functions when the streaming mode is known (PR #121917)

2025-01-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > However what we want to achieve with this is to make the state of the > streaming mode known to potentially inlineable called functions, allowing for > further inlining and identification/removal of dead code It seems like we're in agreement that the llvm.assume doesn't

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-10 Thread Eli Friedman via cfe-commits
@@ -82,7 +82,7 @@ define void @test_store(ptr %p) { @G = external global ptr define i8 @test_store_capture(ptr %p) { -; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) +; FNATTRS: Functio

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: This seems like roughly what I expected from the proposal. https://github.com/llvm/llvm-project/pull/120783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 0d4bcf69c57457ba79af9069ae60c6de8ee45498 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From ff0f4b551de077ee07331ed30410b102abb06c09 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 12ad982b984a4e533db4220332f6edbf4b4903a2 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Addressed review comments https://github.com/llvm/llvm-project/pull/120300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm tempted to say we should just treat -fwrapv/-fwrapv-pointer/-fno-strict-overflow as aliases for each other. I don't think anyone using -fwrapv is going to be happy that we're turning on overflow optimizations. https://github.com/llvm/llvm-project/pull/122486

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/122386 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/122386 This allows controlling pretty-printing of types the same way it works with cursors. >From a96fbe38f697f77c12c712f5573c2158072a8d2f Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 17:4

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 448537876f4377686847120a923dd9d443f7d556 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/119387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/120494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2025-01-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Oh, looks like that fixed it, thanks. https://github.com/llvm/llvm-project/pull/120494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-09 Thread Eli Friedman via cfe-commits
@@ -137,6 +137,10 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), ArraySize, Name, AllocaInsertPt->getIterator()); + if (Alloca->getName

[clang] [clang-tools-extra] Remove `StringLiteral` in favor of `StringRef` (PR #122366)

2025-01-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: For reference, when it was added, the important thing about StringLiteral was that it had a constexpr constructor. The StringRef constructor became constexpr with 57effbdadc0b382db4ef86addcfd03a64c9eda0a, a few years after StringLiteral was added. https://github.com/llvm

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/122386 >From 0557238b725ecf3554f91ef264d710ff841fd1e1 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 17:46:09 -0800 Subject: [PATCH] [libclang] Allow using PrintingPolicy with types This allo

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-10 Thread Eli Friedman via cfe-commits
@@ -137,6 +137,10 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), ArraySize, Name, AllocaInsertPt->getIterator()); + if (Alloca->getName

[clang] [llvm] [clang] Implement pragma clang section on COFF targets (PR #112714)

2025-01-21 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/112714 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: CC @llvm/clang-vendors : this changes the behavior of -fwrapv. Internally, I expect it's going to be a bit painful to communicate to all our internal teams that they need to change their -fwrapv usage to -fno-strict-overflow, but if we think it's imp

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [SveEmitter] Explicitly merge with `poison` instead of `undef` (PR #124596)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Does the Arm spec actually allow us to do this? It says "the inactive elements of the result have arbitrary, undefined values." That seems very different from "your program has undefined behavior if you use the inactive elements of the result". For comparison, the x86 `

[clang] [Clang] Skip past code generation for unevaluated lambdas (PR #124572)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looking a bit more, I'm not sure I buy the premise that we don't need to mangle lambdas written in unevaluated contexts. Consider the following related example: ``` template using simd_vector = Tp; template using simd_vector_underlying_type_t = decltype([](simd_vecto

[clang] [clang][SME] Emit error for OpenMP captured regions in SME functions (PR #124590)

2025-01-27 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM In theory, handling streaming mode doesn't seem too challenging here: you mark the outlined functions locally_streaming, and you're done, I think. That said, I'm not sure how you define the semantics for ZA, so maybe better to

[clang] [Clang] Skip past code generation for unevaluated lambdas (PR #124572)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: See also discussion on #117845. I think it makes some sense to add a way for CodeGen to query whether a given declaration is impossible to emit. I suggested in that discussion that it could be a kind of linkage. I'd prefer not to mess with the way DeferredDecls works for

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-28 Thread Eli Friedman via cfe-commits
@@ -752,10 +780,13 @@ RValue ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, CharUnits SlotSize = CharUnits::fromQuantity(4); // Empty records are ignored for parameter passing purposes. - if (isEmptyRecord(getContext(), Ty, true)) + uint64_t Size = getC

<    10   11   12   13   14   15   16   17   18   19   >