[clang] Reland: [clang] Diagnose dangling issues for the "Container<GSLPointer>" case. #107213 (PR #108344)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 13:05:12 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 7574e1ddc4be63628cb7617857cc8938058a79d2 ca0b4ba6b691fdd7e55ed50d3240397a00126498 --extensions cpp -- clang/lib/Sema/CheckExprLifetime.cpp 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 7c476a1995..e377676dd8 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -373,10 +373,10 @@ shouldTrackFirstArgumentForConstructor(const CXXConstructExpr *Ctor) {
       !isContainerOfPointer(ClassD))
     return false;
 
-  // For the typical case: `std::vector<std::string_view> abc = {std::string()};`
-  // std::initializer_list is a proxy object that provides access to the backing
-  // array. We perform analysis on it to determine if there are any dangling
-  // temporaries in the backing array.
+  // For the typical case: `std::vector<std::string_view> abc =
+  // {std::string()};` std::initializer_list is a proxy object that provides
+  // access to the backing array. We perform analysis on it to determine if
+  // there are any dangling temporaries in the backing array.
   if (isStdInitializerListOfPointer(FirstArgType->getAsRecordDecl()))
     return true;
   // For the case: `std::optional<std::string_view> abc = std::string();`

``````````

</details>


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


More information about the cfe-commits mailing list