[clang] [clang] Fix false positive regression for lifetime analysis warning. (PR #127460)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 17 01:27:06 PST 2025


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 6684a5970e74b8b4c0c83361a90e25dae9646db0 26cf4cd668f9a2d533014a85e8da4a91ce6c8994 --extensions h,cpp -- clang/lib/Sema/CheckExprLifetime.cpp clang/test/Sema/Inputs/lifetime-analysis.h clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 3e0867343c..1f87001f35 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -1244,7 +1244,7 @@ static AnalysisResult analyzePathForGSLPointer(const IndirectLocalPath &Path,
     if (FD &&
         ((FD->getReturnType()->isPointerOrReferenceType() &&
           isRecordWithAttr<OwnerAttr>(FD->getReturnType()->getPointeeType())) ||
-          isGLSPointerType(FD->getReturnType())))
+         isGLSPointerType(FD->getReturnType())))
       return Report;
 
     return Abandon;

``````````

</details>


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


More information about the cfe-commits mailing list