aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/CPlusPlus/Generic.cpp
blob: bfe86e4665f65d5b873256f42547e5e16517cbef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//===-- Generic.cpp ------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------------------------------------------------===//

#include "Generic.h"
#include "LibStdcpp.h"
#include "MsvcStl.h"

lldb::ValueObjectSP lldb_private::formatters::GetDesugaredSmartPointerValue(
    ValueObject &ptr, ValueObject &container) {
  auto container_type = container.GetCompilerType().GetNonReferenceType();
  if (!container_type)
    return nullptr;

  auto arg = container_type.GetTypeTemplateArgument(0);
  if (!arg)
    // If there isn't enough debug info, use the pointer type as is
    return ptr.GetSP();

  return ptr.Cast(arg.GetPointerType());
}