[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
https://github.com/smanna12 closed https://github.com/llvm/llvm-project/pull/86760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
smanna12 wrote: Thanks @tahonermann and @HoBoIs for reviews! https://github.com/llvm/llvm-project/pull/86760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
https://github.com/tahonermann approved this pull request. Looks good, thanks @smanna12! https://github.com/llvm/llvm-project/pull/86760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
HoBoIs wrote: Looks good to me. https://github.com/llvm/llvm-project/pull/86760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (smanna12) Changes This patch replaces getAs<> with castAs<> to resolve potential static analyzer bugs for 1. Dereferencing Proto1->param_type_begin(), which is known to be nullptr 2. Dereferencing Proto2->param_type_begin(), which is known to be nullptr 3. Dereferencing a pointer issue with nullptr Proto1 when calling param_type_end() 4. Dereferencing a pointer issue with nullptr Proto2 when calling param_type_end() in clang::Sema::getMoreSpecializedTemplate(). --- Full diff: https://github.com/llvm/llvm-project/pull/86760.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+2-2) ``diff diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 97f8445bf819c8..9a55881f644254 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5514,9 +5514,9 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( QualType Obj2Ty; if (TPOC == TPOC_Call) { const FunctionProtoType *Proto1 = -FD1->getType()->getAs(); +FD1->getType()->castAs(); const FunctionProtoType *Proto2 = -FD2->getType()->getAs(); +FD2->getType()->castAs(); // - In the context of a function call, the function parameter types are // used. `` https://github.com/llvm/llvm-project/pull/86760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CLANG] Fix null pointer dereferences (PR #86760)
https://github.com/smanna12 created https://github.com/llvm/llvm-project/pull/86760 This patch replaces getAs<> with castAs<> to resolve potential static analyzer bugs for 1. Dereferencing Proto1->param_type_begin(), which is known to be nullptr 2. Dereferencing Proto2->param_type_begin(), which is known to be nullptr 3. Dereferencing a pointer issue with nullptr Proto1 when calling param_type_end() 4. Dereferencing a pointer issue with nullptr Proto2 when calling param_type_end() in clang::Sema::getMoreSpecializedTemplate(). >From f911587a8b5b9f25b9d35e7edd95cf98bf0cde3d Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" Date: Tue, 26 Mar 2024 19:47:50 -0700 Subject: [PATCH] [NFC][CLANG] Fix null pointer dereferences This patch replaces getAs<> with castAs<> to resolve potential static analyzer bugs for 1. Dereferencing Proto1->param_type_begin(), which is known to be nullptr 2. Dereferencing Proto2->param_type_begin(), which is known to be nullptr 3. Dereferencing a pointer issue with nullptr Proto1 when calling param_type_end() 4. Dereferencing a pointer issue with nullptr Proto2 when calling param_type_end() in clang::Sema::getMoreSpecializedTemplate(). --- clang/lib/Sema/SemaTemplateDeduction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 97f8445bf819c8..9a55881f644254 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5514,9 +5514,9 @@ FunctionTemplateDecl *Sema::getMoreSpecializedTemplate( QualType Obj2Ty; if (TPOC == TPOC_Call) { const FunctionProtoType *Proto1 = -FD1->getType()->getAs(); +FD1->getType()->castAs(); const FunctionProtoType *Proto2 = -FD2->getType()->getAs(); +FD2->getType()->castAs(); // - In the context of a function call, the function parameter types are // used. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits