[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-09 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Sorry I was not able to look into the comments for last few days as semester exams are currently going on, I have added the commit suggestions currently and will update with the tests I have written by sunday as exams end. Thank you. https://github.com/llvm/llvm-project/pull/800

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-09 Thread Bhuminjay Soni via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. + DeclR

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-11 Thread Bhuminjay Soni via cfe-commits
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL) { << NI.getName() << ParamTy << Ty; return; } + VarDecl *VD = cast(D); + // Create a reference to the variable declaration. This is a fake/dummy + // reference. + DeclR

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-11 Thread Bhuminjay Soni via cfe-commits
11happy wrote: I have added the tests , and its working as expected . Clang-diagnostics is indeed interesting to work on. Thank you https://github.com/llvm/llvm-project/pull/80040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-11 Thread Bhuminjay Soni via cfe-commits
11happy wrote: sorry for last 3 continuous format code commits, I usually run `git clang-format HEAD~1` and also ran this time idk why it was not correctly formatted so I tried manually and it resulted in so many commits, Thank you https://github.com/llvm/llvm-project/pull/80040 __

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-12 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Sorry, I left the previous function declaration in the `sema.h`, I have removed it now. https://github.com/llvm/llvm-project/pull/80040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/82872 >From 557ee75d60f0fdb4dd2b353c819b4f22f71b46d7 Mon Sep 17 00:00:00 2001 From: 11happy Date: Sat, 24 Feb 2024 13:50:30 +0530 Subject: [PATCH 1/3] add new flag -Wreturn-mismatch Signed-off-by: 11happy --- clang/

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s + +// Test that -Wreturn-mismatch is enabled and -Wreturn-type is disabled. + +int foo(void) __attribute__((noreturn)); +int bar(void); + +void test1() { + return 1; // expected-warni

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wreturn-type -Wno-return-mismatch -fsyntax-only -verify %s 11happy wrote: done https://github.com/llvm/llvm-project/pull/82872 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s 11happy wrote: done https://github.com/llvm/llvm-project/pull/82872 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s + +// Test that -Wreturn-mismatch is enabled and -Wreturn-type is disabled. + +int foo(void) __attribute__((noreturn)); +int bar(void); + +void test1() { + return 1; // expected-warni

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s + +// Test that -Wreturn-mismatch is enabled and -Wreturn-type is disabled. + +int foo(void) __attribute__((noreturn)); +int bar(void); + +void test1() { + return 1; // expected-warni

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s + +// Test that -Wreturn-mismatch is enabled and -Wreturn-type is disabled. + +int foo(void) __attribute__((noreturn)); +int bar(void); + +void test1() { + return 1; // expected-warni

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify %s + +// Test that -Wreturn-mismatch is enabled and -Wreturn-type is disabled. + +int foo(void) __attribute__((noreturn)); +int bar(void); + +void test1() { 11happy wrote

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -94,6 +94,7 @@ Deprecated Compiler Flags Modified Compiler Flags --- +- The `-Wreturn-type` flag has been modified to split some of its functionality into `-Wreturn-mismatch` flag. 11happy wrote: done https://github.com/llvm/llvm-proj

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-08 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy created https://github.com/llvm/llvm-project/pull/84481 **Overview:** This pull request fixes #80850 where author suggests adding a readability check to detect missing parentheses around mathematical expressions when operators of different priorities are used. **T

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/84481 >From 8fdf6306085ed4cf0f77b7e718e374e9f65fedf9 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 8 Mar 2024 19:02:47 +0530 Subject: [PATCH 1/2] add clang-tidy check readability-math-missing-parentheses Signed-of

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Are there any more changes for this PR required from my end? Thank you https://github.com/llvm/llvm-project/pull/82872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,167 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,167 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,167 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,167 @@ +//===--- MathMissingParenthesesCheck.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] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -100,6 +100,12 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`readability-math-missing-parentheses + ` check. + + Checks for mathematical expressions that involve operators + of different priorities. 11happy wrote: done https://github

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-03-11 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %check_clang_tidy %s readability-math-missing-parentheses %t + +// FIXME: Add something that triggers the check here. +void f(){ +//CHECK-MESSAGES: :[[@LINE+2]]:13: warning: add parantheses to clarify the precedence of operations [readability-math-mi

