1 //===-- ClangASTMetadata.h --------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H
12 #include "lldb/Core/dwarf.h"
13 #include "lldb/lldb-defines.h"
14 #include "lldb/lldb-enumerations.h"
16 namespace lldb_private
{
18 class ClangASTMetadata
{
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),
23 m_is_forcefully_completed(false) {}
25 bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx
; }
27 void SetIsDynamicCXXType(bool b
) { m_is_dynamic_cxx
= b
; }
29 void SetUserID(lldb::user_id_t user_id
) {
31 m_union_is_user_id
= true;
32 m_union_is_isa_ptr
= false;
35 lldb::user_id_t
GetUserID() const {
36 if (m_union_is_user_id
)
39 return LLDB_INVALID_UID
;
42 void SetISAPtr(uint64_t isa_ptr
) {
44 m_union_is_user_id
= false;
45 m_union_is_isa_ptr
= true;
48 uint64_t GetISAPtr() const {
49 if (m_union_is_isa_ptr
)
55 void SetObjectPtrName(const char *name
) {
56 m_has_object_ptr
= true;
57 if (strcmp(name
, "self") == 0)
59 else if (strcmp(name
, "this") == 0)
62 m_has_object_ptr
= false;
65 lldb::LanguageType
GetObjectPtrLanguage() const {
66 if (m_has_object_ptr
) {
68 return lldb::eLanguageTypeObjC
;
70 return lldb::eLanguageTypeC_plus_plus
;
72 return lldb::eLanguageTypeUnknown
;
75 const char *GetObjectPtrName() const {
76 if (m_has_object_ptr
) {
85 bool HasObjectPtr() const { return m_has_object_ptr
; }
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.
90 bool IsForcefullyCompleted() const { return m_is_forcefully_completed
; }
92 void SetIsForcefullyCompleted(bool value
= true) {
93 m_is_forcefully_completed
= true;
100 lldb::user_id_t m_user_id
;
104 bool m_union_is_user_id
: 1, m_union_is_isa_ptr
: 1, m_has_object_ptr
: 1,
105 m_is_self
: 1, m_is_dynamic_cxx
: 1, m_is_forcefully_completed
: 1;
108 } // namespace lldb_private
110 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H