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

2025-02-04 Thread Hans Wennborg via cfe-commits
zmodem wrote: The build is still broken (e.g. https://lab.llvm.org/buildbot/#/builders/63/builds/3861). I'll back it out. https://github.com/llvm/llvm-project/pull/115099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] 83ff9d4 - Revert "[Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (#115099)"

2025-02-04 Thread Hans Wennborg via cfe-commits
Author: Hans Wennborg Date: 2025-02-04T11:19:20+01:00 New Revision: 83ff9d4a34b1e579dd809759d13b70b8837f0cde URL: https://github.com/llvm/llvm-project/commit/83ff9d4a34b1e579dd809759d13b70b8837f0cde DIFF: https://github.com/llvm/llvm-project/commit/83ff9d4a34b1e579dd809759d13b70b8837f0cde.diff

[clang] [clang] Expose -f(no-)strict-overflow as a clang-cl option (PR #126512)

2025-02-10 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. lg > Previously: #120787 That one landed before the 20 branch point, and this will land after. Maybe we should ask to have it back-ported. https://github.com/llvm/llvm-project/pull/126512 ___ cfe

[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--fmodule-output` (PR #121046)

2025-02-10 Thread Hans Wennborg via cfe-commits
@@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA, } llvm::PrettyStackTraceString CrashInfo("Computing output path"); + // Output to a user requested destination? if (AtTopLevel && !isa(JA) && !isa(JA)) { -if (Arg

[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--fmodule-output` (PR #121046)

2025-02-10 Thread Hans Wennborg via cfe-commits
@@ -14,3 +14,11 @@ //--- test.pcm // CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: '/std:c++20' [-Wunused-command-line-argument] + +// test whether the following outputs %Hello.bmi +// RUN: %clang_cl /std:c++20 --precompile -x c++-module -fmodule-o

[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--fmodule-output` (PR #121046)

2025-02-10 Thread Hans Wennborg via cfe-commits
@@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA, } llvm::PrettyStackTraceString CrashInfo("Computing output path"); + // Output to a user requested destination? if (AtTopLevel && !isa(JA) && !isa(JA)) { -if (Arg

[clang] [-Wunsafe-buffer-usage] Fix assert when constexpr size passed to snprintf() (#119786) (PR #124022)

2025-02-10 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/124022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Fix assert when constexpr size passed to snprintf() (#119786) (PR #124022)

2025-02-06 Thread Hans Wennborg via cfe-commits
zmodem wrote: @ziqingluo-90 can you take a look? https://github.com/llvm/llvm-project/pull/124022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [test] Adjust XFAILs for windows in unique_object_duplication.cpp (PR #126139)

2025-02-07 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/126139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-11 Thread Hans Wennborg via cfe-commits
@@ -154,4 +154,89 @@ namespace GlobalTest { }; inline float Test::disallowedStaticMember2 = 2.3; // hidden-warning {{'disallowedStaticMember2' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage}} -} // namespace

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-11 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem edited https://github.com/llvm/llvm-project/pull/125902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-11 Thread Hans Wennborg via cfe-commits
@@ -3669,6 +3669,7 @@ class Sema final : public SemaBase { /// cause problems if the variable is mutable, its initialization is /// effectful, or its address is taken. bool GloballyUniqueObjectMightBeAccidentallyDuplicated(const VarDecl *Dcl); + void DiagnoseDangerousUni

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-11 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem commented: Seems reasonable to me. Just a few very minor nits. https://github.com/llvm/llvm-project/pull/125902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-11 Thread Hans Wennborg via cfe-commits
@@ -3669,6 +3669,7 @@ class Sema final : public SemaBase { /// cause problems if the variable is mutable, its initialization is /// effectful, or its address is taken. bool GloballyUniqueObjectMightBeAccidentallyDuplicated(const VarDecl *Dcl); + void DiagnoseDangerousUni

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

2025-01-30 Thread Hans Wennborg via cfe-commits
@@ -13374,6 +13374,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, .visit(QT, nullptr, false); } +bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated( +const VarDecl *Dcl) { + if (!Dcl || !getLangOpts().CPlusPlus)

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

2025-01-30 Thread Hans Wennborg via cfe-commits
@@ -6153,6 +6153,15 @@ def warn_static_local_in_extern_inline : Warning< def note_convert_inline_to_static : Note< "use 'static' to give inline function %0 internal linkage">; +def warn_possible_object_duplication_mutable : Warning< + "%0 is mutable, has hidden visibility,

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

2025-01-30 Thread Hans Wennborg via cfe-commits
zmodem wrote: Sounds good. This basically seems fine to me overall. I've just added two more comments. https://github.com/llvm/llvm-project/pull/117622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

2024-12-16 Thread Hans Wennborg via cfe-commits
zmodem wrote: Looks like I was wrong. clang-cl does support `--config` since daebf2c13ce27ac6a7403525cc7fcbc063eb892e, so I suppose we can't just ignore these files. Your change to update the triple based on clang-cl mode earlier makes sense to me. I'm less sure about manually inspecting the

[clang] [Sema] Diagnose tautological bounds checks (PR #120222)

2024-12-18 Thread Hans Wennborg via cfe-commits
zmodem wrote: Nice, thank you! https://github.com/llvm/llvm-project/pull/120222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

2024-12-13 Thread Hans Wennborg via cfe-commits
@@ -1286,6 +1299,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) { appendOneArg(Args, Opt, nullptr); } } + +// The config file may have changed the architecture so apply it. +if (HasConfigFile && Args.hasArg(options::OPT__SLASH_arm64E

[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

2024-12-13 Thread Hans Wennborg via cfe-commits
@@ -1247,6 +1247,19 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) { CLOptions = std::make_unique( ParseArgStrings(ArgList.slice(1), /*UseDriverMode=*/true, ContainsError)); + // We want to determine the triple early so that we load the correct config. +

[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

2024-12-13 Thread Hans Wennborg via cfe-commits
zmodem wrote: > You don't need to use config files with `clang-cl` to need this patch -- you > need it if you use triple-based config files and also use `clang-cl`. The > issue is that if you have, for example, a `x86_64-unknown-linux-gnu.cfg` in a > location that `clang` loads by default, the

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-11 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. The current version lgtm by the way Maybe we should also put a blurb in the main llvm release notes and link to this one. https://github.com/llvm/llvm-project/pull/122462 ___ cfe-commits mailing l

[clang] Revert "[Clang] Implement CWG2369 "Ordering between constraints and substitution"" (PR #122130)

2025-01-08 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. Please go ahead and merge. https://github.com/llvm/llvm-project/pull/122130 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2025-01-08 Thread Hans Wennborg via cfe-commits
zmodem wrote: Here's what I got from creduce: ``` $ cat /tmp/a.ii template using compare_three_way_result_t = _Up ::type; struct __sfinae_assign_base {}; template concept __is_derived_from_optional = requires(_Tp __t) { [](_Up) {}(__t); }; template requires(__is_derived_from_optional

[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

2025-01-08 Thread Hans Wennborg via cfe-commits
zmodem wrote: > We've started seeing libc++ test failures in the Fuchsia toolchain buildbots > for Windows We're hitting the same error in Chromium builds. Here is a stand-alone reproducer: https://crbug.com/388428503#comment4 https://github.com/llvm/llvm-project/pull/102857

[clang] [Clang] Add the `annotate_decl` attribute. (PR #122431)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -8146,14 +8146,45 @@ and copied back to the argument after the callee returns. }]; } +def AnnotateDeclDocs : Documentation { + let Category = DocCatType; + let Heading = "annotate_decl"; + let Content = [{ +This attribute is used to add annotations to declarations, ty

[clang] [RFC] Initial implementation of P2719 (PR #113510)

2025-01-20 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,219 @@ += +C++ Type Aware Allocators += + +.. contents:: + :local: + +Introduction + + +Clang includes an experimental implementation of P2719 "Type-aware allocation +and deallocation functions". + +This is a

[clang] [clang][Driver] Fix triple config loading for clang-cl (PR #111397)

2025-01-27 Thread Hans Wennborg via cfe-commits
zmodem wrote: Okay. I think most of my previous comments (except for "maybe the fix is to always ignore config files in clang-cl mode) still apply though. https://github.com/llvm/llvm-project/pull/111397 ___ cfe-commits mailing list cfe-commits@lists.

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

2025-01-27 Thread Hans Wennborg via cfe-commits
zmodem wrote: > I intend to make the warning on-by-default. However, it currently triggers at > several places in the LLVM project, breaking the CI. Fixing them is > nontrivial and cluttered up the PR, so I made it DefaultIgnore in order to > keep things focused. Should the PR be accepted I pl

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -6153,6 +6153,15 @@ def warn_static_local_in_extern_inline : Warning< def note_convert_inline_to_static : Note< "use 'static' to give inline function %0 internal linkage">; +def warn_possible_object_duplication_mutable : Warning< + "%0 is mutable, has hidden visibility,

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,187 @@ +/** + * When building shared libraries, hidden objects which are defined in header + * files will be duplicated, with one copy in each shared library. If the object + * was meant to be globally unique (one copy per program), this can cause very + * subtle bugs.

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,187 @@ +/** + * When building shared libraries, hidden objects which are defined in header + * files will be duplicated, with one copy in each shared library. If the object + * was meant to be globally unique (one copy per program), this can cause very + * subtle bugs.

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,187 @@ +/** + * When building shared libraries, hidden objects which are defined in header + * files will be duplicated, with one copy in each shared library. If the object + * was meant to be globally unique (one copy per program), this can cause very + * subtle bugs.

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,187 @@ +/** + * When building shared libraries, hidden objects which are defined in header + * files will be duplicated, with one copy in each shared library. If the object + * was meant to be globally unique (one copy per program), this can cause very + * subtle bugs.

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -6153,6 +6153,15 @@ def warn_static_local_in_extern_inline : Warning< def note_convert_inline_to_static : Note< "use 'static' to give inline function %0 internal linkage">; +def warn_possible_object_duplication_mutable : Warning< + "%0 is mutable, has hidden visibility,

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -508,6 +508,10 @@ New Compiler Flags - clang-cl and clang-dxc now support ``-fdiagnostics-color=[auto|never|always]`` in addition to ``-f[no-]color-diagnostics``. +- The ``-Wunique-object-duplication`` warning has been added to warn about objects zmodem

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -13374,6 +13374,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, .visit(QT, nullptr, false); } +bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated( +const VarDecl *Dcl) { + if (!Dcl || !getLangOpts().CPlusPlus)

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

2025-01-29 Thread Hans Wennborg via cfe-commits
@@ -3661,6 +3661,12 @@ class Sema final : public SemaBase { NonTrivialCUnionContext UseContext, unsigned NonTrivialKind); + /// Certain globally-unique variables might be accidentally duplicated if + /// built into mu

[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

2025-01-13 Thread Hans Wennborg via cfe-commits
zmodem wrote: Confirmed Chromium on Windows builds with this patch. https://github.com/llvm/llvm-project/pull/122423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-13 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition + overflow for optimization purposes. For example, a

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

2025-01-16 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem edited https://github.com/llvm/llvm-project/pull/117622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Hans Wennborg via cfe-commits
@@ -13386,6 +13386,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, .visit(QT, nullptr, false); } +bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated( +const VarDecl *dcl) { + if (!dcl || !getLangOpts().CPlusPlus) +return fals

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

2025-01-16 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem commented: Some scattered thoughts: - What about code that's not going into a shared library. Should we disable the warning then, or is the idea that the user does not enable the warning flag in that case? - The new warning is DefaultIgnore. Do you figure it's too no

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

2025-01-16 Thread Hans Wennborg via cfe-commits
@@ -13386,6 +13386,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, .visit(QT, nullptr, false); } +bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated( +const VarDecl *dcl) { + if (!dcl || !getLangOpts().CPlusPlus)

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

2025-01-16 Thread Hans Wennborg via cfe-commits
@@ -13386,6 +13386,62 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc, .visit(QT, nullptr, false); } +bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated( +const VarDecl *dcl) { + if (!dcl || !getLangOpts().CPlusPlus) +return fals

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition + overflow for optimization purposes. For example, a

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition + overflow for optimization purposes. For example, a

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem commented: Thanks for following up on this! https://github.com/llvm/llvm-project/pull/122462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition zmodem wrote: Could we add a motivat

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem edited https://github.com/llvm/llvm-project/pull/122462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition + overflow for optimization purposes. For example, a

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition + overflow for optimization purposes. For example, a

[clang] [Clang] Add release note for pointer overflow optimization change (PR #122462)

2025-01-10 Thread Hans Wennborg via cfe-commits
@@ -58,6 +58,26 @@ code bases. containing strict-aliasing violations. The new default behavior can be disabled using ``-fno-pointer-tbaa``. +- Clang will now more aggressively use undefined behavior on pointer addition zmodem wrote: Fair enough. https://

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

2025-01-15 Thread Hans Wennborg via cfe-commits
zmodem wrote: I'll try to take a look. Also, @ilya-biryukov do you have someone who might want to take a look? https://github.com/llvm/llvm-project/pull/117622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] Enable -Wunique-object-duplication inside templated code (PR #125902)

2025-02-12 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. lgtm I'll wait a day or so before merging in case other reviewers want to chime in. https://github.com/llvm/llvm-project/pull/125902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-15 Thread Hans Wennborg via cfe-commits
zmodem wrote: > What do you think about implementing the suggestion about checking if virtual > methods actually get overridden or not? Since we could only do it for classes with internal linkage, I think it's probably not very valuable. Warning about virtual functions that are not overriding

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-17 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/131188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-14 Thread Hans Wennborg via cfe-commits
@@ -2706,6 +2706,9 @@ def warn_final_dtor_non_final_class : Warning< InGroup; def note_final_dtor_non_final_class_silence : Note< "mark %0 as '%select{final|sealed}1' to silence this warning">; +def warn_unnecessary_virtual_specifier : Warning< + "virtual method %0 is insi

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-14 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem edited https://github.com/llvm/llvm-project/pull/131188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-14 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wunnecessary-virtual-specifier %s + +struct Foo final { + Foo() = default; + virtual ~Foo() = default; // expected-warning {{virtual method}} + virtual Foo& operator=(Foo& other) = default; // ex

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-14 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem commented: Code and test lgtm, but I think we should consider enabling it by default. https://github.com/llvm/llvm-project/pull/131188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang-cl] Accept the --warning-suppression-mappings= option (PR #133092)

2025-03-26 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem created https://github.com/llvm/llvm-project/pull/133092 None >From 7a874d12661de2fe93ac5eba8e68edf25053f462 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 26 Mar 2025 15:24:44 +0100 Subject: [PATCH] [clang-cl] Accept the --warning-suppression-mappings= optio

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-03-27 Thread Hans Wennborg via cfe-commits
zmodem wrote: A few notes from looking today. Reduced main a bit further: ``` int main(int argc, const char** argv) { volatile auto p = &FilteredBreakIteratorBuilder::createEmptyInstance; icu::UnicodeString* St = new icu::UnicodeString("abacabadabacab", 15); delete St; printf("OKAY\n");

[clang] Warn about virtual methods in `final` classes (PR #131188)

2025-03-15 Thread Hans Wennborg via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wunnecessary-virtual-specifier %s + +struct Foo final { + Foo() = default; + virtual ~Foo() = default; // expected-warning {{virtual method}} + virtual Foo& operator=(Foo& other) = default; // ex

[clang] [MS][clang] Add support for vector deleting destructors (PR #126240)

2025-03-17 Thread Hans Wennborg via cfe-commits
zmodem wrote: > but, that is still not a great reproducer for a reverted patch. Especially if > the link issue is due to a missing support in linker. I would appreciate if > you could maybe point to how exactly UnicodeString is used in failing > scenario. I'm sorry that we didn't catch this p

[clang] [clang] Do not diagnose unused deleted operator delete[] (PR #134357)

2025-04-11 Thread Hans Wennborg via cfe-commits
zmodem wrote: We're seeing crashes that bisect to this change. Here is a reproducer: https://crbug.com/410001969#comment3 I'll see if I can get something more reduced as well. https://github.com/llvm/llvm-project/pull/134357 ___ cfe-commits mailing l

[clang] [clang] Do not diagnose unused deleted operator delete[] (PR #134357)

2025-04-11 Thread Hans Wennborg via cfe-commits
zmodem wrote: Smaller repro: ``` $ cat /tmp/a.ii class Trans_NS_cppgc_GarbageCollected { void operator delete[](void *); }; struct ScriptWrappable : Trans_NS_cppgc_GarbageCollected { virtual ~ScriptWrappable(); }; struct __declspec(dllexport) ContentIndexEvent : ScriptWrappable { Content

[clang] [llvm] Enable unnecessary-virtual-specifier by default (PR #133265)

2025-04-07 Thread Hans Wennborg via cfe-commits
zmodem wrote: > I think moving it to -Wextra may be a more palatable approach. What do others > think? Sounds good to me, and I think James makes a good argument. Does that actually help LLVM and libc++ though? I think at least LLVM does enable -Wextra. https://github.com/llvm/llvm-project/p

[clang] e12681a - [clang-cl] Parse the /dynamicdeopt option

2025-04-22 Thread Hans Wennborg via cfe-commits
Author: Hans Wennborg Date: 2025-04-22T11:11:33+02:00 New Revision: e12681ae733e8341c161534d4d4de2611573b616 URL: https://github.com/llvm/llvm-project/commit/e12681ae733e8341c161534d4d4de2611573b616 DIFF: https://github.com/llvm/llvm-project/commit/e12681ae733e8341c161534d4d4de2611573b616.diff

[clang] [Clang] Allow simpler visibility annotations when targeting win32 and mingw (PR #133699)

2025-04-23 Thread Hans Wennborg via cfe-commits
zmodem wrote: I too had trouble understanding this change based on the description. Could you give a concrete example of how mingw and msvc disagree on where to put the attribute, and explain how this pr changes things? Taking a step back, how will this simplify libc++'s visibility annotations

[clang] [llvm] Revert "Enable unnecessary-virtual-specifier by default" (PR #134105)

2025-04-14 Thread Hans Wennborg via cfe-commits
zmodem wrote: > This causes the whole libc++ CI to fail, since we're not building against a > compiler built from current trunk. Can you provide an example, such as a link to a failing build, or an explanation of the failure? I found https://buildkite.com/llvm-project/libcxx-ci/builds?created

[clang] [MS][clang] Revert vector deleting destructors support (PR #135611)

2025-04-14 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/135611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MS][clang] Make sure vector deleting dtor calls correct operator delete (PR #133950)

2025-04-14 Thread Hans Wennborg via cfe-commits
zmodem wrote: > Thanks! Unfortunately it looks like the fix introduced a regression of > #134265 on Windows. Repro: (For reference, this is https://crbug.com/41261 on our side.) The "deleted operator delete[]" is coming from here: https://source.chromium.org/chromium/chromium/src/+/main:v

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem updated https://github.com/llvm/llvm-project/pull/138562 >From e221ba3b0f7b08bcfc56bf75f7505265c332637d Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Mon, 5 May 2025 20:24:15 +0200 Subject: [PATCH 1/2] [Sema] Warn about omitting deprecated enumerator in switch T

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits
@@ -15,7 +15,7 @@ enum SwitchTwo { }; void testSwitchTwo(enum SwitchTwo st) { - switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not handled in switch}} + switch (st) {} // expected-warning{{enumeration values 'Ed', 'Vim' and 'Emacs' not handled in

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits
zmodem wrote: I wonder if we should also do something special about the `-Wdeprecated-declarations` diagnostic in switches. If the user fixes the -Wswitch / -Wreturn-type warnings from `testSwitchFour` the natural way: ``` int testSwitchFour(enum SwitchFour e) { switch (e) { case Red:

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-06 Thread Hans Wennborg via cfe-commits
zmodem wrote: > Fly-by comment: I drafted the following alternative comment in another > thread. Please feel free to disregard as I don't know the tone and style of > comments in these files. (But I appreciate your consideration for the > contents in the message I'd like to see!) > > ``` >

[clang] [cmake] Reenable libclang.dll when LLVM_ENABLE_PIC (PR #138343)

2025-05-05 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/138343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Only emit -Wmicrosoft-goto in C++ mode (PR #138507)

2025-05-05 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/138507 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C] Add -Wjump-bypasses-init (PR #138009)

2025-05-05 Thread Hans Wennborg via cfe-commits
zmodem wrote: > this causes a `-Wmicrosoft-goto` warning on [...] Sent https://github.com/llvm/llvm-project/pull/138507 for this. https://github.com/llvm/llvm-project/pull/138009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] Only emit -Wmicrosoft-goto in C++ mode (PR #138507)

2025-05-05 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem created https://github.com/llvm/llvm-project/pull/138507 Follow-up to #138009 which added diagnostics for "jump past initialization" in C mode, in which case they're not an MS extension. Rate limit ยท GitHub body { backgr

[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

2025-05-05 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem created https://github.com/llvm/llvm-project/pull/138562 This undoes part of 3e4e3b17c14c15c23c0ed18ca9165b42b1b13ae3 which added the "Omitting a deprecated constant is ok; it should never materialize." logic. That seems wrong: deprecated means the enumerator is likel

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Hans Wennborg via cfe-commits
@@ -95,6 +95,8 @@ struct CopiedTypeVisitor { return asDerived().visitARCWeak(FT, std::forward(Args)...); case QualType::PCK_Struct: return asDerived().visitStruct(FT, std::forward(Args)...); +case QualType::PCK_PtrAuth: zmodem wrote: style

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Hans Wennborg via cfe-commits
@@ -103,3 +103,46 @@ static_assert(_Generic(typeof(overload_func(&ptr0)), int : 1, default : 0)); static_assert(_Generic(typeof(overload_func(&valid0)), float : 1, default : 0)); void func(int array[__ptrauth(VALID_DATA_KEY) 10]); // expected-error {{'__ptrauth' qualifier o

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem commented: Looks reasonable to my non-expert eyes https://github.com/llvm/llvm-project/pull/136783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem edited https://github.com/llvm/llvm-project/pull/136783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [MS][clang] Revert vector deleting destructors support (PR #135611)

2025-04-15 Thread Hans Wennborg via cfe-commits
zmodem wrote: Thanks! I'll go ahead and push the button. Hope you feel better soon! https://github.com/llvm/llvm-project/pull/135611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-19 Thread Hans Wennborg via cfe-commits
zmodem wrote: > Adding metadata to an instruction should never be required for correctness I figured the existing use and the fact that it only needs to survive until CoroSplit made it good enough. But you're right, we should do better. I do think we need an explicit way to tell CoroSplit whet

[clang] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-18 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem created https://github.com/llvm/llvm-project/pull/127653 Parameters to a coroutine get copied (moved) to coroutine-local instances which code inside the coroutine then uses. The original parameters should not be part of the frame. Normally CoroSplit figures that out

[clang] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-18 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem updated https://github.com/llvm/llvm-project/pull/127653 >From cde82a27139c39406a9afb5b471fa527e52e5bca Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 18 Feb 2025 15:27:37 +0100 Subject: [PATCH 1/2] [Coroutines] Mark parameter allocas with coro.outside.frame

[clang] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-18 Thread Hans Wennborg via cfe-commits
zmodem wrote: I think this is a better fix than #127524. Please take a look. https://github.com/llvm/llvm-project/pull/127653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-18 Thread Hans Wennborg via cfe-commits
zmodem wrote: We're hitting test failures on Windows as well after the re-land (7e3735d1a1b85cea48feb45cb7c2b5d8eaa216ae). It seems to only reproduce on Windows with ThinLTO, and causes some libclang and clangd lit tests to crash. (Our bug: https://crbug.com/397252105). https://github.com/llv

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-28 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem updated https://github.com/llvm/llvm-project/pull/127653 >From cde82a27139c39406a9afb5b471fa527e52e5bca Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 18 Feb 2025 15:27:37 +0100 Subject: [PATCH 1/8] [Coroutines] Mark parameter allocas with coro.outside.frame

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-28 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/127653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-28 Thread Hans Wennborg via cfe-commits
@@ -855,6 +855,16 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) { // Create parameter copies. We do it before creating a promise, since an // evolution of coroutine TS may allow promise constructor to observe // parameter copies. +for (

[clang] Disable unique-object-duplication warning in templates (PR #129120)

2025-02-28 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem closed https://github.com/llvm/llvm-project/pull/129120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable unique-object-duplication warning in templates (PR #129120)

2025-02-28 Thread Hans Wennborg via cfe-commits
https://github.com/zmodem approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/129120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix missing diagnostic of declaration use when accessing TypeDecls through typename access (PR #129681)

2025-03-10 Thread Hans Wennborg via cfe-commits
zmodem wrote: We're seeing new -Wunguarded-availability warnings after this. A reduced example: ``` $ cat /tmp/x.cc template struct remove_cv { typedef T type; }; struct __attribute__((__availability__(android, introduced = 29))) AAudioStreamWrapper { }; template struct Foo { T *p; }; te

[clang] 28fa1fc - Revert "[clang] Fix missing diagnostic of declaration use when accessing TypeDecls through typename access (#129681)"

2025-03-10 Thread Hans Wennborg via cfe-commits
Author: Hans Wennborg Date: 2025-03-10T14:02:04+01:00 New Revision: 28fa1fcf55b973e13018ac115fcbb357b4c0baad URL: https://github.com/llvm/llvm-project/commit/28fa1fcf55b973e13018ac115fcbb357b4c0baad DIFF: https://github.com/llvm/llvm-project/commit/28fa1fcf55b973e13018ac115fcbb357b4c0baad.diff

<    11   12   13   14   15   16   17   >