diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/TestDecltypeExpr.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/TestDecltypeExpr.py new file mode 100644 --- /dev/null +++ b/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]) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/decltype/main.cpp new file mode 100644 --- /dev/null +++ b/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)"]) +} + diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -2483,9 +2483,12 @@ type = cast(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(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(qual_type) - ->getUnderlyingExpr() - ->getType() - .getAsOpaquePtr()) - .GetTypeInfo(pointee_or_element_clang_type); - case clang::Type::TypeOf: - return CompilerType(this, llvm::cast(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(qual_type) - ->getUnderlyingExpr() - ->getType() - .getAsOpaquePtr()) - .GetTypeClass(); - case clang::Type::TypeOf: - return CompilerType(this, llvm::cast(qual_type) - ->getUnderlyingType() - .getAsOpaquePtr()) - .GetTypeClass(); - case clang::Type::Decltype: - return CompilerType(this, llvm::cast(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(qual_type) - ->getUnderlyingExpr() - ->getType() - .getAsOpaquePtr()) - .GetEncoding(count); - case clang::Type::TypeOf: - return CompilerType(this, llvm::cast(qual_type) - ->getUnderlyingType() - .getAsOpaquePtr()) - .GetEncoding(count); - case clang::Type::Decltype: - return CompilerType(this, llvm::cast(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(qual_type) - ->getUnderlyingExpr() - ->getType() - .getAsOpaquePtr()) - .GetFormat(); - case clang::Type::TypeOf: - return CompilerType(this, llvm::cast(qual_type) - ->getUnderlyingType() - .getAsOpaquePtr()) - .GetFormat(); - case clang::Type::Decltype: - return CompilerType(this, llvm::cast(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(qual_type) - ->getUnderlyingExpr() - ->getType()); - case clang::Type::TypeOf: - return GetNumPointeeChildren( - llvm::cast(qual_type)->getUnderlyingType()); - case clang::Type::Decltype: - return GetNumPointeeChildren( - llvm::cast(qual_type)->getUnderlyingType()); case clang::Type::Record: return 0; case clang::Type::Enum: