[DAG] Fix typo in VSELECT SimplifyDemandedVectorElts handling. NFC.
[llvm-project.git] / lldb / source / API / Utils.h
blob4201e825c4469e9c433d200bb47fd1653c1e5ac9
1 //===-- Utils.h -------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_API_UTILS_H
10 #define LLDB_SOURCE_API_UTILS_H
12 #include "llvm/ADT/STLExtras.h"
13 #include <memory>
15 namespace lldb_private {
17 template <typename T> std::unique_ptr<T> clone(const std::unique_ptr<T> &src) {
18 if (src)
19 return std::make_unique<T>(*src);
20 return nullptr;
23 template <typename T> std::shared_ptr<T> clone(const std::shared_ptr<T> &src) {
24 if (src)
25 return std::make_shared<T>(*src);
26 return nullptr;
29 } // namespace lldb_private
30 #endif