[clang] Detect a return value of Ref<T> & RefPtr<T> (PR #81580)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 00:42:04 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 535da10842c7309e9eeaf9828cf6bb034fecaf16 a781c46e5db132e31816efd7bd475d6af157f256 -- clang/test/Analysis/Checkers/WebKit/call-args-protected-return-value.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/test/Analysis/Checkers/WebKit/mock-types.h clang/test/Analysis/Checkers/WebKit/call-args-safe-functions.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 9e1035ac13..e9b1a4d09c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -124,10 +124,10 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F) {
   while (type) {
     if (auto *elaboratedT = dyn_cast<ElaboratedType>(type)) {
       type = elaboratedT->desugar().getTypePtrOrNull();
-      continue;      
+      continue;
     }
     if (auto *specialT = dyn_cast<TemplateSpecializationType>(type)) {
-      if (auto* decl = specialT->getTemplateName().getAsTemplateDecl()) {
+      if (auto *decl = specialT->getTemplateName().getAsTemplateDecl()) {
         auto name = decl->getNameAsString();
         return name == "Ref" || name == "RefPtr";
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/81580


More information about the cfe-commits mailing list