[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
ccotter wrote: Oh, you are entirely right. I completely missed that gcc had this check. All of my test cases are covered by gcc's check, and gcc's check is a bit smarter than mine (`sprintf(stp->buf, "%s", st1.buf)` is caught by gcc, but not my check). Is this still worth adding here? I didn't

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/20] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/21] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-sprintf-argument-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
https://github.com/ccotter edited https://github.com/llvm/llvm-project/pull/114244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
ccotter wrote: Ok, all comments should be addressed. The check now uses `areStatementsIdentical` to more generically find buggy patterns (thanks for that suggestion!). https://github.com/llvm/llvm-project/pull/114244 ___ cfe-commits mailing list cfe-

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/19] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-06 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/18] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/17] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/16] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/15] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/13] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
@@ -0,0 +1,82 @@ +//===--- UndefinedSprintfOverlapCheck.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-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/12] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
@@ -0,0 +1,82 @@ +//===--- UndefinedSprintfOverlapCheck.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-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/12] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-05 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 01/10] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-04 Thread Chris Cotter via cfe-commits
ccotter wrote: Thanks both @nicovank @5chmidti for the overlapping reviews. I got sidetracked, but am coming back to hopefully finish this up. Re: supporting more use cases, I found nearly all bugs in our codebase were of the simple form `sprintf(a, "", ..., a, ...)` with a simple DeclRefExpr.

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-04 Thread Chris Cotter via cfe-commits
@@ -0,0 +1,23 @@ +.. title:: clang-tidy - bugprone-undefined-sprintf-overlap + +bugprone-undefined-sprintf-overlap ccotter wrote: I like this better. I'll change this. https://github.com/llvm/llvm-project/pull/114244 _

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-04 Thread Chris Cotter via cfe-commits
ccotter wrote: > 1. How common is this bug? In one of our internal codebases, a sample of about 1500 files found just over 2% of the files had this bug. As we migrated platforms/standard libraries, the behavior which was previously correct (by chance) changed to be incorrect. > 2. What happen

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-04 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/8] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2025-01-04 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/6] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2024-11-08 Thread Chris Cotter via cfe-commits
ccotter wrote: @PiotrZSL @5chmidti mind giving this a review? https://github.com/llvm/llvm-project/pull/114244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2024-11-02 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/5] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang] [clang][NFC] Spell out DynTypedNode instead of auto (PR #114427)

2024-11-02 Thread Chris Cotter via cfe-commits
ccotter wrote: While working on #114244, I noticed the use of `auto` in `memberHasSameNameAsBoundNode`. The only other place I could find using `auto` with `Nodes.getNode` was in the second file I changed. https://github.com/llvm/llvm-project/pull/114427 ___

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2024-10-31 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/4] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang-tools-extra] Add bugprone-undefined-sprintf-overlap (PR #114244)

2024-10-31 Thread Chris Cotter via cfe-commits
https://github.com/ccotter edited https://github.com/llvm/llvm-project/pull/114244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-sprintf-overlap (PR #114244)

2024-10-31 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/2] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang-tools-extra] Add bugprone-sprintf-overlap (PR #114244)

2024-10-30 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From fd914cc82688b122654d2d7ada72007541b197c0 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyModul

[clang-tools-extra] Add bugprone-sprintf-overlap (PR #114244)

2024-10-30 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/114244 >From 835540fb51517eb2b9e80a7c3b23988419cfc962 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH 1/3] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTidyM

[clang-tools-extra] Add bugprone-sprintf-overlap (PR #114244)

2024-10-30 Thread Chris Cotter via cfe-commits
https://github.com/ccotter created https://github.com/llvm/llvm-project/pull/114244 None >From 835540fb51517eb2b9e80a7c3b23988419cfc962 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Wed, 30 Oct 2024 10:54:49 -0400 Subject: [PATCH] Add bugprone-sprintf-overlap --- .../bugprone/BugproneTid

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-09-24 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/4] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-09-24 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/3] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-09-18 Thread Chris Cotter via cfe-commits
ccotter wrote: bump @ymand @PiotrZSL? https://github.com/llvm/llvm-project/pull/101450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-18 Thread Chris Cotter via cfe-commits
ccotter wrote: bump @ymand @PiotrZSL? https://github.com/llvm/llvm-project/pull/101450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-18 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/3] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-12 Thread Chris Cotter via cfe-commits
ccotter wrote: @ymand could you please re-review? https://github.com/llvm/llvm-project/pull/101450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-09 Thread Chris Cotter via cfe-commits
@@ -38,10 +38,22 @@ namespace clang { namespace dataflow { -static bool isTopLevelNamespaceWithName(const NamespaceDecl &NS, -llvm::StringRef Name) { - return NS.getDeclName().isIdentifier() && NS.getName() == Name && - NS.getPa

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-09 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/3] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-09 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/3] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-01 Thread Chris Cotter via cfe-commits
ccotter wrote: Agreed it should be configurable. I updated the docs, would you mind merging if you are OK as I don't have perms? https://github.com/llvm/llvm-project/pull/101450 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-08-01 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/101450 >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH 1/2] [clang-tidy] Add support for bsl::optional --- clang-tools-

[clang] [clang-tools-extra] [clang-tidy] Add support for bsl::optional (PR #101450)

2024-07-31 Thread Chris Cotter via cfe-commits
https://github.com/ccotter created https://github.com/llvm/llvm-project/pull/101450 None >From f7e7681db6ad83878fd00cf250047c98b1b4f051 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 23 Jul 2024 10:30:54 -0400 Subject: [PATCH] [clang-tidy] Add support for bsl::optional --- clang-tool

[clang-tools-extra] [clang-tidy] Fix crash in modernize-use-constraints (PR #92019)

2024-05-14 Thread Chris Cotter via cfe-commits
https://github.com/ccotter approved this pull request. https://github.com/llvm/llvm-project/pull/92019 ___ 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 bug in modernize-use-emplace (PR #66169)

2023-10-01 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/66169 >From d8c40ccc6744d350b8bc530917accd1d8d87118e Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Mon, 11 Sep 2023 00:05:54 -0400 Subject: [PATCH 1/3] [clang-tidy] Fix bug in modernize-use-emplace emplace_back ca

[clang-tools-extra] [clang-tidy] Fix bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/66169: >From d8c40ccc6744d350b8bc530917accd1d8d87118e Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Mon, 11 Sep 2023 00:05:54 -0400 Subject: [PATCH] [clang-tidy] Fix bug in modernize-use-emplace emplace_back canno

[clang-tools-extra] [clang-tidy] Fix bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter review_requested https://github.com/llvm/llvm-project/pull/66169 ___ 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 bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter review_requested https://github.com/llvm/llvm-project/pull/66169 ___ 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 bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter review_requested https://github.com/llvm/llvm-project/pull/66169 ___ 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 bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter review_requested https://github.com/llvm/llvm-project/pull/66169 ___ 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 bug in modernize-use-emplace (PR #66169)

2023-09-12 Thread Chris Cotter via cfe-commits
https://github.com/ccotter created https://github.com/llvm/llvm-project/pull/66169: emplace_back cannot construct an aggregate with arguments used to initialize the aggregate. Closes #62387 Test plan: Added test test from #62387 which contains code that should not be replaced by the check. >