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
11happy wrote:
what would be the reason for windows build failing , is it a CI issue or
specific to this PR & what can I do to resolve that.
Thank you
https://github.com/llvm/llvm-project/pull/80040
___
cfe-commits mailing list
https://github.com/11happy edited
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
https://github.com/11happy created
https://github.com/llvm/llvm-project/pull/81976
**Overview:**
This pull request fixes #77601 where using the `bitand` operator with boolean
operands should not trigger the warning, as it would indicate an intentional
use of bitwise AND rather than a typo or
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
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
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
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const
ParsedAttr ) {
<< NI.getName() << ParamTy << Ty;
return;
}
+ VarDecl *VD = cast(D);
+ // Create a reference to the variable declaration. This is a fake/dummy
+ // reference.
+
@@ -3780,6 +3780,30 @@ static void handleCleanupAttr(Sema , Decl *D, const
ParsedAttr ) {
<< NI.getName() << ParamTy << Ty;
return;
}
+ VarDecl *VD = cast(D);
+ // Create a reference to the variable declaration. This is a fake/dummy
+ // reference.
+
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.
11happy wrote:
I have fixed the merge conflict , will be adding more tests as I am able to
test them locally.
Thank you
https://github.com/llvm/llvm-project/pull/80040
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
11happy wrote:
I have added a test, but will be adding more in some upcoming commits as I test
them locally.
https://github.com/llvm/llvm-project/pull/80040
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
11happy wrote:
Got it
https://github.com/llvm/llvm-project/pull/80040
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
11happy wrote:
Umm how could I resolve that? I tried various things but none working. 沈
https://github.com/llvm/llvm-project/pull/80040
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
11happy wrote:
```
extern void free(void *);
extern void *malloc(size_t size);
void t8(void) {
void *p __attribute__((cleanup(free))) = malloc(10); //
expected-warning{{attempt to call free on non-heap object 'p'}}
}
```
I added this, but
I am getting this error: (Sorry if its a silly
11happy wrote:
> extern void free(void *);
Sure I already wrote some tests and will commit after locally checking them
but idk everytime I restart pc clang rebuilds itself and that is taking time,
is it normal for clang to rebuild everytime I restart? (I think it has
something to do with
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
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
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
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
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
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
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/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
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
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
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
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
@@ -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:
@@ -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:
@@ -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:
@@ -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:
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
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
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
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
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
@@ -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:
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
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();
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
@@ -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:
@@ -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:
@@ -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:
@@ -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:
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.
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
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
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
@@ -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:
11happy wrote:
> @11happy I've compiled your code to test it on llvm's project and clang-tidy
> seems to sometimes crash. Would you be able to have a look before we merge
> this PR ?
>
> ```
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/
> and include the crash
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
@@ -0,0 +1,175 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
11happy wrote:
> @11happy, regarding the statement count: The tests work when I add
> `statementCountIs(1),` right after `compoundStmt(` ->
> `compoundStmt(statementCountIs(1),`. I removed the binding of the compound
> statement, `Compound` and the `Compoind->size() > 1` check. But the tests
@@ -0,0 +1,175 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
@@ -0,0 +1,175 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
@@ -0,0 +1,139 @@
+//===--- 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:
@@ -0,0 +1,139 @@
+//===--- 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:
11happy wrote:
I did this only the ``` compoundStmt(statementCountIs(1),
has(binaryOperator(...))) ```
error:
```LLVM/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/use-std-min-max.cpp:148:19:
error: CHECK-FIXES: expected string not found in input```
this one is failing
11happy wrote:
> Sorry for making this so iterative ^^ but I think that after these everything
> is good from my side.
No Problem! actually I am quite happy to contribute to the org and am able to
learn something.
https://github.com/llvm/llvm-project/pull/77816
@@ -0,0 +1,139 @@
+//===--- 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:
11happy wrote:
@5chmidti I have added all the requested 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
11happy wrote:
> > It currently handles this case:
> > ```
> > if (value1 < value2)
> > value = value2;
> > else
> > value = value1;
> > ```
>
> When I add
>
> ```c++
> if (value1 < value2)
> value3 = value2;
> else
> value3 = value1;
> ```
>
> (just renamed `value` to
11happy wrote:
> I found some things that should be addressed.
>
> @PiotrZSL you had a comment about "improving readability and promoting the
> use of standard library functions." in `ReleaseNotes.rst`, I just want to
> mention that this sentence is also present in the header and check
>
11happy wrote:
**Updates of Recent Commit:**
- Incorporated all the naming and formatting suggestions by @5chmidti
- Thanks @felix642 for such a great insight on testcases, actually those two
you suggested were actually getting flagged when they shouldn't ,added changes
so that they don't get
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
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
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s readability-use-std-min-max %t
+
+#define MY_MACRO_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+constexpr int myConstexprMin(int a, int b) {
+ return a < b ? a : b;
+}
+
+constexpr int myConstexprMax(int a, int b) {
+ return a > b ? a :
11happy wrote:
A humble reminder. @PiotrZSL Can you please review this and suggest if any
changes required?.
Thank you
https://github.com/llvm/llvm-project/pull/77816
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
11happy wrote:
> @11happy what are you trying to achieve exactly and what is not working ? Is
> this related to the example that you provided above?
>
> > ```
> > auto lhsVar1Str = Lexer::getSourceText(
> >
11happy wrote:
**Here's the update for recent commit :**
- Modified the RegisterMatcher to support the `If` statement with brackets by
adding this ```compoundStmt(has(binaryOperator(
hasOperatorName("="), hasLHS(expr().bind("lhsVar2")),
11happy wrote:
Hello @PiotrZSL , @felix642 , @EugeneZelenko I am not able to get macro thing
done, I request your guidance.
Thank you
https://github.com/llvm/llvm-project/pull/77816
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -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 :
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
@@ -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 :
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
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
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
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
@@ -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
@@ -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
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
@@ -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)
+
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://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
101 - 200 of 247 matches
Mail list logo