summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-12-10 14:54:41 +0100
committerPavel Labath <pavel@labath.sk>2019-12-16 12:02:32 +0100
commitea2805a04b65331ca568ff76761ef8a52337e42b (patch)
tree279af05eaafb5878dac4adacc74538cbc1018399 /lldb/source/Symbol
parentf8495017f0292df05f23878ea593f68d2d2c75f4 (diff)
downloadbcm5719-llvm-ea2805a04b65331ca568ff76761ef8a52337e42b.tar.gz
bcm5719-llvm-ea2805a04b65331ca568ff76761ef8a52337e42b.zip
[lldb] Centralize desugaring of decltype-like types in ClangASTContext
Summary: These types were handled in some places, but not others. This resulted in (for example) not being able to display members of structs whose types were defined using these constructs. Using getLocallyUnqualifiedSingleStepDesugaredType for these types is not fully equivalent, as it will only desugar them if the types are not instantiation-dependent, whereas previously we did that unconditionally. It's not clear to me which behavior is correct here, but the test suite does not seem to care either way. Reviewers: teemperor, shafik Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71405
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp86
1 files changed, 12 insertions, 74 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index ed613528a2f..95bb4551f2c 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -2499,9 +2499,12 @@ RemoveWrappingTypes(QualType type, ArrayRef<clang::Type::TypeClass> mask = {}) {
type = cast<clang::AtomicType>(type)->getValueType();
break;
case clang::Type::Auto:
+ case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
case clang::Type::Typedef:
+ case clang::Type::TypeOf:
+ case clang::Type::TypeOfExpr:
type = type->getLocallyUnqualifiedSingleStepDesugaredType();
break;
default:
@@ -3765,11 +3768,6 @@ ClangASTContext::GetTypeInfo(lldb::opaque_compiler_type_t type,
return eTypeHasChildren | eTypeIsVector;
case clang::Type::DependentTemplateSpecialization:
return eTypeIsTemplate;
- case clang::Type::Decltype:
- return CompilerType(this, llvm::cast<clang::DecltypeType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetTypeInfo(pointee_or_element_clang_type);
case clang::Type::Enum:
if (pointee_or_element_clang_type)
@@ -3837,17 +3835,6 @@ ClangASTContext::GetTypeInfo(lldb::opaque_compiler_type_t type,
->getUnderlyingType()
.getAsOpaquePtr())
.GetTypeInfo(pointee_or_element_clang_type);
- case clang::Type::TypeOfExpr:
- return CompilerType(this, llvm::cast<clang::TypeOfExprType>(qual_type)
- ->getUnderlyingExpr()
- ->getType()
- .getAsOpaquePtr())
- .GetTypeInfo(pointee_or_element_clang_type);
- case clang::Type::TypeOf:
- return CompilerType(this, llvm::cast<clang::TypeOfType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetTypeInfo(pointee_or_element_clang_type);
case clang::Type::UnresolvedUsing:
return 0;
@@ -3966,8 +3953,11 @@ ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) {
switch (qual_type->getTypeClass()) {
case clang::Type::Atomic:
case clang::Type::Auto:
+ case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
+ case clang::Type::TypeOf:
+ case clang::Type::TypeOfExpr:
llvm_unreachable("Handled in RemoveWrappingTypes!");
case clang::Type::UnaryTransform:
break;
@@ -4049,22 +4039,6 @@ ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) {
case clang::Type::PackExpansion:
break;
- case clang::Type::TypeOfExpr:
- return CompilerType(this, llvm::cast<clang::TypeOfExprType>(qual_type)
- ->getUnderlyingExpr()
- ->getType()
- .getAsOpaquePtr())
- .GetTypeClass();
- case clang::Type::TypeOf:
- return CompilerType(this, llvm::cast<clang::TypeOfType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetTypeClass();
- case clang::Type::Decltype:
- return CompilerType(this, llvm::cast<clang::TypeOfType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetTypeClass();
case clang::Type::TemplateSpecialization:
break;
case clang::Type::DeducedTemplateSpecialization:
@@ -4678,9 +4652,12 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
switch (qual_type->getTypeClass()) {
case clang::Type::Atomic:
case clang::Type::Auto:
+ case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
case clang::Type::Typedef:
+ case clang::Type::TypeOf:
+ case clang::Type::TypeOfExpr:
llvm_unreachable("Handled in RemoveWrappingTypes!");
case clang::Type::UnaryTransform:
@@ -4888,22 +4865,6 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
break;
case clang::Type::Enum:
return lldb::eEncodingSint;
- case clang::Type::TypeOfExpr:
- return CompilerType(this, llvm::cast<clang::TypeOfExprType>(qual_type)
- ->getUnderlyingExpr()
- ->getType()
- .getAsOpaquePtr())
- .GetEncoding(count);
- case clang::Type::TypeOf:
- return CompilerType(this, llvm::cast<clang::TypeOfType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetEncoding(count);
- case clang::Type::Decltype:
- return CompilerType(this, llvm::cast<clang::DecltypeType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetEncoding(count);
case clang::Type::DependentSizedArray:
case clang::Type::DependentSizedExtVector:
case clang::Type::UnresolvedUsing:
@@ -4947,9 +4908,12 @@ lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) {
switch (qual_type->getTypeClass()) {
case clang::Type::Atomic:
case clang::Type::Auto:
+ case clang::Type::Decltype:
case clang::Type::Elaborated:
case clang::Type::Paren:
case clang::Type::Typedef:
+ case clang::Type::TypeOf:
+ case clang::Type::TypeOfExpr:
llvm_unreachable("Handled in RemoveWrappingTypes!");
case clang::Type::UnaryTransform:
break;
@@ -5043,22 +5007,6 @@ lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::Enum:
return lldb::eFormatEnum;
- case clang::Type::TypeOfExpr:
- return CompilerType(this, llvm::cast<clang::TypeOfExprType>(qual_type)
- ->getUnderlyingExpr()
- ->getType()
- .getAsOpaquePtr())
- .GetFormat();
- case clang::Type::TypeOf:
- return CompilerType(this, llvm::cast<clang::TypeOfType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetFormat();
- case clang::Type::Decltype:
- return CompilerType(this, llvm::cast<clang::DecltypeType>(qual_type)
- ->getUnderlyingType()
- .getAsOpaquePtr())
- .GetFormat();
case clang::Type::DependentSizedArray:
case clang::Type::DependentSizedExtVector:
case clang::Type::UnresolvedUsing:
@@ -5930,16 +5878,6 @@ uint32_t ClangASTContext::GetNumPointeeChildren(clang::QualType type) {
return 0; // When we function pointers, they have no children...
case clang::Type::UnresolvedUsing:
return 0;
- case clang::Type::TypeOfExpr:
- return GetNumPointeeChildren(llvm::cast<clang::TypeOfExprType>(qual_type)
- ->getUnderlyingExpr()
- ->getType());
- case clang::Type::TypeOf:
- return GetNumPointeeChildren(
- llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType());
- case clang::Type::Decltype:
- return GetNumPointeeChildren(
- llvm::cast<clang::DecltypeType>(qual_type)->getUnderlyingType());
case clang::Type::Record:
return 0;
case clang::Type::Enum:
OpenPOWER on IntegriCloud