[Lldb-commits] [PATCH] D131900: [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 15 16:49:33 PDT 2022


JDevlieghere added a comment.

In D131900#3724366 <https://reviews.llvm.org/D131900#3724366>, @fixathon wrote:

> I am going to clean up the code in the entire file where **raw pointers** should be **shared_ptr** (because they get cast to shared_ptr anyways). Also planning to convert the **naked new** and the 2-step **shared_ptr** creation to **make_shared<>** ; the former is less-safe for potential leaks, and the latter is strictly better.
>
> @JDevlieghere Yes, some of these planned raw pointer changes could be **unique_ptr**, but these types are already typedef-ed in StructuredData.h as **shared_ptr** and I'd like to preserve the style in the absence of specific know performance issues in this code.

Yup, any smart pointer works for me πŸ‘



================
Comment at: lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp:38
 
+using std::make_shared;
+
----------------
We don't do this anywhere in LLVM, and the coding guidelines explicitly state that "we prefer to explicitly prefix all identifiers from the standard namespace with an β€œstd::” prefix". [1] This isn't exactly the same as `using namespace std` but I would argue the sentiment still holds.

[1] https://llvm.org/docs/CodingStandards.html#do-not-use-using-namespace-std


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131900/new/

https://reviews.llvm.org/D131900



More information about the lldb-commits mailing list