[clang] [clang-tools-extra] [llvm] Diagnose misuse of the cleanup attribute (PR #80040)

2024-03-13 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/80040 error: too big or took too long to generate ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-03-13 Thread Bhuminjay Soni via cfe-commits
11happy wrote: > It looks like it passed on your last commit but you have a conflict now which > you need to resolve. > > Can you merge or do you need help with that? I tried to resolve the merge conflict but the resolve editor is just stuck on loading on Vs Code may be as it have 2 conflicts

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-02-24 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy created https://github.com/llvm/llvm-project/pull/82872 **Overview:** This pull request fixes #72116 where a new flag is introduced for compatibility with GCC 14, the functionality of -Wreturn-type is modified to split some of its behaviors into -Wreturn-mismatch *

[clang] fix unnecessary warning when using bitand with boolean operators (PR #81976)

2024-02-24 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Humble Ping! https://github.com/llvm/llvm-project/pull/81976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-02 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Its a Humble Ping! https://github.com/llvm/llvm-project/pull/82872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/82872 >From 557ee75d60f0fdb4dd2b353c819b4f22f71b46d7 Mon Sep 17 00:00:00 2001 From: 11happy Date: Sat, 24 Feb 2024 13:50:30 +0530 Subject: [PATCH 1/2] add new flag -Wreturn-mismatch Signed-off-by: 11happy --- clang/

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -Wno-error=implicit-int -verify -fblocks -Wno-unreachable-code -Wno-unused-value -Wno-strict-prototypes +// RUN: %clang_cc1 -triple x86_64-apple-darwin9

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -1,5 +1,5 @@ -// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -Wno-int-conversion -Wno-strict-prototypes -Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare -analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-purge=none -verify %s -Wno-

[clang] Add new flag -Wreturn-mismatch (PR #82872)

2024-03-05 Thread Bhuminjay Soni via cfe-commits
@@ -1,5 +1,5 @@ // XFAIL: target=aarch64-pc-windows-msvc -// RUN: %clang_cc1 -Wno-return-type -Wno-unused-value -emit-llvm %s -w -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-return-type -Wno-return-mismatch -Wno-unused-value -emit-llvm %s -w -o - | FileCheck %s

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy created https://github.com/llvm/llvm-project/pull/80040 **Overview:** This pull request fixes #79443 when the cleanup attribute is intended to be applied to a variable declaration, passing its address to a specified function. The problem arises when standard function

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
11happy wrote: the current working is as expected as per my understanding, However I request comments & suggestions from others as I am not quite sure that this would be fine,also apologies for not so good naming. Thank you https://github.com/llvm/llvm-project/pull/80040 _

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/80040 >From 93adb872d0e18ff3a1356ab47527d81b61c920cd Mon Sep 17 00:00:00 2001 From: 11happy Date: Tue, 30 Jan 2024 23:19:04 +0530 Subject: [PATCH 1/2] Diagnose misuse of the cleanup attribute Signed-off-by: 11happy -

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-01-31 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/80040 >From 93adb872d0e18ff3a1356ab47527d81b61c920cd Mon Sep 17 00:00:00 2001 From: 11happy Date: Tue, 30 Jan 2024 23:19:04 +0530 Subject: [PATCH 1/3] Diagnose misuse of the cleanup attribute Signed-off-by: 11happy -

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-01-31 Thread Bhuminjay Soni via cfe-commits
11happy wrote: I was going through the thread on discord whether we should use same diagnostics as GCC or not, so as suggested there we should not directly copy but having same essence will be fine. so in recent commit changed the warning. Thank you https://github.com/llvm/llvm-project/pull/80

[clang] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-01 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @PiotrZSL , I have tried to implement the solution you suggested, took me some time though , but I can say it got me better understanding of how things work. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-01 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/80040 >From 93adb872d0e18ff3a1356ab47527d81b61c920cd Mon Sep 17 00:00:00 2001 From: 11happy Date: Tue, 30 Jan 2024 23:19:04 +0530 Subject: [PATCH 1/4] Diagnose misuse of the cleanup attribute Signed-off-by: 11happy -

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-02 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/80040 >From 93adb872d0e18ff3a1356ab47527d81b61c920cd Mon Sep 17 00:00:00 2001 From: 11happy Date: Tue, 30 Jan 2024 23:19:04 +0530 Subject: [PATCH 1/5] Diagnose misuse of the cleanup attribute Signed-off-by: 11happy -

[clang] Diagnose misuse of the cleanup attribute (PR #80040)

2024-02-02 Thread Bhuminjay Soni via cfe-commits
11happy wrote: tried to implement the requested changes along the new direction, further I have some queries should I let this statament as is or assign to a variable: ``` S.CheckFunctionCall(FD, FunctionCallExpression, FD->getType()->getAs()); ``` Further I request some gu

[clang-tools-extra] [clang] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Humble Ping! (as per the rules ping after week of inactivity) @PiotrZSL , @5chmidti , @felix642 , @EugeneZelenko , I think its nearly done. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.l

[clang-tools-extra] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,188 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,41 @@ +//===--- UseStdMinMaxCheck.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] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-02-04 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,189 @@ +//===--- UseStdMinMaxCheck.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] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-23 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,151 @@ +//===--- UseStdMinMaxCheck.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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-23 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @felix642, I am not able to reproduce this error on my end. Could you please provide steps to reproduce it? Your guidance is highly appreciated. the piece of code you mentioned seems to be causing no error when put with current tests. thank you https://github.com/llvm/llvm-proje

[clang] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-23 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy edited https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-24 Thread Bhuminjay Soni via cfe-commits
11happy wrote: How can I get the implicit cast type? https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-25 Thread Bhuminjay Soni via cfe-commits
11happy wrote: for last 2 days was stuck on these functional bugs but resolved them, and in these last 2 days got to learn a whole lot of things, understood clang,ast matchers in depth and finally resolved these two functional bugs. @felix642 , @PiotrZSL Can you please review it. Thank you. h

[clang] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,189 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,195 @@ +//===--- UseStdMinMaxCheck.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] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,195 @@ +//===--- UseStdMinMaxCheck.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] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,195 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy edited https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
11happy wrote: ``` if (isa(S) && !found) { const auto CastKind = cast(S)->getCastKind(); if (isImplicitCastType(CastKind)) { found = true; const clang::ImplicitCastExpr *ImplicitCast = cast(S); GlobalImplicitCastType = ImplicitCast->getType();

[clang] [clang-tools-extra] [llvm] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-26 Thread Bhuminjay Soni via cfe-commits
11happy wrote: why the test maybe failing on windows build? https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,189 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,195 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,238 @@ +//===--- UseStdMinMaxCheck.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

[llvm] [clang-tools-extra] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,238 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,189 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-27 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,189 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,240 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,240 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy edited https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy edited https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy deleted https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy deleted https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-28 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,240 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,168 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,168 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,168 @@ +//===--- UseStdMinMaxCheck.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] [llvm] [clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-30 Thread Bhuminjay Soni via cfe-commits
11happy wrote: > Other thing is that reviewer should mark issues as resolved after checking > with code, not author. Otherwise is hard to figure out what's done and what's > not. Adding some comment like "Done" is sufficient usually unless issues are > simple. > > Next thing regarding your 2

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 1/9] Add readability check to suggest replacement of conditional statem

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
11happy wrote: Thank you for all the suggestions , I think I have tried to incorporate all of them . https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/10] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/11] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %check_clang_tidy %s readability-ConditionalToStdMinMax %t + +void foo() { + int value1,value2; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use std::max instead of < [readability-ConditionalToStdMinMax] + if (value1 < value2) +value1 = value2;

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/12] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/13] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,31 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or ``std::max`` expressions, +improving readability and promoting the use of

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-12 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @PiotrZSL can you please review the changes. thank you. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/14] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
11happy wrote: I have added the initialisation of variables and also added tests involving constexpr,functions etc. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %check_clang_tidy %s readability-use-std-min-max %t + +void foo() { + int value1,value2,value3; + short value4; + + // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: use `std::max` instead of `<` [readability-use-std-min-max] + if (value1 < value2) +va

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/15] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,33 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or ``std::max`` expressions, 11happy wrote: Oh sorry I misu

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-13 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,33 @@ +.. title:: clang-tidy - readability-use-std-min-max + +readability-use-std-min-max +=== + +Replaces certain conditional statements with equivalent ``std::min`` or ``std::max`` expressions, 11happy wrote: I have fixed it

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-15 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/17] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-15 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @PiotrZSL I have added the suggested changes except that include one, can you please help me regarding that include one as I was unable to find any clang-tidy check which does similar include thing, can you provide me any reference material where I can read about it or can you t

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-15 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy updated https://github.com/llvm/llvm-project/pull/77816 >From 1883d987b2f83adaef05fdb47ae25c7b06582a64 Mon Sep 17 00:00:00 2001 From: 11happy Date: Fri, 12 Jan 2024 00:02:46 +0530 Subject: [PATCH 01/19] Add readability check to suggest replacement of conditional stat

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-15 Thread Bhuminjay Soni via cfe-commits
11happy wrote: @PiotrZSL also added the include check. https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-16 Thread Bhuminjay Soni via cfe-commits
@@ -0,0 +1,121 @@ +// RUN: %check_clang_tidy %s readability-use-std-min-max %t + +constexpr int myConstexprMin(int a, int b) { + return a < b ? a : b; +} + +constexpr int myConstexprMax(int a, int b) { + return a > b ? a : b; +} + +int bar(int x, int y) { + return x < y ? x : y

[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)

2024-01-16 Thread Bhuminjay Soni via cfe-commits
https://github.com/11happy edited https://github.com/llvm/llvm-project/pull/77816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   >