[clang] [clang][bytecode] Fix delete[] dtor order (PR #128411)

2025-02-23 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128411 As always, call array dtors in reverse order. >From c8d9fba32d6c97e89d320533fd680f6fa2f80a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 23 Feb 2025 10:57:47 +0100 Subject: [PATCH]

[clang] [clang][bytecode] Fix delete[] dtor order (PR #128411)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changes As always, call array dtors in reverse order. --- Full diff: https://github.com/llvm/llvm-project/pull/128411.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Interp.cpp (+4-1) - (modified) clan

[clang] [clang][bytecode] Reject calls to pure virtual functions (PR #128412)

2025-02-23 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/128412 None >From 5bb0213254e070c3c24492d6b7ec6810b13f5455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 23 Feb 2025 11:10:43 +0100 Subject: [PATCH] [clang][bytecode] Reject calls to pure vi

[clang] [clang][bytecode] Reject calls to pure virtual functions (PR #128412)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/128412.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Interp.cpp (+13-1) - (modified) clang/test/AST/ByteCode/cxx2a.cpp (+10) `

[clang-tools-extra] [DRAFT][clang-tidy] modernize-replace-with-stdcopy (PR #113046)

2025-02-23 Thread Kuba Migdał via cfe-commits
https://github.com/kidq330 closed https://github.com/llvm/llvm-project/pull/113046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-23 Thread David Tarditi via cfe-commits
https://github.com/dtarditi updated https://github.com/llvm/llvm-project/pull/126596 >From 06eb6682196249f4cae9801963380d0881d27296 Mon Sep 17 00:00:00 2001 From: David Tarditi Date: Mon, 10 Feb 2025 11:35:45 -0800 Subject: [PATCH 1/3] [analyzer] Update undefined assignment diagnostics to not

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-23 Thread David Tarditi via cfe-commits
dtarditi wrote: @haoNoQ I think sticking with uninitialized is good. I've updated the patch with new error messages using that. Please take a look at it and let me know what you think. I think the right path is to issue a more precise error message for out-of-bounds reads. As you point, w

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-23 Thread David Tarditi via cfe-commits
https://github.com/dtarditi updated https://github.com/llvm/llvm-project/pull/126596 >From 06eb6682196249f4cae9801963380d0881d27296 Mon Sep 17 00:00:00 2001 From: David Tarditi Date: Mon, 10 Feb 2025 11:35:45 -0800 Subject: [PATCH 1/3] [analyzer] Update undefined assignment diagnostics to not

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %check_clang_tidy -std=c99 %s bugprone-true-macro %t +// RUN: %check_clang_tidy -std=c11 %s bugprone-true-macro %t +// RUN: %check_clang_tidy -std=c17 %s bugprone-true-macro %t isuckatcs wrote: That's from `C23-and-later`, but the check

[clang-tools-extra] [clang-tidy]improve performance-unnecessary-value-param performance (PR #128383)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. LGTM but put some entry in check documentation. https://github.com/llvm/llvm-project/pull/128383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang-tools-extra] [clangd] Store full decl/def range with symbol locations (PR #118102)

2025-02-23 Thread via cfe-commits
damnskippy wrote: Been following this thread with much interest albeit selfishly a bit since I was of the impression this PR will pave the way for supporting LocationLink. [Ref: clangd/clangd/discussions/2274] https://github.com/llvm/llvm-project/pull/118102 __

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/5] [Clang] Implement CWG2918 'Consideration of constraints for

[clang] [Clang] Implement CWG2918 'Consideration of constraints for address of overloaded function' (PR #127773)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/127773 >From 2d9c248c70b6d24f277982a32f36e2ef1bde2829 Mon Sep 17 00:00:00 2001 From: Younan Zhang Date: Wed, 19 Feb 2025 17:13:56 +0800 Subject: [PATCH 1/6] [Clang] Implement CWG2918 'Consideration of constraints for

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Oliver Stöneberg via cfe-commits
@@ -0,0 +1,30 @@ +.. title:: clang-tidy - bugprone-unintended-char-ostream-output + +bugprone-unintended-char-ostream-output +=== + +Finds unintended character output from ``unsigned char`` and ``signed char`` to an +``ostream``. + +Normally, w

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Oliver Stöneberg via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.cpp - clang-tidy ===// +// +// 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] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
https://github.com/fangyi-zhou ready_for_review https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread via cfe-commits
@@ -91,6 +91,16 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`bugprone-true-macro + ` check. + + In C++, ``true`` is considered a keyword by the preprocessor so an ``#if true`` + enters the true branch, while in C, ``true`` is not treated as a special +

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread via cfe-commits
@@ -0,0 +1,38 @@ +//===--- TrueMacroCheck.h - clang-tidy --*- 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-tools-extra] [clang-tidy] Fix performance-move-const-arg false negative in ternary… (PR #128402)

2025-02-23 Thread David Rivera via cfe-commits
RiverDave wrote: Thx @HerrCai0907, your feedback has been addresed. https://github.com/llvm/llvm-project/pull/128402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Fix performance-move-const-arg false negative in ternary… (PR #128402)

2025-02-23 Thread David Rivera via cfe-commits
https://github.com/RiverDave edited https://github.com/llvm/llvm-project/pull/128402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix performance-move-const-arg false negative in ternary… (PR #128402)

2025-02-23 Thread David Rivera via cfe-commits
https://github.com/RiverDave updated https://github.com/llvm/llvm-project/pull/128402 >From 5eef2a52de7de53b0fb24781f40a7b02b55025b9 Mon Sep 17 00:00:00 2001 From: Riverdave Date: Sat, 22 Feb 2025 03:57:35 -0500 Subject: [PATCH] [clang-tidy] Fix performance-move-const-arg false negative in ter

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang] [Driver] Replace /usr/lib/../$OSLibDir with /usr/$OSLibDir (PR #128428)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Fangrui Song (MaskRay) Changes The latter is simpler and generalizes the OpenEmbedded special case introduced in https://reviews.llvm.org/D48862 (they have /usr/lib64 but not /usr/lib) --- Patch is 169.23 KiB, truncated to 20.00 K

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL commented: 1. Wrong category, maybe better would be 'portability' 2. To short check name, maybe better would be portability-undefined-bool-literal or something similar. 3. What about 'false' ? 4. This issue is detected by -Wundef compiler warning in both clang and gcc

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %check_clang_tidy -std=c99 %s bugprone-true-macro %t +// RUN: %check_clang_tidy -std=c11 %s bugprone-true-macro %t +// RUN: %check_clang_tidy -std=c17 %s bugprone-true-macro %t + +#define FOO true +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: in C 'true'

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/128265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix performance-move-const-arg false negative in ternary… (PR #128402)

2025-02-23 Thread David Rivera via cfe-commits
@@ -44,6 +44,12 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) { unless(isInTemplateInstantiation())) .bind("call-move"); + // Match ternary expressions where either branch contains std::move + auto TernaryWithMoveMatcher = +

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/128265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,129 @@ +//===--- AmbiguousSmartptrResetCallCheck.cpp - clang-tidy -===// +// +// 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: Ap

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL edited https://github.com/llvm/llvm-project/pull/121291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,129 @@ +//===--- AmbiguousSmartptrResetCallCheck.cpp - clang-tidy -===// +// +// 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: Ap

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. In general looks fine. Few nits. https://github.com/llvm/llvm-project/pull/121291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: %check_clang_tidy %s readability-ambiguous-smartptr-reset-call %t \ +// RUN: -config='{CheckOptions: \ +// RUN: {readability-ambiguous-smartptr-reset-call.SmartPointers: "::std::unique_ptr;::other_ptr"}}' \ +// RUN: --fix-notes -- + +namespace std { + +

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,57 @@ +.. title:: clang-tidy - readability-ambiguous-smartptr-reset-call + +readability-ambiguous-smartptr-reset-call += + +Finds potentially erroneous calls to ``reset`` method on smart pointers when +the pointee type also has a

[clang] [Driver] Replace /usr/lib/../$OSLibDir with /usr/$OSLibDir (PR #128428)

2025-02-23 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/128428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.cpp - clang-tidy ===// +// +// 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] [FatLTO] Detect LLD linker more reliably (PR #128285)

2025-02-23 Thread Vincent Lee via cfe-commits
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/128285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 40b0619 - [FatLTO] Detect LLD linker more reliably (#128285)

2025-02-23 Thread via cfe-commits
Author: Vincent Lee Date: 2025-02-23T12:03:37-08:00 New Revision: 40b0619a53231eafaa879d085b7a7a10441c7f34 URL: https://github.com/llvm/llvm-project/commit/40b0619a53231eafaa879d085b7a7a10441c7f34 DIFF: https://github.com/llvm/llvm-project/commit/40b0619a53231eafaa879d085b7a7a10441c7f34.diff L

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Looks reasonable to me, sorry for the review delay. https://github.com/llvm/llvm-project/pull/121515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [Sema] Add code completion for if constexpr and consteval (PR #124315)

2025-02-23 Thread Letu Ren via cfe-commits
https://github.com/FantasqueX updated https://github.com/llvm/llvm-project/pull/124315 >From 576dcfa4a403b95665e98f9ff225ab5353192e23 Mon Sep 17 00:00:00 2001 From: Letu Ren Date: Sat, 25 Jan 2025 01:23:52 +0800 Subject: [PATCH 1/6] [Sema] Add code completion for if constexpr C++17 supports `i

[clang] [Sema] Add code completion for if constexpr and consteval (PR #124315)

2025-02-23 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 9d1fbbd2b9a00248eb8ea578c4047af4ec4da990 914e63cbc8ac24c808da647fe9516e1d10866c87 --e

[clang] [Sema] Add code completion for if constexpr and consteval (PR #124315)

2025-02-23 Thread Letu Ren via cfe-commits
FantasqueX wrote: Hi @HighCommander4 thanks for your suggestions. I'm happy to add snippets support for `if constexpr` and `if consteval`. Since `if constexp` and `if !consteval` is valid, I decided to add code snippet completion in the specific code completion function instead of in

[clang] [Sema] Add code completion for if constexpr and consteval (PR #124315)

2025-02-23 Thread Letu Ren via cfe-commits
https://github.com/FantasqueX updated https://github.com/llvm/llvm-project/pull/124315 >From 576dcfa4a403b95665e98f9ff225ab5353192e23 Mon Sep 17 00:00:00 2001 From: Letu Ren Date: Sat, 25 Jan 2025 01:23:52 +0800 Subject: [PATCH 1/7] [Sema] Add code completion for if constexpr C++17 supports `i

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Piotr Zegar via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: %check_clang_tidy %s readability-ambiguous-smartptr-reset-call %t \ PiotrZSL wrote: you could merge this file into main test, just have 2 RUN commands there and specify custom suffix for this one (you may need to include current default

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2025-02-23 Thread Baranov Victor via cfe-commits
https://github.com/vbvictor edited https://github.com/llvm/llvm-project/pull/121291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Ujan RoyBandyopadhyay via cfe-commits
https://github.com/ujan-r updated https://github.com/llvm/llvm-project/pull/121515 >From 5d86f27c5dc04217252c2569edca23cc0d7edc23 Mon Sep 17 00:00:00 2001 From: Ujan RoyBandyopadhyay <116058173+uja...@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:20:52 -0600 Subject: [PATCH] [clangd] Reduce

[clang] [llvm] [OpenEmbedded] Fix include and lib paths for multilib targets (PR #121302)

2025-02-23 Thread Fangrui Song via cfe-commits
MaskRay wrote: The include and library path code in the driver needs more love. I have cleaned up some a few years ago but there is still quite a bit tech debt. In particular, the 2018 commit you mentioned (https://reviews.llvm.org/D48862) introduced ``` if (Triple.getVendor() == llvm::Tripl

[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)

2025-02-23 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/128285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

2025-02-23 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/127896 >From 362b64d31e5f70e4a26ea04c99a58fd5f5ca50ca Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 14 Feb 2025 12:59:56 -0800 Subject: [PATCH 1/2] Allow arrays to be returned by value in HLSL + test --- clang/

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH] Fix no warning for comparison of integers of different signs --

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
@@ -10069,6 +10069,17 @@ static std::optional TryGetExprRange(ASTContext &C, const Expr *E, case UO_AddrOf: // should be impossible return IntRange::forValueOfType(C, GetExprType(E)); +case UO_Not: { + std::optional SubRange = TryGetExprRange( + C,

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -625,6 +625,43 @@ static Attr *handleHLSLControlFlowHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) HLSLControlFlowHintAttr(S.Context, A); } +static Attr *handleAtomicAttr(Sema &S, Stmt *St, const ParsedAttr &A, + Source

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -1101,6 +1107,187 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +// The three atomic code-generation options. +// The canonical (positive) names are: +// "remote_memory", "fine_grained_memory", and "ignore_denormal

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -4979,3 +4979,16 @@ def NoTrivialAutoVarInit: InheritableAttr { let Documentation = [NoTrivialAutoVarInitDocs]; let SimpleHandler = 1; } + +def Atomic : StmtAttr { + let Spellings = [Clang<"atomic">]; + let Args = [VariadicStringArgument<"Options">]; y

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
https://github.com/qiongsiwu created https://github.com/llvm/llvm-project/pull/128446 This PR explicitly sets `DebugCompilationDir` to the system's root directory if it is safe to ignore the current working directory. This fixes a problem where a PCM file's embedded debug information can lead

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
qiongsiwu wrote: Note to reviewers: This fixes rdar://145249881, but I'd like to get some input on two things. 1. I am not sure if it is a good idea to always set `DebugCompilationDir` to root. I chose it because I think it is safe and all systems should have the root directory. I am all ear

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -625,6 +625,43 @@ static Attr *handleHLSLControlFlowHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) HLSLControlFlowHintAttr(S.Context, A); } +static Attr *handleAtomicAttr(Sema &S, Stmt *St, const ParsedAttr &A, + Source

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -111,8 +111,13 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -113,8 +113,18 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
https://github.com/isuckatcs edited https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -467,7 +467,7 @@ void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE, SymbolRef Sym; if (!LPos || !RPos) { auto &SymMgr = C.getSymbolManager(); -Sym = SymMgr.conjureSymbol(CE, C.getLocationContext(), isuckatcs wrote: `CE`

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2261,7 +2265,8 @@ void CStringChecker::evalStrcpyCommon(CheckerContext &C, const CallEvent &Call, // If this is a stpcpy-style copy, but we were unable to check for a buffer // overflow, we still need a result. Conjure a return value. if (ReturnEnd && Result.is

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -130,8 +130,9 @@ void ErrnoTesterChecker::evalSetErrnoIfErrorRange(CheckerContext &C, ProgramStateRef StateFailure = State->BindExpr( Call.getOriginExpr(), C.getLocationContext(), SVB.makeIntVal(1, true)); - DefinedOrUnknownSVal ErrnoVal = SVB.conjureSymbolVal( -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1665,8 +1666,9 @@ void CStringChecker::evalMemcmp(CheckerContext &C, const CallEvent &Call, State = CheckBufferAccess(C, State, Left, Size, AccessKind::read, CK); if (State) { // The return value is the comparison result, which we don't know. - SVal CmpV

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -695,6 +695,18 @@ class CFGBlock { void dump() const { dumpToStream(llvm::errs()); } + +void Profile(llvm::FoldingSetNodeID &ID) const { + ID.AddPointer(Parent); + ID.AddInteger(Index); +} + +int64_t getID() const { + return Parent->g

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -229,7 +230,7 @@ DefinedSVal makeRetVal(CheckerContext &C, const CallExpr *CE) { const LocationContext *LCtx = C.getLocationContext(); return C.getSValBuilder() - .conjureSymbolVal(nullptr, CE, LCtx, C.blockCount()) isuckatcs wrote: `CE` in unuse

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2469,14 +2475,14 @@ void CStringChecker::evalStrsep(CheckerContext &C, // further along in the same string, or NULL if there are no more tokens. State = State->bindLoc(*SearchStrLoc, - SVB.conjureSymbolVal(getTag(), Call.getOriginExpr()

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -260,7 +260,7 @@ ProgramStateRef setErrnoStdMustBeChecked(ProgramStateRef State, const MemRegion *ErrnoR = State->get(); if (!ErrnoR) return State; - State = State->invalidateRegions(ErrnoR, InvalE, C.blockCount(), isuckatcs wrote: `InvalE` is an

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2520,7 +2526,8 @@ void CStringChecker::evalStdCopyCommon(CheckerContext &C, SValBuilder &SVB = C.getSValBuilder(); SVal ResultVal = - SVB.conjureSymbolVal(nullptr, Call.getOriginExpr(), LCtx, C.blockCount()); + SVB.conjureSymbolVal(nullptr, Call.getOriginExp

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -326,7 +330,7 @@ void ContainerModeling::handleAssignment(CheckerContext &C, SVal Cont, auto &SVB = C.getSValBuilder(); // Then generate and assign a new "end" symbol for the new container. auto NewEndSym = - SymMgr.conjureSymbol(C

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -80,17 +81,18 @@ class SymbolRegionValue : public SymbolData { /// A symbol representing the result of an expression in the case when we do /// not know anything about what the expression is. class SymbolConjured : public SymbolData { - const Stmt *S; + const CFGBlock::Con

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -494,7 +494,7 @@ void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE, auto &SymMgr = C.getSymbolManager(); auto *LCtx = C.getLocationContext(); RetVal = nonloc::SymbolVal(SymMgr.conjureSymbol( -CE, LCtx, C.getASTContext().BoolTy, C.

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -113,8 +113,18 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1794,7 +1797,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C, // value, so it can be used in constraints, at least. if (result.isUnknown()) { result = C.getSValBuilder().conjureSymbolVal( - nullptr, Call.getOriginExpr(), LCtx, C.block

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2469,14 +2475,14 @@ void CStringChecker::evalStrsep(CheckerContext &C, // further along in the same string, or NULL if there are no more tokens. State = State->bindLoc(*SearchStrLoc, - SVB.conjureSymbolVal(getTag(), Call.getOriginExpr()

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2361,8 +2366,9 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallEvent &Call, const StringLiteral *RightStrLiteral = getCStringLiteral(C, state, Right.Expression, RightVal); bool canComputeResult = false; - SVal resultVal = svalBuilder.conjur

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -151,6 +151,11 @@ class CheckerContext { return Pred->getSVal(S); } + /// Get the CFG Element Ref from the ExprEngine isuckatcs wrote: I think you can remove this comment. It's obvious what the function does even without it. https://github.com/llv

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
https://github.com/isuckatcs requested changes to this pull request. I didn't have enough time to check the whole patch, I'll get back to it later. The general patterns seems to be that when a conjured symbol is created, it's always the reference to the current CFG element that is passed as the

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call, // conjure a return value for later. if (lastElement.isUnknown()) lastElement = C.getSValBuilder().conjureSymbolVal( -nullptr, Call.getOriginExpr

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -533,18 +538,12 @@ class SymbolManager { template const SymExprT *acquire(Args &&...args); - const SymbolConjured *conjureSymbol(const Stmt *E, - const LocationContext *LCtx, QualType T, - unsig

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Qiongsi Wu (qiongsiwu) Changes This PR explicitly sets `DebugCompilationDir` to the system's root directory if it is safe to ignore the current working directory. This fixes a problem where a PCM file's embedded debug information can lea

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
https://github.com/qiongsiwu converted_to_draft https://github.com/llvm/llvm-project/pull/128446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -3101,6 +3101,11 @@ class Parser : public CodeCompletionHandler { std::optional ParseAvailabilitySpec(); ExprResult ParseAvailabilityCheckExpr(SourceLocation StartLoc); + void ParseAtomicAttribute(IdentifierInfo &AttrName, yxsamliu wrote: will use Var

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -1101,6 +1107,187 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +// The three atomic code-generation options. +// The canonical (positive) names are: +// "remote_memory", "fine_grained_memory", and "ignore_denormal

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1770,7 +1772,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C, // All we know is the return value is the min of the string length // and the limit. This is better than nothing. result = C.getSValBuilder().conjureSymbolVal( - nullpt

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -533,18 +538,12 @@ class SymbolManager { template const SymExprT *acquire(Args &&...args); - const SymbolConjured *conjureSymbol(const Stmt *E, - const LocationContext *LCtx, QualType T, - unsig

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call, // conjure a return value for later. if (lastElement.isUnknown()) lastElement = C.getSValBuilder().conjureSymbolVal( -nullptr, Call.getOriginExpr

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1376,8 +1379,8 @@ StoreRef RegionStoreManager::invalidateRegions( } RegionBindingsRef B = getRegionBindings(store); - InvalidateRegionsWorker W(*this, StateMgr, B, S, Count, LCtx, IS, ITraits, -Invalidated, GlobalsFilter); + InvalidateRegi

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -151,10 +151,10 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) { return nonloc::SymbolVal(sym); } -DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, fangyi-zhou wrote: This overload would have been remove

[clang] [clang] Improve module out of date error message (PR #128103)

2025-02-23 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/128103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-02-23 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/121115 >From bca319184733b4bad1eb6b83aaac18a75be40b8c Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Wed, 25 Dec 2024 14:22:10 -0800 Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?= =?

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-02-23 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: @AaronBallman @zygoloid Looks like we agree on https://discourse.llvm.org/t/rfc-remove-vptr-from-undefined/83830 So I'd like to merge this patch this week. https://github.com/llvm/llvm-project/pull/121115 ___ cfe-commits mailing lis

  1   2   >