[Lldb-commits] [lldb] [lldb][ClangExpressionParser] Don't leak memory when multiplexing ExternalASTSources (PR #104799)

via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 19 08:34: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 c7a54bfd1d25330199c96dd0a46cef1644b1b1ce 0c23c427f7154dabadbca65f64973ec2dbe365d9 --extensions cpp,h -- lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.cpp lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
``````````

</details>

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

``````````diff
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.cpp
index c1d34c1d51..43a71e036a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.cpp
@@ -22,7 +22,7 @@ lldb_private::ASTConsumerForwarder::~ASTConsumerForwarder() = default;
 void lldb_private::ASTConsumerForwarder::PrintStats() { m_c->PrintStats(); }
 
 lldb_private::SemaSourceWithPriorities::~SemaSourceWithPriorities() {
-  for (auto * Source : Sources)
+  for (auto *Source : Sources)
     Source->Release();
 }
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
index 31345fe35e..4398b7ac2e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
@@ -28,7 +28,7 @@ namespace lldb_private {
 /// Wraps an ExternalASTSource into an ExternalSemaSource.
 class ExternalASTSourceWrapper : public clang::ExternalSemaSource {
   ExternalASTSource *m_Source;
-  
+
   ///< If true, means that this class is responsible for
   ///< decrementing the use count of m_Source.
   bool m_owns_source = false;
@@ -255,8 +255,7 @@ class SemaSourceWithPriorities : public clang::ExternalSemaSource {
 
 private:
   /// The sources ordered in decreasing priority.
-  llvm::SmallVector<clang::ExternalSemaSource*, 2>
-      Sources;
+  llvm::SmallVector<clang::ExternalSemaSource *, 2> Sources;
 
 public:
   /// Construct a SemaSourceWithPriorities with a 'high quality' source that
@@ -264,9 +263,8 @@ public:
   /// as a fallback.
   ///
   /// This class assumes shared ownership of the sources provided to it.
-  SemaSourceWithPriorities(
-      clang::ExternalSemaSource * high_quality_source,
-      clang::ExternalSemaSource * low_quality_source) {
+  SemaSourceWithPriorities(clang::ExternalSemaSource *high_quality_source,
+                           clang::ExternalSemaSource *low_quality_source) {
     assert(high_quality_source);
     assert(low_quality_source);
 

``````````

</details>


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


More information about the lldb-commits mailing list