https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/160222
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/160223
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/159582
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -910,6 +910,8 @@ template
static llvm::ImmutableSet join(llvm::ImmutableSet A,
llvm::ImmutableSet B,
typename llvm::ImmutableSet::Factory &F) {
+ if (A == B)
+return A;
jvoung wrote:
https://github.com/jvoung approved this pull request.
Oof nice find!
https://github.com/llvm/llvm-project/pull/159582
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
Hi, @martinboehme or other reviewers -- is the response in the discourse post
from tbaeder (and link to
https://github.com/llvm/llvm-project/pull/106552#issuecomment-2320298264 )
enough for the concern about getting the rule correct? Thanks!
https://github.com/llvm/llvm-project/
jvoung wrote:
> Good idea, okay, posted a question in the Clang Frontend section
> https://discourse.llvm.org/t/rules-for-overriding-what-this-refers-to-in-the-ast-e-g-if-under-an-initlistexpr/87372
> -- thanks!
Sorry for the delay! We did get one reply saying they came up with a similar
answ
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/146900
>From 7cadb15cacf77231d63bb98846346f819d644fa7 Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Thu, 3 Jul 2025 13:37:18 +
Subject: [PATCH] [clang][dataflow] Handle when `this` refers to a different
location
https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/157535
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
Good idea, okay, posted a question in the Clang Frontend section
https://discourse.llvm.org/t/rules-for-overriding-what-this-refers-to-in-the-ast-e-g-if-under-an-initlistexpr/87372
-- thanks!
https://github.com/llvm/llvm-project/pull/146900
___
@@ -174,6 +355,11 @@ void nested_scopes() {
// CHECK: Expire (LoanID: [[L_OUTER]])
}
+// CHECK-LABEL: Dataflow results:
+// CHECK-DAG: Origin [[O_P]] contains Loan [[L_INNER]]
jvoung wrote:
nit: how about CHECK-NOT O_P contains Loan L_OUTER ?
https://githu
@@ -493,7 +496,241 @@ class FactGenerator : public
ConstStmtVisitor {
};
// = //
-// TODO: Run dataflow analysis to propagate loans, analyse and error
reporting.
+// The Dat
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/148065
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung approved this pull request.
a few small things otherwise LG too
https://github.com/llvm/llvm-project/pull/148065
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi
https://github.com/jvoung ready_for_review
https://github.com/llvm/llvm-project/pull/146900
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/146900
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/146900
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/146900
When `this` is under a CXXDefaultInitExpr. E.g.,
struct S {
int x;
int y = this->x;
};
struct R {
int foo() {
// `this` for `a` refers to an R, but `this`
// for `x` refers to an S.
return S{this
https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/145520
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/132314
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
Hi, just checking if you wanted to merge this, or if there were any other
issues. Thanks!
https://github.com/llvm/llvm-project/pull/131575
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/lis
jvoung wrote:
> @ymand @jvoung I'd like to know if you tried this patch within google and
> within your tooling, and if you can report whether it is suited and if there
> is any noteworthy performance impact.
Ok, I tried some experiments. Our nullability analysis tests do now pass
without the
https://github.com/jvoung approved this pull request.
Please go ahead (need to wait for 1 to 2 weeks) and thanks again for splitting!
https://github.com/llvm/llvm-project/pull/134177
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists
https://github.com/jvoung approved this pull request.
https://github.com/llvm/llvm-project/pull/133350
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -23,12 +24,27 @@ using ast_matchers::pointerType;
using ast_matchers::referenceType;
using ast_matchers::returns;
-bool hasSmartPointerClassShape(const CXXRecordDecl &RD, bool &HasGet,
- bool &HasValue) {
+CanQualType getLikeReturnType(QualType
@@ -164,16 +161,19 @@ ast_matchers::StatementMatcher
isPointerLikeOperatorArrow() {
ofClass(pointerClass();
}
-ast_matchers::StatementMatcher isSmartPointerLikeValueMethodCall() {
+ast_matchers::StatementMatcher
+isSmartPointerLikeValueMethodCal
jvoung wrote:
Thanks, Martin, for the checking over the `nullptr`/`nullptr_t` modeling, and
the suggestion for a `Value &getNullptrValue() const`! We can try that out and
test it that as a followup cleanup for this special-casing.
https://github.com/llvm/llvm-project/pull/129502
__
https://github.com/jvoung approved this pull request.
Thanks!
https://github.com/llvm/llvm-project/pull/131575
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/131055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung commented:
Thanks!
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
Ah yes! Added an expectation annotation for ranges and a test case.
https://github.com/llvm/llvm-project/pull/131055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin
jvoung wrote:
Thank you Owen for the review and helping merge, and thank you all for helping
arrive at a solution!
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/131055
>From b93c10f029fb33e9f7261cbb174d097be4137006 Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Thu, 13 Mar 2025 02:26:41 +
Subject: [PATCH 1/3] [clang][dataflow] For bugprone-unchecked-optional-access
report
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) {
EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen);
}
+TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) {
+ auto Tokens = annotate("x = (foo *_Nullable)*v;");
+ ASSERT_EQ(Tokens.s
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) {
EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen);
}
+TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) {
+ auto Tokens = annotate("x = (foo *_Nullable)*v;");
+ ASSERT_EQ(Tokens.s
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) {
EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen);
}
+TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) {
+ auto Tokens = annotate("x = (foo *_Nullable)*v;");
+ ASSERT_EQ(Tokens.s
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/130346
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH 1/7] [clang-format] Add support for absl nullability macros
---
clang
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/130346
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH 1/8] [clang-format] Add support for absl nullability macros
---
clang
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) {
EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen);
}
+TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) {
+ auto Tokens = annotate("x = (foo *_Nullable)*v;");
+ ASSERT_EQ(Tokens.s
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) {
EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen);
}
+TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) {
+ auto Tokens = annotate("x = (foo *_Nullable)*v;");
+ ASSERT_EQ(Tokens.s
https://github.com/jvoung ready_for_review
https://github.com/llvm/llvm-project/pull/131055
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -12720,6 +12735,21 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast)
{
verifyFormat(("x = (foo *" + AllQualifiers + " __my_qualifier)&v;").str(),
CustomQualifier);
+ // Check additional attribute macros in Google style:
+ FormatStyle LongPointerR
@@ -12518,6 +12521,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
verifyIndependentOfContext("MACRO(A *_Nonnull a);");
verifyIndependentOfContext("MACRO(A *_Nullable a);");
verifyIndependentOfContext("MACRO(A *_Null_unspecified a);");
+ verifyIndependentOfContex
@@ -909,6 +909,12 @@ TEST(ConfigParseTest, ParsesConfiguration) {
Style.AttributeMacros.clear();
CHECK_PARSE("BasedOnStyle: LLVM", AttributeMacros,
std::vector{"__capability"});
+ Style.AttributeMacros.clear();
jvoung wrote:
Ok, done!
https
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung commented:
Thanks for the review!
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/130346
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH 1/6] [clang-format] Add support for absl nullability macros
---
clang
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/130346
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH 1/4] [clang-format] Add support for absl nullability macros
---
clang
@@ -577,57 +580,62 @@ void handleConstMemberCall(const CallExpr *CE,
auto &ResultLoc = State.Env.getResultObjectLocation(*CE);
copyRecord(cast(Loc), ResultLoc, State.Env);
}
-return;
+return true;
}
// Cache if the const method returns a referenc
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
Sorry for the delay!
I ran a few more tests and the downstream null analysis over a corpus of code
with a small change to the patch. The small tweak (below) seems to pass the
tests and your fix helps cover more code, as expected =)
(e.g., analyze both branches when there is an `i
jvoung wrote:
> I wish they had not been added to the default but can't take them off the
> lists for backward compatibility. I don't think we should add more. The
> reason is that people wouldn't be able to turn off the special meaning if
> they wanted to use e.g. `absl_nonnull` as a regular
jvoung wrote:
It would be nice to to avoid having each project configure via
`AttributeMacros`.
The Abseil macro is meant to be a portable way to use the Clang-specific
nullability attributes like `_Nonnull` (portable in that it will be empty for
non-Clang compilers). So one would expect it t
https://github.com/jvoung ready_for_review
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/130346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/130346
None
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH] [clang-format] Add support for absl nullability macros
---
cla
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/130346
>From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Fri, 7 Mar 2025 21:02:16 +
Subject: [PATCH 1/2] [clang-format] Add support for absl nullability macros
---
clang
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -577,57 +580,62 @@ void handleConstMemberCall(const CallExpr *CE,
auto &ResultLoc = State.Env.getResultObjectLocation(*CE);
copyRecord(cast(Loc), ResultLoc, State.Env);
}
-return;
+return true;
}
// Cache if the const method returns a referenc
@@ -551,91 +551,92 @@ void transferCallReturningOptional(const CallExpr *E,
setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env);
}
+// Returns true if the const accessor is handled by caching.
+// Returns false if we could not cache. We should perform default handl
@@ -551,91 +551,92 @@ void transferCallReturningOptional(const CallExpr *E,
setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env);
}
+// Returns true if the const accessor is handled by caching.
+// Returns false if we could not cache. We should perform default handl
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/129930
>From 81f5cfde1029b3c9ddd62eb0587ed370d67cccab Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed, 5 Mar 2025 20:15:48 +
Subject: [PATCH 1/7] [clang][dataflow] Add test for crash repro and clean up
const acc
@@ -551,15 +551,18 @@ void transferCallReturningOptional(const CallExpr *E,
setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env);
}
-void handleConstMemberCall(const CallExpr *CE,
+bool handleConstMemberCall(const CallExpr *CE,
jvoung wrote:
Done!
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/129930
>From 81f5cfde1029b3c9ddd62eb0587ed370d67cccab Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed, 5 Mar 2025 20:15:48 +
Subject: [PATCH 1/5] [clang][dataflow] Add test for crash repro and clean up
const acc
https://github.com/jvoung ready_for_review
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/129930
>From 81f5cfde1029b3c9ddd62eb0587ed370d67cccab Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed, 5 Mar 2025 20:15:48 +
Subject: [PATCH 1/4] [clang][dataflow] Add test for crash repro and clean up
const acc
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/129930
>From 81f5cfde1029b3c9ddd62eb0587ed370d67cccab Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed, 5 Mar 2025 20:15:48 +
Subject: [PATCH 1/3] [clang][dataflow] Add test for crash repro and clean up
const acc
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/129930
>From 81f5cfde1029b3c9ddd62eb0587ed370d67cccab Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed, 5 Mar 2025 20:15:48 +
Subject: [PATCH 1/2] [clang][dataflow] Add test for crash repro and clean up
const acc
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/129930
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/129930
Add test for https://github.com/llvm/llvm-project/issues/125589
The crash is actually incidentally fixed by
https://github.com/llvm/llvm-project/pull/128437 since it added a branch
for the reference case and woul
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/128437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung approved this pull request.
Thanks!
https://github.com/llvm/llvm-project/pull/128437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -114,11 +114,12 @@ Changes in existing checks
and accessing ``value``. The option `IgnoreSmartPointerDereference` should
no longer be needed and will be removed.
+- Improved :doc:`bugprone-unchecked-optional-access
jvoung wrote:
Instead of starting a n
jvoung wrote:
> Updated release notes. Not sure if I need to update
> `clang-tidy/checks/bugprone/unchecked-optional-access.rst`. For me it looks
> like current `Exception: accessor methods` section covers my fix as well.
Agreed that the "`Exception: accessor methods` section covers" your fix
jvoung wrote:
> Addressed all comments. Thanks for the initial feedback!
>
> Regarding documentation: looks like we need to merge #122290 first and then
> update docs in my PR
Thanks for the reminder about #122290 ! Got back to that and merged. Can you
update? It looked like the latest releas
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/122290
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/122290
>From 342ff1a05caa6943fe8a86415f30b433ac30106f Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Thu, 9 Jan 2025 14:10:30 +
Subject: [PATCH 1/6] [clang-tidy] Add a release note about
unchecked-optional-access s
https://github.com/jvoung commented:
Thanks!
https://github.com/llvm/llvm-project/pull/128437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -580,6 +580,26 @@ void handleConstMemberCall(const CallExpr *CE,
return;
}
+ // Cache if the const method returns a reference
+ if (RecordLoc != nullptr && CE->isGLValue()) {
+const FunctionDecl *DirectCallee = CE->getDirectCallee();
+if (DirectCallee == nul
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/128437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -580,6 +580,26 @@ void handleConstMemberCall(const CallExpr *CE,
return;
}
+ // Cache if the const method returns a reference
+ if (RecordLoc != nullptr && CE->isGLValue()) {
+const FunctionDecl *DirectCallee = CE->getDirectCallee();
+if (DirectCallee == nul
@@ -3863,6 +3863,192 @@ TEST_P(UncheckedOptionalAccessTest,
ConstBoolAccessorWithModInBetween) {
)cc");
}
+TEST_P(UncheckedOptionalAccessTest,
+ ConstRefAccessorToOptionalViaConstRefAccessorToHoldingObject) {
+ ExpectDiagnosticsFor(R"cc(
+#include "unchecked_opti
@@ -3863,6 +3863,192 @@ TEST_P(UncheckedOptionalAccessTest,
ConstBoolAccessorWithModInBetween) {
)cc");
}
+TEST_P(UncheckedOptionalAccessTest,
+ ConstRefAccessorToOptionalViaConstRefAccessorToHoldingObject) {
+ ExpectDiagnosticsFor(R"cc(
+#include "unchecked_opti
jvoung wrote:
Appreciate that, thank you!
https://github.com/llvm/llvm-project/pull/127338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
jvoung wrote:
> > In case others notice similar in ClangTidy
> > (`bugprone-unchecked-optional-access`), we are seeing crashes after this
> > change #128068
> > I'm not yet sure the best fix.
>
> Can you try to revert this change to see if the crash issue can be fixed? It
> looks like I missi
https://github.com/jvoung updated
https://github.com/llvm/llvm-project/pull/128065
>From a7002fb5a61c2f6f3c4df2347b6d5f861bf45f8e Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Thu, 20 Feb 2025 19:40:16 +
Subject: [PATCH 1/3] [clang][dataflow] Add test repro for a crash
An issue with looki
jvoung wrote:
In case others notice similar in ClangTidy
(`bugprone-unchecked-optional-access`), we are seeing crashes after this change
https://github.com/llvm/llvm-project/issues/128068
I'm not yet sure the best fix.
https://github.com/llvm/llvm-project/pull/127338
_
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/128065
An issue with looking up the "this" when a default init of
field2 refers to field1.
>From a7002fb5a61c2f6f3c4df2347b6d5f861bf45f8e Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Thu, 20 Feb 2025 19:40:16 +
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/127001
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung edited
https://github.com/llvm/llvm-project/pull/127001
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/127001
We've already migrated known users from the old to the new version of
getOrCreateConstMethodReturnStorageLocation. The conversion is pretty
straightforward as well, if there are out-of-tree users:
Previously: use
https://github.com/jvoung approved this pull request.
Thanks!
https://github.com/llvm/llvm-project/pull/125958
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung closed
https://github.com/llvm/llvm-project/pull/124964
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung ready_for_review
https://github.com/llvm/llvm-project/pull/124964
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jvoung created
https://github.com/llvm/llvm-project/pull/124964
Check the canonical type in the matchers to handle aliases.
For example std::optional uses add_pointer_t<...>.
>From f5414bee931510d530c440f0590226367ba7913c Mon Sep 17 00:00:00 2001
From: Jan Voung
Date: Wed,
jvoung wrote:
> It would be better to use `GtestCmp` if you really want clang-tidy support
> gtest in this check. Here is an unfinished example which can match
>
> ```
> TEST(a, b) {
> std::optional a;
> if (v) {
> a = 1;
> }
> ASSERT_NE(a, std::nullopt);
> a.value();
> }
> ```
>
1 - 100 of 229 matches
Mail list logo