[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
@@ -180,3 +180,44 @@ void std_forward_rvalue_ref_safe(absl::optional&& opt) { std::forward>(opt).value(); } + +namespace std { + +template +class optional { +public: + template + optional& operator=(const U ){ jcsxky wrote: Using `absl::optional`

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From eb9f8342821048edefaefd038bdd989853ac69a3 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > LGTM, When release notes could be nice > (clang-tools-extra/doc/ReleaseNotest.rst) with something like: `Improved > bugprone-unchecked-optional-acces check to not crash during handling of > optional values` or `to not crash i certain situations` it may also not be so >

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 466b612ff055ff7497c9473b38b90bc849370b21 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 38cf358039d81fb3703885db082b64e11760c5fc Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 7a8c515c70bb06ae886c8c434d9d3a79a152d115 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
@@ -599,7 +599,7 @@ void transferAssignment(const CXXOperatorCallExpr *E, BoolValue , LatticeTransferState ) { assert(E->getNumArgs() > 0); - if (auto *Loc = cast( + if (auto *Loc = dyn_cast_or_null( jcsxky wrote: updated

[clang] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 3978a4322ed7f82b52a1978debe8108f00f18acc Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang-tools-extra] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > please update release note also Although `bugprone-unchecked-optional-access` is used to test this issue, root cause is in `FlowSensitiveAnalysis`. So, I am confused about which file should be updated about release not. Look forward to your suggestion! Thank you.

[clang] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > The fix looks great to me! On the other hand, we usually try to add a > regression test for each of the fixes. Any chance you could get a minimal > reproducer from the codebase you are looking at? Thanks for your suggestion! Test case has been added to reproduce this issue.

[clang-tools-extra] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From 2de967931684cf792a7fc4708c18b867b47a9b3d Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From b0f13442dd6c41331f9ab43f1cd8ac6bbf0deabe Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 8 Oct 2023 16:00:29 +0800 Subject: [PATCH] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash

[clang] [clang][dataflow]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow][]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/68510 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analysis]Use dyn_cast_or_null instead cast to prevent crash (PR #68510)

2023-10-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/68510 `getStorageLocation` may return `nullptr` and this will produce crash when use `cast`, use `dyn_cast_or_null` instead. I test it locally using [FTXUI](https://github.com/ArthurSonzogni/FTXUI) and it may be the

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-10-06 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-10-04 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/67639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-10-03 Thread Qizhi Hu via cfe-commits
@@ -4988,6 +4988,39 @@ TEST_P(ASTImporterOptionSpecificTestBase, } } +TEST_P(ImportFriendClasses, RecordVarTemplateDecl) { + Decl *ToTU = getToTuDecl( + R"( + template + class A { + public: +template +static constexpr bool X = true; +

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-10-03 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From 4a14372fc7856adb5a6d2c2c04eaec8c3a518075 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-10-03 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From 9dc31bfb012c32da7a1bf511db04df9c6c480a78 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Fix release notes, update change description (commit) to describe what was a > problem. Mainly why isThisDeclarationADefinition is needed. After that leave > it open for few days before pushing, so someone else could also look into > this and provide some comments if needed.

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67639 >From ee966ceb8d52c000ece8c04b87f791a71a5bfb07 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Thu, 28 Sep 2023 15:35:35 +0800 Subject: [PATCH] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Release note entry would be welcome. updated https://github.com/llvm/llvm-project/pull/67639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67639 >From 208ecd283322e5533b91d04a6a057062e14f4e18 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Thu, 28 Sep 2023 15:35:35 +0800 Subject: [PATCH] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only

[clang-tools-extra] [clang-tidy]: Add TagDecl into LastTagDeclRanges in UseUsingCheck only when it is a definition (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]: Add TagDecl only when it is a definition && Fix issue 6… (PR #67639)

2023-09-28 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/67639 Fix issue 67529, [clang-tidy: modernize-use-using fails when type is implicitly forward declared](https://github.com/llvm/llvm-project/issues/67529) >From ce645a61b73005a90cc7a0d2cdded632dd047b08 Mon Sep 17

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix crash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From bbde18aade35c431e9c113a9d200102330aa3e3a Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] Fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/67522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From f9ff9c8a328a8c3658da8989a96af548eb685272 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From 23c100253486cf6fb9834d995127e9325a45aec2 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From 8e7bc769bca076d6e2d15d38694e6cf3b67ffdbc Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From f158c9bca3461452b3b2b316f616f08b39e6228e Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/67522 >From 77224ec6297a4fb9a86f2634f4a0278b49e81625 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 27 Sep 2023 15:32:10 +0800 Subject: [PATCH] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record

[clang] [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record (PR #67522)

2023-09-27 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/67522 [clang][ASTImporter] fix clash when import `VarTemplateDecl` in record VarTemplateDecl in Record isn't a definition, when imported, it will crash in `ASTContext::setTemplateOrSpecializationInfo` due to setting

[clang] [clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (PR #66976)

2023-09-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/66976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (PR #66976)

2023-09-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/66976 improve AST comparasion on VarDecl & GotoStmt: 1. VarDecl should not be ignored, 2. GotoStmt has no children, it should be handle explicitly. Reviewed By: donat.nagy Differential Revision:

[clang] [clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (PR #66110)

2023-09-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (PR #66110)

2023-09-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-14 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
@@ -1295,6 +1306,21 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext , return true; } +static bool IsStructurallyEquivalent(StructuralEquivalenceContext , jcsxky wrote: Thanks for your remind. Storage checking is added and other

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 999017a007b77efc6c4b2e643e82379c7c46ca2b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored.

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 98a32795dae4587f64c10f91c6ab47f96881ad4b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored.

[clang] [ASTImport]improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/66110: >From 3194b8958491331918459e6913e5931cc7528115 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023 00:03:27 +0800 Subject: [PATCH] improve ast comparation 1.VarDecl should not be ignored.

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky review_requested https://github.com/llvm/llvm-project/pull/66110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] improve ast comparation (PR #66110)

2023-09-12 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/66110: 1.VarDecl should not be ignored. 2.GotoStmt has no children, it should be handle explicitly. >From ab11dd019685d714a4d697cc021cb313a5b30b95 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 13 Sep 2023

<    1   2   3   4   5