llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tidy

Author: Zahira Ammarguellat (zahiraam)

<details>
<summary>Changes</summary>

A `nullptr` dereference is detected by the code sanitizer. Adding an assert to 
make sure it's caught.

---
Full diff: https://github.com/llvm/llvm-project/pull/138283.diff


1 Files Affected:

- (modified) 
clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
 (+1) 


``````````diff
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
 
b/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
index 247d287be2b36..e90170a6591da 100644
--- 
a/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
@@ -25,6 +25,7 @@ void 
RedundantFunctionPtrDereferenceCheck::registerMatchers(MatchFinder *Finder)
 
 void RedundantFunctionPtrDereferenceCheck::check(const 
MatchFinder::MatchResult &Result) {
   const auto *Operator = Result.Nodes.getNodeAs<UnaryOperator>("op");
+  assert(Operator && "Operator is null");
   diag(Operator->getOperatorLoc(),
        "redundant repeated dereference of function pointer")
       << FixItHint::CreateRemoval(Operator->getOperatorLoc());

``````````

</details>


https://github.com/llvm/llvm-project/pull/138283
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to