LLDB  mainline
ClangASTMetadata.h
Go to the documentation of this file.
1 //===-- ClangASTMetadata.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 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H
11 
12 #include "lldb/Core/dwarf.h"
13 #include "lldb/lldb-defines.h"
14 #include "lldb/lldb-enumerations.h"
15 
16 namespace lldb_private {
17 
19 public:
21  : m_user_id(0), m_union_is_user_id(false), m_union_is_isa_ptr(false),
22  m_has_object_ptr(false), m_is_self(false), m_is_dynamic_cxx(true),
24 
25  bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx; }
26 
27  void SetIsDynamicCXXType(bool b) { m_is_dynamic_cxx = b; }
28 
29  void SetUserID(lldb::user_id_t user_id) {
30  m_user_id = user_id;
31  m_union_is_user_id = true;
32  m_union_is_isa_ptr = false;
33  }
34 
37  return m_user_id;
38  else
39  return LLDB_INVALID_UID;
40  }
41 
42  void SetISAPtr(uint64_t isa_ptr) {
43  m_isa_ptr = isa_ptr;
44  m_union_is_user_id = false;
45  m_union_is_isa_ptr = true;
46  }
47 
48  uint64_t GetISAPtr() const {
50  return m_isa_ptr;
51  else
52  return 0;
53  }
54 
55  void SetObjectPtrName(const char *name) {
56  m_has_object_ptr = true;
57  if (strcmp(name, "self") == 0)
58  m_is_self = true;
59  else if (strcmp(name, "this") == 0)
60  m_is_self = false;
61  else
62  m_has_object_ptr = false;
63  }
64 
66  if (m_has_object_ptr) {
67  if (m_is_self)
69  else
71  }
73  }
74 
75  const char *GetObjectPtrName() const {
76  if (m_has_object_ptr) {
77  if (m_is_self)
78  return "self";
79  else
80  return "this";
81  } else
82  return nullptr;
83  }
84 
85  bool HasObjectPtr() const { return m_has_object_ptr; }
86 
87  /// A type is "forcefully completed" if it was declared complete to satisfy an
88  /// AST invariant (e.g. base classes must be complete types), but in fact we
89  /// were not able to find a actual definition for it.
91 
92  void SetIsForcefullyCompleted(bool value = true) {
94  }
95 
96  void Dump(Stream *s);
97 
98 private:
99  union {
101  uint64_t m_isa_ptr;
102  };
103 
106 };
107 
108 } // namespace lldb_private
109 
110 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H
lldb_private::ClangASTMetadata::m_is_forcefully_completed
bool m_is_forcefully_completed
Definition: ClangASTMetadata.h:105
lldb_private::ClangASTMetadata::m_union_is_isa_ptr
bool m_union_is_isa_ptr
Definition: ClangASTMetadata.h:104
lldb-defines.h
lldb_private::ClangASTMetadata::SetUserID
void SetUserID(lldb::user_id_t user_id)
Definition: ClangASTMetadata.h:29
LLDB_INVALID_UID
#define LLDB_INVALID_UID
Definition: lldb-defines.h:92
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::ClangASTMetadata::m_is_dynamic_cxx
bool m_is_dynamic_cxx
Definition: ClangASTMetadata.h:105
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ClangASTMetadata::GetObjectPtrLanguage
lldb::LanguageType GetObjectPtrLanguage() const
Definition: ClangASTMetadata.h:65
lldb_private::ClangASTMetadata::SetISAPtr
void SetISAPtr(uint64_t isa_ptr)
Definition: ClangASTMetadata.h:42
lldb_private::ClangASTMetadata::m_union_is_user_id
bool m_union_is_user_id
Definition: ClangASTMetadata.h:104
lldb_private::ClangASTMetadata::SetObjectPtrName
void SetObjectPtrName(const char *name)
Definition: ClangASTMetadata.h:55
lldb_private::ClangASTMetadata::GetISAPtr
uint64_t GetISAPtr() const
Definition: ClangASTMetadata.h:48
lldb_private::ClangASTMetadata::SetIsForcefullyCompleted
void SetIsForcefullyCompleted(bool value=true)
Definition: ClangASTMetadata.h:92
lldb_private::ClangASTMetadata::ClangASTMetadata
ClangASTMetadata()
Definition: ClangASTMetadata.h:20
lldb-enumerations.h
lldb_private::ClangASTMetadata::GetObjectPtrName
const char * GetObjectPtrName() const
Definition: ClangASTMetadata.h:75
lldb_private::ClangASTMetadata::SetIsDynamicCXXType
void SetIsDynamicCXXType(bool b)
Definition: ClangASTMetadata.h:27
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:453
lldb_private::ClangASTMetadata::IsForcefullyCompleted
bool IsForcefullyCompleted() const
A type is "forcefully completed" if it was declared complete to satisfy an AST invariant (e....
Definition: ClangASTMetadata.h:90
lldb_private::ClangASTMetadata
Definition: ClangASTMetadata.h:18
lldb_private::ClangASTMetadata::GetUserID
lldb::user_id_t GetUserID() const
Definition: ClangASTMetadata.h:35
lldb_private::ClangASTMetadata::HasObjectPtr
bool HasObjectPtr() const
Definition: ClangASTMetadata.h:85
lldb_private::ClangASTMetadata::m_has_object_ptr
bool m_has_object_ptr
Definition: ClangASTMetadata.h:104
lldb_private::ClangASTMetadata::m_isa_ptr
uint64_t m_isa_ptr
Definition: ClangASTMetadata.h:101
dwarf.h
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb_private::ClangASTMetadata::m_user_id
lldb::user_id_t m_user_id
Definition: ClangASTMetadata.h:100
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::ClangASTMetadata::GetIsDynamicCXXType
bool GetIsDynamicCXXType() const
Definition: ClangASTMetadata.h:25
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ClangASTMetadata::m_is_self
bool m_is_self
Definition: ClangASTMetadata.h:105
lldb_private::ClangASTMetadata::Dump
void Dump(Stream *s)
Definition: ClangASTMetadata.cpp:14
lldb::eLanguageTypeC_plus_plus
@ eLanguageTypeC_plus_plus
ISO C++:1998.
Definition: lldb-enumerations.h:441