[clang] Warn when unique objects might be duplicated in shared libraries (PR #117622)

2025-01-15 Thread Reid Kleckner via cfe-commits
rnk wrote: I added some reviewers to increase visibility. This warning is designed to avoid common pitfalls with shared objects and hidden visibility as I understand it, so I thought @maskray might be able to help with some ELF linker/loader insight as to whether this warning is valuable. htt

[clang] [X86] Fix the implementation of __readcr[4, 8]/__writecr[4, 8] to work in 64-bit mode (PR #122238)

2025-01-09 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: Thanks! I see we don't actually implement these intrinsics at this point, but fixing them to avoid redeclaration errors is reasonable. https://github.com/llvm/llvm-project/pull/122238 ___ cfe-commits mailing list cfe

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
https://github.com/rnk closed https://github.com/llvm/llvm-project/pull/122029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
rnk wrote: Thanks for the review! > nitpick, I don't think this is an NFC change. It would require some thought > to really convince myself this did not have subtle behavior changes even if > unintended. I agree this change assumes some invariants about immutability of field ordering to be c

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public Mergeable { /// Returns the index of this field within its record, /// as appropriate for passing to ASTRecordLayout::getFieldOffset. - unsigned getFieldIndex() const; + unsigned getFieldIndex() cons

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public Mergeable { /// Returns the index of this field within its record, /// as appropriate for passing to ASTRecordLayout::getFieldOffset. - unsigned getFieldIndex() const; + unsigned getFieldIndex() cons

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public Mergeable { /// Returns the index of this field within its record, /// as appropriate for passing to ASTRecordLayout::getFieldOffset. - unsigned getFieldIndex() const; + unsigned getFieldIndex() cons

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-09 Thread Reid Kleckner via cfe-commits
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public Mergeable { /// Returns the index of this field within its record, /// as appropriate for passing to ASTRecordLayout::getFieldOffset. - unsigned getFieldIndex() const; + unsigned getFieldIndex() cons

[clang] Allow packing fields into tail padding of record fields (PR #122197)

2025-01-08 Thread Reid Kleckner via cfe-commits
https://github.com/rnk created https://github.com/llvm/llvm-project/pull/122197 Don't use isPotentiallyOverlapping to control behavior that allows overwriting previous field data, because the `[[no_unique_address]]` attribute is not available in any debug info, DWARF or PDB. Instead, just trust

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-08 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/122029 >From 1824674744d6fba1dd74c74d54aae9b603d8b854 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 8 Jan 2025 00:24:09 + Subject: [PATCH 1/3] Use range-based for to iterate over fields in record layout, NFC

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-08 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/122029 >From 1824674744d6fba1dd74c74d54aae9b603d8b854 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 8 Jan 2025 00:24:09 + Subject: [PATCH 1/2] Use range-based for to iterate over fields in record layout, NFC

[clang] Use range-based for to iterate over fields in record layout, NFC (PR #122029)

2025-01-07 Thread Reid Kleckner via cfe-commits
https://github.com/rnk created https://github.com/llvm/llvm-project/pull/122029 Move the common case of FieldDecl::getFieldIndex() inline to mitigate the cost of removing the extra `FieldNo` induction variable. Also rename isNoUniqueAddress parameter to isNonVirtualBaseType, which appears to b

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-11 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. Thanks! I think this is ready to land. https://github.com/llvm/llvm-project/pull/119198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-11 Thread Reid Kleckner via cfe-commits
@@ -845,13 +845,14 @@ MemoryBufferRef LinkerDriver::convertResToCOFF(ArrayRef mbs, // Create OptTable +#define OPTTABLE_STR_TABLE_CODE rnk wrote: I convinced myself this is not worth it. The changes to the `PrecomputedOptTable` are hard to abstract away. I

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-11 Thread Reid Kleckner via cfe-commits
@@ -53,10 +53,8 @@ class OptTable { public: /// Entry for a single option instance in the option data table. struct Info { -/// A null terminated array of prefix strings to apply to name while -/// matching. -ArrayRef Prefixes; -StringLiteral PrefixedName; +

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-09 Thread Reid Kleckner via cfe-commits
@@ -53,10 +53,8 @@ class OptTable { public: /// Entry for a single option instance in the option data table. struct Info { -/// A null terminated array of prefix strings to apply to name while -/// matching. -ArrayRef Prefixes; -StringLiteral PrefixedName; +

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-09 Thread Reid Kleckner via cfe-commits
@@ -845,13 +845,14 @@ MemoryBufferRef LinkerDriver::convertResToCOFF(ArrayRef mbs, // Create OptTable +#define OPTTABLE_STR_TABLE_CODE rnk wrote: Is it feasible to split out all the tool driver updates, like refactor all these PREFIX definitions into the t

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-09 Thread Reid Kleckner via cfe-commits
@@ -53,10 +53,8 @@ class OptTable { public: /// Entry for a single option instance in the option data table. struct Info { -/// A null terminated array of prefix strings to apply to name while -/// matching. -ArrayRef Prefixes; -StringLiteral PrefixedName; +

[clang] [clang-tools-extra] [lld] [lldb] [llvm] Rework the `Option` library to reduce dynamic relocations (PR #119198)

2024-12-09 Thread Reid Kleckner via cfe-commits
@@ -80,15 +78,56 @@ class OptTable { const char *AliasArgs; const char *Values; -StringRef getName() const { - unsigned PrefixLength = Prefixes.empty() ? 0 : Prefixes[0].size(); - return PrefixedName.drop_front(PrefixLength); +bool hasNoPrefix() const

[clang] [Clang] Enable -fextend-lifetimes at -Og (PR #118026)

2024-12-04 Thread Reid Kleckner via cfe-commits
@@ -1834,6 +1834,14 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.setInlining(CodeGenOptions::NormalInlining); } + // If we have specified -Og and have not explicitly set -fno-extend-lifetimes, + // then default to -fextend-li

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-12-02 Thread Reid Kleckner via cfe-commits
@@ -6418,6 +6418,12 @@ def warn_signed_bitfield_enum_conversion : Warning< InGroup, DefaultIgnore; def note_change_bitfield_sign : Note< "consider making the bitfield type %select{unsigned|signed}0">; +def warn_ms_bitfield_mismatched_storage_packing : Warning< + "bit-field

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-12-02 Thread Reid Kleckner via cfe-commits
@@ -0,0 +1,180 @@ + +// RUN: %clang_cc1 -fsyntax-only -Wms-bitfield-compatibility -verify -triple armv8 -std=c++23 %s +// RUN: %clang_cc1 -fsyntax-only -DMS_BITFIELDS -mms-bitfields -verify=msbitfields -triple armv8-apple-macos10.15 -std=c++23 %s + +// msbitfields-no-diagnostics

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-12-02 Thread Reid Kleckner via cfe-commits
@@ -631,6 +631,9 @@ Improvements to Clang's diagnostics - Clang now diagnoses dangling references for C++20's parenthesized aggregate initialization (#101957). +- A new off-by-default warning ``-Wms-bitfield-compatibility`` has been added to alert to cases where bit-field -

[clang] Clang tooling generated visibility macros for Clang (PR #109702)

2024-11-27 Thread Reid Kleckner via cfe-commits
rnk wrote: I think it makes sense to focus on Saleem's use case, which, perhaps to translate it into Posix-ecosystem terms, is to create a single Clang DSO (similar to llvm-dylib or whatever we call it) that all the affiliated monorepo Clang tools use (clang-tidy, clang-rename, clang-format, c

[clang] [Wunsafe-buffer-usage] Address some false positives in handling array indices that are decidably correct (PR #117370)

2024-11-27 Thread Reid Kleckner via cfe-commits
@@ -439,8 +439,16 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { dyn_cast(Node.getBase()->IgnoreParenImpCasts()); rnk wrote: There's a FIXME above about refactoring Sema::CheckArrayAccess to avoid duplication, and I'm trying to decide if that

[clang] [Wunsafe-buffer-usage] Address some false positives in handling array indices that are decidably correct (PR #117370)

2024-11-27 Thread Reid Kleckner via cfe-commits
@@ -463,6 +471,13 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return true; rnk wrote: I think getting the integer constant expr is more general, we can remove the IntegerLiteral test here, and if all tests pass, I would consider it functio

[clang] [Wunsafe-buffer-usage] Address some false positives in handling array indices that are decidably correct (PR #117370)

2024-11-27 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: I think there's a policy question here of how much trust we want to put into the type system. Clearly, we've already put some trust into it to reduce false positives, but we could decide to trust any old constant array type bounds, and that would be a good cod

[clang] [Wunsafe-buffer-usage] Address some false positives in handling array indices that are decidably correct (PR #117370)

2024-11-27 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/117370 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-11-26 Thread Reid Kleckner via cfe-commits
@@ -631,6 +631,7 @@ def Packed : DiagGroup<"packed", [PackedNonPod]>; def PaddedBitField : DiagGroup<"padded-bitfield">; def Padded : DiagGroup<"padded", [PaddedBitField]>; def UnalignedAccess : DiagGroup<"unaligned-access">; +def MSBitfieldCompatibility : DiagGroup<"ms-bitfiel

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-11-26 Thread Reid Kleckner via cfe-commits
@@ -19001,9 +19001,9 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, // Verify that all the fields are okay. SmallVector RecFields; - + std::optional PreviousField; rnk wrote: It doesn't seem idiomatic to use an optional

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-11-26 Thread Reid Kleckner via cfe-commits
@@ -19213,6 +19213,29 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, if (Record && FD->getType().isVolatileQualified()) Record->setHasVolatileMember(true); +auto IsNonDependentBitField = [](const FieldDecl *FD) { + if (!FD->

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2024-11-26 Thread Reid Kleckner via cfe-commits
@@ -19213,6 +19213,29 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, if (Record && FD->getType().isVolatileQualified()) Record->setHasVolatileMember(true); +auto IsNonDependentBitField = [](const FieldDecl *FD) { + if (!FD->

[clang] [Wunsafe-buffer-usage] Fix false positives in handling enums (PR #117370)

2024-11-22 Thread Reid Kleckner via cfe-commits
@@ -463,6 +463,13 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { return true; } + // Array index wasn't an integer literal, let's see if it was an enum or + // something similar + const auto IntConst = Node.getIdx()->getIntegerConstantExpr(Finder->getAS

[clang] [Wunsafe-buffer-usage] Fix false positives in handling enums (PR #117370)

2024-11-22 Thread Reid Kleckner via cfe-commits
@@ -39,6 +39,23 @@ void constant_idx_unsafe(unsigned idx) { buffer[10] = 0; // expected-note{{used in buffer access here}} } +enum FooEnum { + A = 0, + B = 1, + C = 2, + D +}; + +void constant_enum_safe() { + int buffer[FooEnum::D] = { 0, 1, 2 }; + buffer[C] = 0;

[clang] [lld] [llvm] [Windows] Add support for emitting PGO/LTO magic strings in the Windows PE debug directory (PR #114260)

2024-11-21 Thread Reid Kleckner via cfe-commits
@@ -112,6 +112,8 @@ class MCTargetOptions { // Whether or not to use full register names on PowerPC. bool PPCUseFullRegisterNames : 1; + bool PgoInstrumentation = false; rnk wrote: Target options like this don't play well with (thin)LTO , because they do

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

2024-11-15 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: This is an LLVM code change, not a clang code change. It's an important principle that we test LLVM at the smallest reasonable granularity. Can you replace the clang test with an IR test? I'm sure we already have existing IR carrying existing sections, we just

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2024-11-08 Thread Reid Kleckner via cfe-commits
rnk wrote: We can adjust the rules around language linkage if we like, but the main reason we implement builtins this way is to support the MSVC intrinsic model, which is to declare extern "C" functions and mark them with `#pragma intrinsic(NAME)` like so: ``` extern "C" void _m_prefetchw(vola

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2024-11-05 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/115099 >From e1331b2c00db0cdff09345b36fd484f2269ee1cc Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 5 Nov 2024 16:05:53 -0800 Subject: [PATCH 1/2] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts

[clang] [llvm] [InstrPGO] Support cold function coverage instrumentation (PR #109837)

2024-10-30 Thread Reid Kleckner via cfe-commits
@@ -1182,8 +1187,13 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, const bool IsCtxProfUse = !UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink; + // Enable cold function coverage instrumentation if + // InstrumentColdF

[clang] [llvm] [Clang] Match MSVC handling of duplicate header search paths in Microsoft compatibility modes. (PR #105738)

2024-10-21 Thread Reid Kleckner via cfe-commits
rnk wrote: I would stick with `fms-compatibility` being the setting here rather than plumbing the driver mode through. Over the years, many build systems have been adapted to work with `clang[++]` and `cl` without going through clang-cl. https://github.com/llvm/llvm-project/pull/105738 ___

[clang] [clang] Fix segmentation fault caused by stack overflow on deeply nested expressions (PR #111701)

2024-10-11 Thread Reid Kleckner via cfe-commits
@@ -0,0 +1,1013 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -Wstack-exhausted -verify + +class AClass { +public: + AClass() {} + AClass &foo() { return *this; } +}; + +void test_bar() { + AClass a; + // expected-warning@* {{stack nearly exhausted; compilation time may suffer, a

[clang] [Clang] Add explicit visibility symbol macros (PR #108276)

2024-10-09 Thread Reid Kleckner via cfe-commits
@@ -0,0 +1,67 @@ +//===-- clang/Support/Compiler.h - Compiler abstraction support -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [MSVC] work-around for compile time issue 102513 (PR #110986)

2024-10-03 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/110986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MSVC] work-around for compile time issue 102513 (PR #110986)

2024-10-03 Thread Reid Kleckner via cfe-commits
@@ -1430,6 +1434,10 @@ bool Interpret(InterpState &S, APValue &Result) { } } } +// https://github.com/llvm/llvm-project/issues/102513 +#if defined(_MSC_VER) rnk wrote: Please make the ifdef conditions match, or define your own macro like DEOPTIMIZE_SWIT

[clang] [MSVC] work-around for compile time issue 102513 (PR #110986)

2024-10-03 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: Thanks! https://github.com/llvm/llvm-project/pull/110986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

2024-10-02 Thread Reid Kleckner via cfe-commits
rnk wrote: > Perhaps a worthwhile direction is separating DISubprograms into abstract and > definition portions, much like DWARF does, which would allow us to put these > types into the declaration and have a well defined scope hierarchy: types > that get uniqued refer to the abstract-DISubpro

[clang] Clang tooling generated visibility macros for Clang (PR #109702)

2024-10-02 Thread Reid Kleckner via cfe-commits
rnk wrote: > Is there a plan for maintaining these annotations long-term? Like, should > there be a pre-commit action to verify that all the annotations are > up-to-date? pre-commit actions are expensive, but I think we could afford to do something here. It is not hard to set up a DLL build o

[clang] [llvm] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

2024-10-01 Thread Reid Kleckner via cfe-commits
rnk wrote: > If the function-local types should not be ODR-uniqued, then dropping the > identifier field sounds correct. I can't speak to the complexities of the alternative, but I'm immediately suspicious of this direction. We have stable manglings for static locals in inline functions and s

[clang] [llvm] [ARM] Fix musttail calls (PR #109943)

2024-09-26 Thread Reid Kleckner via cfe-commits
rnk wrote: By the way, the x86 backend also miscompiles test cases like this: ``` struct ByVal { int large[5]; }; void f(ByVal a, ByVal b); void g(ByVal a, ByVal b) { [[clang::musttail]] f(b, a); } ``` I have an internal issue assigned to @aeubanks tracking that. I may have reported it upstre

[clang] [C++20][Modules] Fix crash when function and lambda inside loaded from different modules (PR #109167)

2024-09-26 Thread Reid Kleckner via cfe-commits
@@ -5706,6 +5707,27 @@ void ASTWriter::WriteDeclAndTypes(ASTContext &Context) { Stream.EmitRecord(DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD, DelayedNamespaceRecord); + if (!FunctionToLambdasMap.empty()) { +// TODO: on disk hash table for function

[clang] [C++20][Modules] Fix non-determinism in serialized AST (PR #110131)

2024-09-26 Thread Reid Kleckner via cfe-commits
@@ -5713,8 +5713,7 @@ void ASTWriter::WriteDeclAndTypes(ASTContext &Context) { // efficent becuase it allows lazy deserialization. RecordData FunctionToLambdasMapRecord; for (const auto &Pair : FunctionToLambdasMap) { rnk wrote: This is now an iter

[clang] [C++20][Modules] Fix crash when function and lambda inside loaded from different modules (PR #109167)

2024-09-26 Thread Reid Kleckner via cfe-commits
@@ -5706,6 +5707,27 @@ void ASTWriter::WriteDeclAndTypes(ASTContext &Context) { Stream.EmitRecord(DELAYED_NAMESPACE_LEXICAL_VISIBLE_RECORD, DelayedNamespaceRecord); + if (!FunctionToLambdasMap.empty()) { +// TODO: on disk hash table for function

[clang] [llvm] [ARM] Fix musttail calls (PR #109943)

2024-09-25 Thread Reid Kleckner via cfe-commits
@@ -12658,10 +12658,10 @@ This instruction requires several arguments: the return value of the callee is returned to the caller's caller, even if a void return type is in use. - Both markers imply that the callee does not access allocas from the caller. - The `

[clang] [llvm] [ARM] Fix musttail calls (PR #109943)

2024-09-25 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: Thanks for prioritizing this! I have triaged many internal issues about this. https://github.com/llvm/llvm-project/pull/109943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [llvm] [ARM] Fix musttail calls (PR #109943)

2024-09-25 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/109943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [docs] Add a section on AI-generated content to the developer policy (PR #91014)

2024-09-10 Thread Reid Kleckner via cfe-commits
https://github.com/rnk closed https://github.com/llvm/llvm-project/pull/91014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [docs] Add a section on AI-generated content to the developer policy (PR #91014)

2024-09-10 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/91014 >From 88e4991013a05e26cece87d3989ad957a4e18e3d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 4 Sep 2024 16:52:49 + Subject: [PATCH 1/6] [clang] Fix FIXME in dynamic initializer emission, NFCI This poten

[clang] [llvm] [docs] Add a section on AI-generated content to the developer policy (PR #91014)

2024-09-10 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/91014 >From 88e4991013a05e26cece87d3989ad957a4e18e3d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 4 Sep 2024 16:52:49 + Subject: [PATCH 1/5] [clang] Fix FIXME in dynamic initializer emission, NFCI This poten

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-09-06 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/91990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-09-06 Thread Reid Kleckner via cfe-commits
@@ -13,3 +15,18 @@ template struct S3 { int T::*foo; }; + +template struct Base {}; +struct +S5 // #S5 +: +Base +// expected-error@-1 {{member pointer has incomplete base type 'S5'}} rnk wrote: I agree on the desired behavior, but doesn't this test show tha

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-09-06 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: Sorry, looks like I wrote pending comments and didn't publish them https://github.com/llvm/llvm-project/pull/91990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-09-06 Thread Reid Kleckner via cfe-commits
@@ -215,6 +215,14 @@ struct NewUnspecified; SingleTemplate tmpl_single; UnspecTemplate tmpl_unspec; +// Member pointers used in base specifiers force an unspecified inheritance model +struct MemPtrInBase : UnspecTemplate {}; rnk wrote: Yes, but it's not clea

[clang] [llvm] [docs] Add a section on AI-generated content to the developer policy (PR #91014)

2024-09-04 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/91014 >From 88e4991013a05e26cece87d3989ad957a4e18e3d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 4 Sep 2024 16:52:49 + Subject: [PATCH 1/4] [clang] Fix FIXME in dynamic initializer emission, NFCI This poten

[clang] 601645c - [clang] Fix FIXME in dynamic initializer emission, NFCI

2024-09-04 Thread Reid Kleckner via cfe-commits
Author: Reid Kleckner Date: 2024-09-04T17:34:26Z New Revision: 601645c3b70e2a17d18779a3a51b8bc9ecdc9aa6 URL: https://github.com/llvm/llvm-project/commit/601645c3b70e2a17d18779a3a51b8bc9ecdc9aa6 DIFF: https://github.com/llvm/llvm-project/commit/601645c3b70e2a17d18779a3a51b8bc9ecdc9aa6.diff LOG:

[clang] [llvm] [docs] Add a section on AI-generated content to the developer policy (PR #91014)

2024-09-04 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/91014 >From 88e4991013a05e26cece87d3989ad957a4e18e3d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 4 Sep 2024 16:52:49 + Subject: [PATCH 1/4] [clang] Fix FIXME in dynamic initializer emission, NFCI This poten

[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

2024-09-03 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/107154 >From cfb2cea5a4d4e0c1712e038692c4c5acee6b1f27 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 3 Sep 2024 21:16:40 + Subject: [PATCH 1/3] [MS] Put dllexported inline global initializers in a comdat Foll

[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

2024-09-03 Thread Reid Kleckner via cfe-commits
rnk wrote: Yeah, I should've explicitly said I was working on updating the comment block. It needed significant surgery. Actually, this code could probably use more significant refactoring, but let's set that aside for now. > Does this impact non-MS targets? At the moment, I can't think of a

[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

2024-09-03 Thread Reid Kleckner via cfe-commits
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/107154 >From cfb2cea5a4d4e0c1712e038692c4c5acee6b1f27 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 3 Sep 2024 21:16:40 + Subject: [PATCH 1/2] [MS] Put dllexported inline global initializers in a comdat Foll

[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

2024-09-03 Thread Reid Kleckner via cfe-commits
rnk wrote: I think there is no change here in our conformance on inline variable initialization order, except that non-discardable inline variables (achieved in this instance with dllexport, but perhaps there are other ways to do this. The classic case is explicit instantiation, which is unord

[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

2024-09-03 Thread Reid Kleckner via cfe-commits
https://github.com/rnk created https://github.com/llvm/llvm-project/pull/107154 Follow-up to c19f4f8069722f6804086d4438a0254104242c46 to handle corner case of exported inline variables. Should fix #56485 >From cfb2cea5a4d4e0c1712e038692c4c5acee6b1f27 Mon Sep 17 00:00:00 2001 From: Reid Kleckne

[clang] Deprecate -fheinous-gnu-extensions; introduce a new warning flag (PR #105821)

2024-08-23 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. Thanks for doing this! https://github.com/llvm/llvm-project/pull/105821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Sema] Error on reference types inside a union with msvc 1900+ (PR #102851)

2024-08-13 Thread Reid Kleckner via cfe-commits
rnk wrote: Something to consider is that `-fms-extensions` has, at various points, been used as a tool for making Windows code portable to Apple platforms. So, there may be users out there who use references in unions on non-Windows platforms. However, they presumably also build with modern ve

[clang] [CUDA] Emit used function list in deterministic order. (PR #102661)

2024-08-09 Thread Reid Kleckner via cfe-commits
@@ -950,6 +950,9 @@ void CodeGenModule::Release() { UsedArray.push_back(llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast( GetAddrOfGlobal(GD), Int8PtrTy)); } +// Sort decls by name to always emit them in deterministic order. rnk wrot

[clang] [llvm] demangle function names in trace files (PR #87626)

2024-08-06 Thread Reid Kleckner via cfe-commits
rnk wrote: I think I'll leave this change in and file an issue about it. A 10% compile time regression with `-ftime-trace` isn't great, but it doesn't feel revert-worthy. https://github.com/llvm/llvm-project/pull/87626 ___ cfe-commits mailing list cf

[clang] [llvm] demangle function names in trace files (PR #87626)

2024-08-02 Thread Reid Kleckner via cfe-commits
rnk wrote: Are we sure we want this behavior? Demangling is really expensive. A user noticed a significant (10%) compile time regression from this change. We could skip the demangling and do it offline. It's also worth pointing out that we have to redo this work every time we optimize the same

[clang] Adds a pseudonym to clang"s windows mangler... (PR #97792)

2024-07-24 Thread Reid Kleckner via cfe-commits
https://github.com/rnk closed https://github.com/llvm/llvm-project/pull/97792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Adds a pseudonym to clang"s windows mangler... (PR #97792)

2024-07-23 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. Thanks, looks good, I'll wait for premerge checks to come back green before I merge it. https://github.com/llvm/llvm-project/pull/97792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [llvm] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

2024-07-23 Thread Reid Kleckner via cfe-commits
rnk wrote: I'm not seeing how your example constitutes an ODR violation, or how merging these lambda types by mangled name is incorrect. They are equivalent in your example. It seems like the issue has more to do with the details of how exactly we do the merge, and where the metadata reference

[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

2024-07-22 Thread Reid Kleckner via cfe-commits
@@ -5138,7 +5148,11 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, // -- Otherwise, the reference shall be an lvalue reference to a //non-volatile const type (i.e., cv1 shall be const), or the reference //shall be an rvalue reference. -

[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

2024-07-22 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/99833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

2024-07-22 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. I think this looks good, but I would appreciate another reviewer looking at the patch. https://github.com/llvm/llvm-project/pull/99833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] Adds a pseudonym to clang"s windows mangler... (PR #97792)

2024-07-19 Thread Reid Kleckner via cfe-commits
@@ -1938,12 +1946,23 @@ void MicrosoftCXXNameMangler::mangleTemplateArgValue(QualType T, mangleNumber(V.getLValueOffset().getQuantity()); } else if (!V.hasLValuePath()) { // FIXME: This can only happen as an extension. Invent a mangling. -break; +

[clang] Adds a pseudonym to clang"s windows mangler... (PR #97792)

2024-07-19 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/97792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Adds a pseudonym to clang"s windows mangler... (PR #97792)

2024-07-19 Thread Reid Kleckner via cfe-commits
https://github.com/rnk commented: Sorry, I made this comment some time ago, but it looks like I never published it https://github.com/llvm/llvm-project/pull/97792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [Clang] [docs] [MSVC] Add sections on `__forceinline` and intrinsic behaviour differences between Clang and MSVC (PR #99426)

2024-07-18 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. https://github.com/llvm/llvm-project/pull/99426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [docs] [MSVC] Add sections on `__forceinline` and intrinsic behaviour differences between Clang and MSVC (PR #99426)

2024-07-18 Thread Reid Kleckner via cfe-commits
@@ -154,3 +154,133 @@ a hint suggesting how to fix the problem. As of this writing, Clang is able to compile a simple ATL hello world application. There are still issues parsing WRL headers for modern Windows 8 apps, but they should be addressed soon. + +__forceinline behavior

[clang] [Clang] [docs] [MSVC] Add sections on `__forceinline` and intrinsic behaviour differences between Clang and MSVC (PR #99426)

2024-07-18 Thread Reid Kleckner via cfe-commits
@@ -154,3 +154,133 @@ a hint suggesting how to fix the problem. As of this writing, Clang is able to compile a simple ATL hello world application. There are still issues parsing WRL headers for modern Windows 8 rnk wrote: "modern Windows 8" is obviously stale

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-07-17 Thread Reid Kleckner via cfe-commits
@@ -9015,11 +9015,20 @@ bool Sema::RequireCompleteTypeImpl(SourceLocation Loc, QualType T, if (const MemberPointerType *MPTy = T->getAs()) { if (!MPTy->getClass()->isDependentType()) { - if (getLangOpts().CompleteMemberPointers && - !MPTy->getClass()->getA

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-07-17 Thread Reid Kleckner via cfe-commits
@@ -215,6 +215,14 @@ struct NewUnspecified; SingleTemplate tmpl_single; UnspecTemplate tmpl_unspec; +// Member pointers used in base specifiers force an unspecified inheritance model +struct MemPtrInBase : UnspecTemplate {}; rnk wrote: I guess this memptr ty

[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)

2024-07-17 Thread Reid Kleckner via cfe-commits
@@ -13,3 +15,18 @@ template struct S3 { int T::*foo; }; + +template struct Base {}; +struct +S5 // #S5 +: +Base +// expected-error@-1 {{member pointer has incomplete base type 'S5'}} rnk wrote: Should this be an error in Microsoft mode? Shouldn't we silentl

[clang] [X86][vectorcall] Do not consume register for indirect return value (PR #97939)

2024-07-09 Thread Reid Kleckner via cfe-commits
rnk wrote: I lost the `__fastcall` or `__vectorcall` during editing, here's a fixed link: https://godbolt.org/z/46j33z8bc You can see the load from [edx] and store to [ecx]: ``` NonTrivial copy_nontrivial(NonTrivial *) PROC ; copy_nontrivial, COMDAT mov eax, DWORD PTR [edx]

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

2024-07-09 Thread Reid Kleckner via cfe-commits
@@ -185,6 +203,18 @@ CALL_AO(PackedMembers) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.*}} align 1 {{.*}} align 1 {{.*}}i64 16, i1 {{.*}}) // CHECK: ret ptr +// WithEmptyField copy-assignment: +// CHECK-LABEL: define linkonce_odr nonnull align {{[0-9]+}} dereferenceable({

[clang] Adds an arbitrary pseudonym to clang"s windows mangler... (PR #97792)

2024-07-08 Thread Reid Kleckner via cfe-commits
rnk wrote: I think this NTTP mangling code needs some significant updates, refactoring, and an increase in test coverage. I see cd93532dfc455255cb2fa553090d14aaa52b106b landed last May, probably when I was offline for a while. https://github.com/llvm/llvm-project/pull/97792 __

[clang] [X86][vectorcall] Do not consume register for indirect return value (PR #97939)

2024-07-08 Thread Reid Kleckner via cfe-commits
rnk wrote: Thanks! I was going to say, surely this can't be right, I was pretty confident that sret pointers consume registers for these conventions, but it looks like I was mistaken. I think this bug and code dates to 661f35b0c54c79805e6b17944b155c111bc39ec3 from 2014, which I think made the

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

2024-07-02 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. I think this looks good, then. Any other concerns? https://github.com/llvm/llvm-project/pull/96422 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)

2024-06-26 Thread Reid Kleckner via cfe-commits
https://github.com/rnk approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/96487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-06-25 Thread Reid Kleckner via cfe-commits
rnk wrote: IIUC, this effectively removes all empty records from LLVM struct types. This makes the IR less "pretty", but these subobjects are notionally empty and consist of only padding bytes (i8 and i8 arrays) at the end of the day. I think that's acceptable. + @rjmccall , does that sound go

[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)

2024-06-25 Thread Reid Kleckner via cfe-commits
@@ -2986,6 +2989,9 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { case CC_Swift: Out << 'S'; break; rnk wrote: The default case here should be a proper compiler error, not an unreachable, since there's no good way to prevent arb

[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)

2024-06-25 Thread Reid Kleckner via cfe-commits
@@ -2986,6 +2989,9 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC) { case CC_Swift: Out << 'S'; break; case CC_SwiftAsync: Out << 'W'; break; case CC_PreserveMost: Out << 'U'; break; +case CC_PreserveNone: + Out << 'V'; ---

[clang] [MS ABI]: Support preserve_none in MS ABI (PR #96487)

2024-06-25 Thread Reid Kleckner via cfe-commits
https://github.com/rnk edited https://github.com/llvm/llvm-project/pull/96487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   8   9   10   >