labath created this revision. labath added reviewers: teemperor, shafik. Herald added a project: LLDB.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D71405 Files: lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/TestDecltypeExpr.py lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/main.cpp lldb/source/Symbol/ClangASTContext.cpp
Index: lldb/source/Symbol/ClangASTContext.cpp =================================================================== --- lldb/source/Symbol/ClangASTContext.cpp +++ lldb/source/Symbol/ClangASTContext.cpp @@ -2483,9 +2483,12 @@ 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: @@ -3749,11 +3752,6 @@ 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) @@ -3821,17 +3819,6 @@ ->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; @@ -3950,8 +3937,11 @@ 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; @@ -4033,22 +4023,6 @@ 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: @@ -4662,9 +4636,12 @@ 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: @@ -4872,22 +4849,6 @@ 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: @@ -4931,9 +4892,12 @@ 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; @@ -5027,22 +4991,6 @@ 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: @@ -5914,16 +5862,6 @@ 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: Index: lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/main.cpp =================================================================== --- /dev/null +++ lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/main.cpp @@ -0,0 +1,5 @@ +int main() { + return 0; //% self.expect("expression -- struct A { int x; }; decltype(A()) var{47}; var", + //% substrs=["(decltype(A())) $0 = (x = 47)"]) +} + Index: lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/TestDecltypeExpr.py =================================================================== --- /dev/null +++ lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/TestDecltypeExpr.py @@ -0,0 +1,5 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test.decorators import * + +lldbinline.MakeInlineTest(__file__, globals(), + [expectedFailureAll(oslist=["windows"]), no_debug_info_test])
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits