llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (smanna12) <details> <summary>Changes</summary> This patch adds an assertion in the DiagnoseDeclAvailabilit() function to ensure that the expected availability attribute is not null before they are passed to hasMatchingEnvironmentOrNone() to prevent potential null pointer dereferences and improve the robustness of the availability diagnostics process. --- Full diff: https://github.com/llvm/llvm-project/pull/97095.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaAvailability.cpp (+1) ``````````diff diff --git a/clang/lib/Sema/SemaAvailability.cpp b/clang/lib/Sema/SemaAvailability.cpp index fed1c68d4d33a..df83bbfb7aac8 100644 --- a/clang/lib/Sema/SemaAvailability.cpp +++ b/clang/lib/Sema/SemaAvailability.cpp @@ -842,6 +842,7 @@ void DiagnoseUnguardedAvailability::DiagnoseDeclAvailability( const AvailabilityAttr *AA = getAttrForPlatform(SemaRef.getASTContext(), OffendingDecl); + assert(AA != nullptr && "expecting valid availability attribute"); bool EnvironmentMatchesOrNone = hasMatchingEnvironmentOrNone(SemaRef.getASTContext(), AA); VersionTuple Introduced = AA->getIntroduced(); `````````` </details> https://github.com/llvm/llvm-project/pull/97095 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits