[clang] Make [[clang::lifetimebound]] work for expressions coming from default arguments (PR #112047)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 11 14:22:28 PDT 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 a6438360d416f4529574eebf6aa65b80d48ef85e 50d036893494f53d22b1c968d48f952d25281605 --extensions cpp -- clang/lib/Sema/CheckExprLifetime.cpp clang/test/SemaCXX/attr-lifetimebound.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 0388efe3f1..9ccdfa3929 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -924,8 +924,8 @@ static SourceRange nextPathEntryRange(const IndirectLocalPath &Path, unsigned I,
       return Path[I].E->getSourceRange();
     }
 
-    case IndirectLocalPathEntry::DefaultArg:
-      return cast<CXXDefaultArgExpr>(Path[I].E)->getUsedLocation();
+  case IndirectLocalPathEntry::DefaultArg:
+    return cast<CXXDefaultArgExpr>(Path[I].E)->getUsedLocation();
   }
   return E->getSourceRange();
 }
@@ -1252,7 +1252,7 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
         break;
       }
       }
-      }
+    }
     }
 
     // We didn't lifetime-extend, so don't go any further; we don't need more

``````````

</details>


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


More information about the cfe-commits mailing list