Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTMetadata.h
39653 views
//===-- ClangASTMetadata.h --------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H9#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H1011#include "lldb/Core/dwarf.h"12#include "lldb/lldb-defines.h"13#include "lldb/lldb-enumerations.h"1415namespace lldb_private {1617class ClangASTMetadata {18public:19ClangASTMetadata()20: m_user_id(0), m_union_is_user_id(false), m_union_is_isa_ptr(false),21m_has_object_ptr(false), m_is_self(false), m_is_dynamic_cxx(true),22m_is_forcefully_completed(false) {}2324bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx; }2526void SetIsDynamicCXXType(bool b) { m_is_dynamic_cxx = b; }2728void SetUserID(lldb::user_id_t user_id) {29m_user_id = user_id;30m_union_is_user_id = true;31m_union_is_isa_ptr = false;32}3334lldb::user_id_t GetUserID() const {35if (m_union_is_user_id)36return m_user_id;37else38return LLDB_INVALID_UID;39}4041void SetISAPtr(uint64_t isa_ptr) {42m_isa_ptr = isa_ptr;43m_union_is_user_id = false;44m_union_is_isa_ptr = true;45}4647uint64_t GetISAPtr() const {48if (m_union_is_isa_ptr)49return m_isa_ptr;50else51return 0;52}5354void SetObjectPtrName(const char *name) {55m_has_object_ptr = true;56if (strcmp(name, "self") == 0)57m_is_self = true;58else if (strcmp(name, "this") == 0)59m_is_self = false;60else61m_has_object_ptr = false;62}6364lldb::LanguageType GetObjectPtrLanguage() const {65if (m_has_object_ptr) {66if (m_is_self)67return lldb::eLanguageTypeObjC;68else69return lldb::eLanguageTypeC_plus_plus;70}71return lldb::eLanguageTypeUnknown;72}7374const char *GetObjectPtrName() const {75if (m_has_object_ptr) {76if (m_is_self)77return "self";78else79return "this";80} else81return nullptr;82}8384bool HasObjectPtr() const { return m_has_object_ptr; }8586/// A type is "forcefully completed" if it was declared complete to satisfy an87/// AST invariant (e.g. base classes must be complete types), but in fact we88/// were not able to find a actual definition for it.89bool IsForcefullyCompleted() const { return m_is_forcefully_completed; }9091void SetIsForcefullyCompleted(bool value = true) {92m_is_forcefully_completed = true;93}9495void Dump(Stream *s);9697private:98union {99lldb::user_id_t m_user_id;100uint64_t m_isa_ptr;101};102103bool m_union_is_user_id : 1, m_union_is_isa_ptr : 1, m_has_object_ptr : 1,104m_is_self : 1, m_is_dynamic_cxx : 1, m_is_forcefully_completed : 1;105};106107} // namespace lldb_private108109#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGASTMETADATA_H110111112