https://github.com/PhilippRados updated
https://github.com/llvm/llvm-project/pull/115234
>From e819360e6510f12f19b7df9d4eb22c0943776440 Mon Sep 17 00:00:00 2001
From: PhilippR
Date: Thu, 7 Nov 2024 00:06:24 +0100
Subject: [PATCH 1/5] [clang] Added warn-assignment-bool-context
This warning is i
PhilippRados wrote:
I applied the mentioned changes from above and merged the two diagnostics into
a single one. I also added the field IsInsideCondition to the `Expr` class and
everything works. However I’m not sure whether or not this single diagnostic
warrants the extra field in the class.
@@ -8477,6 +8477,9 @@ def err_incomplete_object_call : Error<
def warn_condition_is_assignment : Warning<"using the result of an "
"assignment as a condition without parentheses">,
InGroup;
+def warn_assignment_bool_context : Warning<"suggest parentheses around
assignment
@@ -20287,7 +20287,11 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr
*ParenE) {
ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E,
bool IsConstexpr) {
- DiagnoseAssignmentAsCondition(E);
+ // This warning is a
@@ -8477,6 +8477,9 @@ def err_incomplete_object_call : Error<
def warn_condition_is_assignment : Warning<"using the result of an "
"assignment as a condition without parentheses">,
InGroup;
+def warn_assignment_bool_context : Warning<"suggest parentheses around
assignment
@@ -687,6 +687,48 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind,
const Expr *E) {
<< FixItHint::CreateReplacement(E->getSourceRange(), "nullptr");
}
+void Sema::DiagnoseAssignmentBoolContext(Expr *E, QualType Ty) {
+ // Use copy to not alter original expr
@@ -687,6 +687,48 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind,
const Expr *E) {
<< FixItHint::CreateReplacement(E->getSourceRange(), "nullptr");
}
+void Sema::DiagnoseAssignmentBoolContext(Expr *E, QualType Ty) {
+ // Use copy to not alter original expr
https://github.com/PhilippRados edited
https://github.com/llvm/llvm-project/pull/115234
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -761,6 +803,17 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty,
}
}
+ // FIXME: Doesn't include C89, so this warning isn't emitted when passing
+ // `std=c89`.
+ auto isC = getLangOpts().C99 || getLangOpts().C11 || getLangOpts().C17 ||
P
@@ -761,6 +803,17 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty,
}
}
+ // FIXME: Doesn't include C89, so this warning isn't emitted when passing
+ // `std=c89`.
+ auto isC = getLangOpts().C99 || getLangOpts().C11 || getLangOpts().C17 ||
P
@@ -20287,7 +20287,11 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr
*ParenE) {
ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E,
bool IsConstexpr) {
- DiagnoseAssignmentAsCondition(E);
+ // This warning is a
PhilippRados wrote:
Yup ok. I thought that was what draft was for to check on not-finished
implementations but I just changed it back for review.
https://github.com/llvm/llvm-project/pull/115234
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/PhilippRados ready_for_review
https://github.com/llvm/llvm-project/pull/115234
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
PhilippRados wrote:
No problem, I know everybody is busy.
> The first step is to get the PR out of draft state.
Do you just mean to mark it "read for review" or to apply changes so that it
can be merged? Because the current implementation is not ready as I still have
some questions as to how t
PhilippRados wrote:
@Endilll Do you have some advice regarding this implementation? Or can you
otherwise maybe forward this to someone who can take a look.
https://github.com/llvm/llvm-project/pull/115234
___
cfe-commits mailing list
cfe-commits@lists
https://github.com/PhilippRados created
https://github.com/llvm/llvm-project/pull/115234
This is a fix for #33528 as I messed up my other PR with unsynced changes.
A couple of things make this less straightforward as initially thought, which
is why I would like some feedback as to how these th
https://github.com/PhilippRados edited
https://github.com/llvm/llvm-project/pull/114687
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PhilippRados created
https://github.com/llvm/llvm-project/pull/114687
This is an unfinished implementation of #33528. I have a couple of questions
since I'm new to the codebase:
This warning should be issued for both C and C++. For C++ it is pretty
straightforward since I c
PhilippRados wrote:
@jroelofs can you merge this?
https://github.com/llvm/llvm-project/pull/114410
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PhilippRados created
https://github.com/llvm/llvm-project/pull/114410
changed "disucss" to "discuss"
>From 0932d191b4b260a0b6449124d4fd3735c3fc3291 Mon Sep 17 00:00:00 2001
From: PhilippR
Date: Thu, 31 Oct 2024 15:30:10 +0100
Subject: [PATCH] [clang] Fix a typo in clangs REA
20 matches
Mail list logo