[clang] [clang][ASTImporter][StructuralEquivalence] improve StructuralEquivalence on recordType (PR #76226)

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

[clang] [clang][ASTImporter][StructuralEquivalence] improve StructuralEquivalence on recordType (PR #76226)

2023-12-22 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/76226 Types comparison in `StructuralEquivalence` ignores its `DeclContext` when they are generated by template specialization implicitly and this will produce incorrect result. Add comparison of `DeclContext` of

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

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

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-20 Thread Qizhi Hu via cfe-commits
@@ -3220,6 +3220,12 @@ TEST_P(ImportExpr, UnresolvedMemberExpr) { compoundStmt(has(callExpr(has(unresolvedMemberExpr()); } +TEST_P(ImportExpr, BuiltinBitCastExpr) { + MatchVerifier Verifier; + testImport("void declToImport(int T) {

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74813 >From d1f48502c1ec7a58ca18a19dc3631265e5c1b137 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 8 Dec 2023 15:26:01 +0800 Subject: [PATCH] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr ---

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-19 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74919 >From 583cbd47533ff1aa71874c502affc44ce5b5c107 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 9 Dec 2023 12:00:02 +0800 Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

2023-12-17 Thread Qizhi Hu via cfe-commits
@@ -9284,6 +9284,26 @@ TEST_P(ASTImporterOptionSpecificTestBase, // EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1); } +TEST_P(ASTImporterOptionSpecificTestBase, ImportFunctionAutoType) { jcsxky wrote: Code has been fixed.

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

2023-12-17 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74991 >From 6bb37862cb6b09fd252d991d5f3ce0d2208bedac Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 10 Dec 2023 21:01:49 +0800 Subject: [PATCH] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-17 Thread Qizhi Hu via cfe-commits
@@ -9284,6 +9284,24 @@ TEST_P(ASTImporterOptionSpecificTestBase, // EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1); } +const internal::VariadicDynCastAllOfMatcher +builtinBitCastExpr; + +TEST_P(ASTImporterOptionSpecificTestBase, ImportBuiltinBitCastExpr) { + const

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-17 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74813 >From 4e2ac40eece61343b5947ae906e5a4be8a82c823 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 8 Dec 2023 15:26:01 +0800 Subject: [PATCH] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr ---

[clang] [clang][ASTImporter] Fix import of variable template redeclarations. (PR #72841)

2023-12-13 Thread Qizhi Hu via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -5050,6 +5050,59 @@ TEST_P(ImportFriendClasses, RecordVarTemplateDecl) { EXPECT_EQ(ToTUX, ToX); } +TEST_P(ASTImporterOptionSpecificTestBase, VarTemplateDeclConflict) { + getToTuDecl( +

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-13 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > The `VisitTypeAliasTemplateDecl` function should be re-designed to check for > structural equivalence at import. The following test does not pass because an > existing `TypeAliasTemplateDecl` declaration with the same name is always > found and returned, without check for

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-13 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74919 >From a2dcc7f471237e78f374c204216c6574059aa950 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 9 Dec 2023 12:00:02 +0800 Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-13 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74919 >From e4e981ed4f545f3dd4cc709bab30468a8ceb3962 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 9 Dec 2023 12:00:02 +0800 Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-13 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > The problem may be related to the fact that template parameter declarations > can have the `TranslationUnitDecl` as parent until the template (with these > parameters) is finally created. In the temporary phase the object > (`TemplateTypeParmDecl`) is found with lookup if it

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-13 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > The `VisitTypeAliasTemplateDecl` function should be re-designed to check for > structural equivalence at import. The following test does not pass because an > existing `TypeAliasTemplateDecl` declaration with the same name is always > found and returned, without check for

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

2023-12-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74991 >From e5a6b1423919ded1ae11b431b2afa7213d052c41 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 10 Dec 2023 21:01:49 +0800 Subject: [PATCH] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

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

[clang] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in isAncestorDeclContextOf (PR #74991)

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

[clang] [clang][ASTImporter] delay import funtion return type (PR #74991)

2023-12-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74991 >From 07b7415da7af38c45f4d22ba4d42f435c6a9fe68 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 10 Dec 2023 21:01:49 +0800 Subject: [PATCH] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in

[clang] [clang][ASTImporter] delay import funtion return type (PR #74991)

2023-12-11 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74991 >From 8dc4955fad0147db16bddfe8fc7d227ae69b89a1 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sun, 10 Dec 2023 21:01:49 +0800 Subject: [PATCH] [clang][ASTImporter] add processing of SubstNonTypeTemplateParmExpr in

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74919 >From e656aa2a3850f845987bb0ddc56b308d22d2dafd Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 9 Dec 2023 12:00:02 +0800 Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in

[clang] [clang][ASTImporter] delay import funtion return type (PR #74991)

2023-12-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/74991 Import return type of a function would lead infinite recursion when `getAssociatedDecl()` returns itself in `ASTNodeImporter::VisitSubstNonTypeTemplateParmExpr`. Delay import the return type whether it is auto

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-09 Thread Qizhi Hu via cfe-commits
@@ -7820,6 +7820,18 @@ ExpectedStmt ASTNodeImporter::VisitExplicitCastExpr(ExplicitCastExpr *E) { *ToLParenLocOrErr, OCE->getBridgeKind(), E->getCastKind(), *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr); } + case Stmt::BuiltinBitCastExprClass: {

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-09 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74813 >From 53e0a0bb8061e5fbd49c58b30bc1217cbb669352 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 8 Dec 2023 15:26:01 +0800 Subject: [PATCH] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr ---

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

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

[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)

2023-12-08 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/74919 Skip checking `TemplateTypeParmDecl ` in `VisitTypeAliasTemplateDecl`. [Fix this crash](https://github.com/llvm/llvm-project/issues/74765) >From b3c28d66efb98dff8b8f879bda92341bf62f45d3 Mon Sep 17 00:00:00 2001

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/74813 >From 0cab02331a5f1eb85649ab381d73ddb71d354b5b Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 8 Dec 2023 15:26:01 +0800 Subject: [PATCH] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr ---

[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)

2023-12-07 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/74813 This patch aims to fix the [crash](https://github.com/llvm/llvm-project/issues/74774) >From 49ec0838ecef753d86562ce4c12b3d84000a859e Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 8 Dec 2023 15:26:01 +0800

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

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

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-24 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > I think it is better to add the import of AttrName to the attribute import > code (function `Import(const Attr *FromAttr)` and what is called from it). > Probably it works to add it to `AttrImporter::cloneAttr` and do it like > `const IdentifierInfo *ToAttrName = >

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-24 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/73290 >From 20aab6095691f3de5568bc61c83427f380e28350 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 24 Nov 2023 13:55:45 +0800 Subject: [PATCH] [clang][ASTImporter] IdentifierInfo of Attribute should be set using

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-23 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/73290 >From a29523ed19ccb36554ea7ad2597631da26d8baaa Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 24 Nov 2023 13:55:45 +0800 Subject: [PATCH] [clang][ASTImporter] IdentifierInfo of Attribute should be set using

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-23 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/73290 >From 52b972fd84877793fa8099cfb0b5d934c39e5925 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 24 Nov 2023 13:55:45 +0800 Subject: [PATCH] [clang][ASTImporter] IdentifierInfo of Attribute should be set using

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-23 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/73290 >From 150993c21943203d3fd116c3a0456eaea81008de Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 24 Nov 2023 13:55:45 +0800 Subject: [PATCH] [clang][ASTImporter] IdentifierInfo of Attribute should be set using

[clang] [clang][ASTImporter] IdentifierInfo of Attribute should be set using 'ToASTContext' (PR #73290)

2023-11-23 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/73290 None >From cc883836b0c24368a7a438873cec2229776323da Mon Sep 17 00:00:00 2001 From: huqizhi Date: Fri, 24 Nov 2023 13:55:45 +0800 Subject: [PATCH] [clang][ASTImporter] IdentifierInfo of Attribute should be set

[clang] [clang][AST][ASTMerge] prevent AST nodes from being deallocated early (PR #73096)

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

[clang] [clang][AST][ASTMerge] prevent AST nodes from being deallocated early (PR #73096)

2023-11-23 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > You have found that reason for the crash is that references to > `IdentifierInfo` are remaining in `OnDiskChainedHashTableGenerator` and > previously deallocated by `ASTUnit` destruction? In this case why is the > `ASTUnit` (or something in it, probably `ASTContext`) the owner

[clang] [clang][AST][ASTMerge] prevent AST nodes from being deallocated early (PR #73096)

2023-11-23 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > > Debug the #72783 can prove it. Address interval (local from 0x3a9a00 to > > 0x3aaa00) allocated by allocator contains a IdentifierInfo variable (local > > address:0x3aa190) whose address is freed early. > > In this case, it looks better to extract the use-after-free variable

[clang] [clang][AST][ASTMerge] prevent AST nodes from being deallocated early (PR #73096)

2023-11-22 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/73096 This patch aims to fix [error in ast-merge to new ast file](https://github.com/llvm/llvm-project/issues/72783). `ASTUnit` is put in `for` body and AST nodes would be deallocated by allocator. Using these nodes

[clang-tools-extra] [clang] [clang-tidy] fix match for binaryOperator in ExprMutationAnalyzer for misc-const-correctness (PR #70559)

2023-11-06 Thread Qizhi Hu via cfe-commits
jcsxky wrote: how about adding a function call like `f()`? will this can prevent clang to emit empty function body? https://github.com/llvm/llvm-project/pull/70559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang] [clang-tidy] fix match for binaryOperator in ExprMutationAnalyzer for misc-const-correctness (PR #70559)

2023-10-30 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > The top-level Linux and Windows tests work, but inside the `Trigger > Build`/`clang-ci` run, the windows test step fails. I'm not sure what the > difference is between these two Windows tests. This is interesting! Generally speaking, AST of the code in Windows and Linux

[clang] [analyzer] Loop should contain CXXForRangeStmt (PR #70190)

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

[clang] [analyzer] Loop should contain CXXForRangeStmt (PR #70190)

2023-10-25 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/70190 >From b1b49db9f155d0bf0aef626d620b6287509fb538 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 25 Oct 2023 18:13:21 +0800 Subject: [PATCH] [analyzer] Loop should contain CXXForRangeStmt ---

[clang] [analyzer] Loop should contain CXXForRangeStmt (PR #70190)

2023-10-25 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/70190 >From f65ad2217e169b1d6876696201b97ffca5f9c886 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Wed, 25 Oct 2023 18:13:21 +0800 Subject: [PATCH] [analyzer] Loop should contain CXXForRangeStmt ---

[clang] [analyzer] Loop should contain CXXForRangeStmt (PR #70190)

2023-10-25 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/70190 Static analyze can't report diagnose when statement after a CXXForRangeStmt and enable widen, because `ExprEngine::processCFGBlockEntrance` lacks of CXXForRangeStmt and when `AMgr.options.maxBlockVisitOnPath -

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

2023-10-20 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky closed 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-tools-extra] [clang][dataflow]Use cast_or_null instead of cast to prevent crash (PR #68510)

2023-10-18 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Thanks, looks good! > > You can submit as is, but if you're up for it, it would actually be better to > add the new test case directly to the model's unittests. Something like this > test (though just one case is enough -- please put it in a separate TEST_P): > >

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

2023-10-18 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/68510 >From a5c5fc7a17f57a0b6ae328f7138435b4aaf7f9b5 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 of cast to prevent crash

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

2023-10-15 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 cast_or_null instead cast to prevent crash (PR #68510)

2023-10-15 Thread Qizhi Hu via cfe-commits
jcsxky wrote: @ymand Could you take a look at this pr? 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 cast_or_null instead cast to prevent crash (PR #68510)

2023-10-10 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky deleted 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 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 55ca8fa197e469a7c8f57d7a174c07a063eb022e 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-10 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > Thanks for this fix! Unfortunately, I wasn't able to repro the crash in > godbolt: https://godbolt.org/z/s741z5djY. Can you double check that the check > crashes on that example without your fix? The test case is different from that in this patch. Use `float` in `optional`.

[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

<    1   2   3   4   5   >