Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Symbol/Type.cpp
//===-- Type.cpp ------------------------------------------------*- C++ -*-===// | //===-- Type.cpp ------------------------------------------------*- C++ -*-===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include "lldb/Core/Module.h" | #include "lldb/Core/Module.h" | ||||
#include "lldb/Utility/DataBufferHeap.h" | #include "lldb/Utility/DataBufferHeap.h" | ||||
#include "lldb/Utility/DataExtractor.h" | #include "lldb/Utility/DataExtractor.h" | ||||
#include "lldb/Utility/Log.h" | |||||
#include "lldb/Utility/Scalar.h" | #include "lldb/Utility/Scalar.h" | ||||
#include "lldb/Utility/StreamString.h" | #include "lldb/Utility/StreamString.h" | ||||
#include "lldb/Symbol/CompilerType.h" | #include "lldb/Symbol/CompilerType.h" | ||||
#include "lldb/Symbol/ObjectFile.h" | #include "lldb/Symbol/ObjectFile.h" | ||||
#include "lldb/Symbol/SymbolContextScope.h" | #include "lldb/Symbol/SymbolContextScope.h" | ||||
#include "lldb/Symbol/SymbolFile.h" | #include "lldb/Symbol/SymbolFile.h" | ||||
#include "lldb/Symbol/SymbolVendor.h" | #include "lldb/Symbol/SymbolVendor.h" | ||||
▲ Show 20 Lines • Show All 459 Lines • ▼ Show 20 Lines | if (encoding_type) { | ||||
encoding_type->GetForwardCompilerType().GetRValueReferenceType(); | encoding_type->GetForwardCompilerType().GetRValueReferenceType(); | ||||
break; | break; | ||||
default: | default: | ||||
llvm_unreachable("Unhandled encoding_data_type."); | llvm_unreachable("Unhandled encoding_data_type."); | ||||
} | } | ||||
} else { | } else { | ||||
// We have no encoding type, return void? | // We have no encoding type, return void? | ||||
TypeSystem *type_system = | auto type_system_or_err = | ||||
m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC); | m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC); | ||||
if (auto err = type_system_or_err.takeError()) { | |||||
LLDB_LOG_ERROR( | |||||
lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), | |||||
std::move(err), | |||||
"Unable to construct void type from ClangASTContext"); | |||||
} else { | |||||
CompilerType void_compiler_type = | CompilerType void_compiler_type = | ||||
type_system->GetBasicTypeFromAST(eBasicTypeVoid); | type_system_or_err->GetBasicTypeFromAST(eBasicTypeVoid); | ||||
switch (m_encoding_uid_type) { | switch (m_encoding_uid_type) { | ||||
case eEncodingIsUID: | case eEncodingIsUID: | ||||
m_compiler_type = void_compiler_type; | m_compiler_type = void_compiler_type; | ||||
break; | break; | ||||
case eEncodingIsConstUID: | case eEncodingIsConstUID: | ||||
m_compiler_type = void_compiler_type.AddConstModifier(); | m_compiler_type = void_compiler_type.AddConstModifier(); | ||||
break; | break; | ||||
case eEncodingIsRestrictUID: | case eEncodingIsRestrictUID: | ||||
m_compiler_type = void_compiler_type.AddRestrictModifier(); | m_compiler_type = void_compiler_type.AddRestrictModifier(); | ||||
break; | break; | ||||
case eEncodingIsVolatileUID: | case eEncodingIsVolatileUID: | ||||
m_compiler_type = void_compiler_type.AddVolatileModifier(); | m_compiler_type = void_compiler_type.AddVolatileModifier(); | ||||
break; | break; | ||||
case eEncodingIsTypedefUID: | case eEncodingIsTypedefUID: | ||||
m_compiler_type = void_compiler_type.CreateTypedef( | m_compiler_type = void_compiler_type.CreateTypedef( | ||||
m_name.AsCString("__lldb_invalid_typedef_name"), | m_name.AsCString("__lldb_invalid_typedef_name"), | ||||
GetSymbolFile()->GetDeclContextContainingUID(GetID())); | GetSymbolFile()->GetDeclContextContainingUID(GetID())); | ||||
break; | break; | ||||
case eEncodingIsPointerUID: | case eEncodingIsPointerUID: | ||||
m_compiler_type = void_compiler_type.GetPointerType(); | m_compiler_type = void_compiler_type.GetPointerType(); | ||||
break; | break; | ||||
case eEncodingIsLValueReferenceUID: | case eEncodingIsLValueReferenceUID: | ||||
m_compiler_type = void_compiler_type.GetLValueReferenceType(); | m_compiler_type = void_compiler_type.GetLValueReferenceType(); | ||||
break; | break; | ||||
case eEncodingIsRValueReferenceUID: | case eEncodingIsRValueReferenceUID: | ||||
m_compiler_type = void_compiler_type.GetRValueReferenceType(); | m_compiler_type = void_compiler_type.GetRValueReferenceType(); | ||||
break; | break; | ||||
default: | default: | ||||
llvm_unreachable("Unhandled encoding_data_type."); | llvm_unreachable("Unhandled encoding_data_type."); | ||||
} | } | ||||
} | } | ||||
} | |||||
// When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is | // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is | ||||
// set to eResolveStateUnresolved so we need to update it to say that we | // set to eResolveStateUnresolved so we need to update it to say that we | ||||
// now have a forward declaration since that is what we created above. | // now have a forward declaration since that is what we created above. | ||||
if (m_compiler_type.IsValid()) | if (m_compiler_type.IsValid()) | ||||
m_flags.compiler_type_resolve_state = eResolveStateForward; | m_flags.compiler_type_resolve_state = eResolveStateForward; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 525 Lines • Show Last 20 Lines |