Add support for seeing through clang::AutoType in ClangASTContext

This allows LLDB to deal correctly with expression result variables declared via the C++11 'auto' keyword

rdar://problem/23960490

llvm-svn: 256051
This commit is contained in:
Enrico Granata 2015-12-18 22:41:25 +00:00
parent be2cfb26d3
commit 36f51e4c97
4 changed files with 205 additions and 10 deletions

View File

@ -0,0 +1,5 @@
LEVEL = ../../../make
CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules

View File

@ -0,0 +1,24 @@
"""
Tests that auto types work
"""
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class CPPAutoTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_with_run_command(self):
"""Test that auto types work in the expression parser"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.cpp', '// break here')
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect('expr auto f = 123456; f', substrs=['int', '123456'])
self.expect('expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t', substrs=['Test', '123', '456'])
self.expect('expr auto s = helloworld; s', substrs=['string', 'hello world'])

View File

@ -0,0 +1,16 @@
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <string>
int main()
{
std::string helloworld("hello world");
return 0; // break here
}

View File

@ -2584,6 +2584,7 @@ ClangASTContext::GetDeclContextForType (clang::QualType type)
case clang::Type::Record: return llvm::cast<clang::RecordType>(qual_type)->getDecl();
case clang::Type::Enum: return llvm::cast<clang::EnumType>(qual_type)->getDecl();
case clang::Type::Typedef: return GetDeclContextForType (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType());
case clang::Type::Auto: return GetDeclContextForType (llvm::cast<clang::AutoType>(qual_type)->getDeducedType());
case clang::Type::Elaborated: return GetDeclContextForType (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType());
case clang::Type::Paren: return GetDeclContextForType (llvm::cast<clang::ParenType>(qual_type)->desugar());
default:
@ -2713,6 +2714,9 @@ GetCompleteQualType (clang::ASTContext *ast, clang::QualType qual_type, bool all
case clang::Type::Typedef:
return GetCompleteQualType (ast, llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType(), allow_completion);
case clang::Type::Auto:
return GetCompleteQualType (ast, llvm::cast<clang::AutoType>(qual_type)->getDeducedType(), allow_completion);
case clang::Type::Elaborated:
return GetCompleteQualType (ast, llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType(), allow_completion);
@ -2765,6 +2769,8 @@ ClangASTContext::IsAggregateType (lldb::opaque_compiler_type_t type)
case clang::Type::ObjCObject:
case clang::Type::ObjCInterface:
return true;
case clang::Type::Auto:
return IsAggregateType(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr());
case clang::Type::Elaborated:
return IsAggregateType(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
case clang::Type::Typedef:
@ -2797,6 +2803,8 @@ ClangASTContext::IsAnonymousType (lldb::opaque_compiler_type_t type)
}
break;
}
case clang::Type::Auto:
return IsAnonymousType(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr());
case clang::Type::Elaborated:
return IsAnonymousType(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
case clang::Type::Typedef:
@ -2865,6 +2873,11 @@ ClangASTContext::IsArrayType (lldb::opaque_compiler_type_t type,
element_type_ptr,
size,
is_incomplete);
case clang::Type::Auto:
return IsArrayType(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(),
element_type_ptr,
size,
is_incomplete);
case clang::Type::Elaborated:
return IsArrayType(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
element_type_ptr,
@ -3018,6 +3031,8 @@ ClangASTContext::IsFunctionType (lldb::opaque_compiler_type_t type, bool *is_var
break;
case clang::Type::Typedef:
return IsFunctionType(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), nullptr);
case clang::Type::Auto:
return IsFunctionType(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), nullptr);
case clang::Type::Elaborated:
return IsFunctionType(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), nullptr);
case clang::Type::Paren:
@ -3122,6 +3137,9 @@ ClangASTContext::IsHomogeneousAggregate (lldb::opaque_compiler_type_t type, Comp
case clang::Type::Typedef:
return IsHomogeneousAggregate(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), base_type_ptr);
case clang::Type::Auto:
return IsHomogeneousAggregate(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), base_type_ptr);
case clang::Type::Elaborated:
return IsHomogeneousAggregate(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), base_type_ptr);
@ -3177,6 +3195,8 @@ ClangASTContext::IsFunctionPointerType (lldb::opaque_compiler_type_t type)
break;
case clang::Type::Typedef:
return IsFunctionPointerType (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
case clang::Type::Auto:
return IsFunctionPointerType (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr());
case clang::Type::Elaborated:
return IsFunctionPointerType (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
case clang::Type::Paren:
@ -3254,6 +3274,8 @@ ClangASTContext::IsPointerType (lldb::opaque_compiler_type_t type, CompilerType
return true;
case clang::Type::Typedef:
return IsPointerType (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), pointee_type);
case clang::Type::Auto:
return IsPointerType (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), pointee_type);
case clang::Type::Elaborated:
return IsPointerType (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), pointee_type);
case clang::Type::Paren:
@ -3313,6 +3335,8 @@ ClangASTContext::IsPointerOrReferenceType (lldb::opaque_compiler_type_t type, Co
return true;
case clang::Type::Typedef:
return IsPointerOrReferenceType(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), pointee_type);
case clang::Type::Auto:
return IsPointerOrReferenceType(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), pointee_type);
case clang::Type::Elaborated:
return IsPointerOrReferenceType(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), pointee_type);
case clang::Type::Paren:
@ -3351,6 +3375,8 @@ ClangASTContext::IsReferenceType (lldb::opaque_compiler_type_t type, CompilerTyp
return true;
case clang::Type::Typedef:
return IsReferenceType (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), pointee_type, is_rvalue);
case clang::Type::Auto:
return IsReferenceType (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), pointee_type, is_rvalue);
case clang::Type::Elaborated:
return IsReferenceType (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), pointee_type, is_rvalue);
case clang::Type::Paren:
@ -3536,6 +3562,12 @@ ClangASTContext::IsPossibleDynamicType (lldb::opaque_compiler_type_t type, Compi
dynamic_pointee_type,
check_cplusplus,
check_objc);
case clang::Type::Auto:
return IsPossibleDynamicType (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(),
dynamic_pointee_type,
check_cplusplus,
check_objc);
case clang::Type::Elaborated:
return IsPossibleDynamicType (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
@ -3903,7 +3935,9 @@ ClangASTContext::GetTypeInfo (lldb::opaque_compiler_type_t type, CompilerType *p
if (pointee_or_element_clang_type)
pointee_or_element_clang_type->SetCompilerType(getASTContext(), llvm::cast<clang::EnumType>(qual_type)->getDecl()->getIntegerType());
return eTypeIsEnumeration | eTypeHasValue;
case clang::Type::Auto:
return CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetTypeInfo (pointee_or_element_clang_type);
case clang::Type::Elaborated:
return CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetTypeInfo (pointee_or_element_clang_type);
case clang::Type::Paren:
@ -4106,6 +4140,8 @@ ClangASTContext::GetTypeClass (lldb::opaque_compiler_type_t type)
case clang::Type::UnresolvedUsing: break;
case clang::Type::Paren:
return CompilerType(getASTContext(), llvm::cast<clang::ParenType>(qual_type)->desugar()).GetTypeClass();
case clang::Type::Auto:
return CompilerType(getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetTypeClass();
case clang::Type::Elaborated:
return CompilerType(getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetTypeClass();
@ -4113,7 +4149,6 @@ ClangASTContext::GetTypeClass (lldb::opaque_compiler_type_t type)
case clang::Type::TemplateTypeParm: break;
case clang::Type::SubstTemplateTypeParm: break;
case clang::Type::SubstTemplateTypeParmPack:break;
case clang::Type::Auto: break;
case clang::Type::InjectedClassName: break;
case clang::Type::DependentName: break;
case clang::Type::DependentTemplateSpecialization: break;
@ -4291,6 +4326,9 @@ ClangASTContext::GetNumMemberFunctions (lldb::opaque_compiler_type_t type)
case clang::Type::Typedef:
return CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType()).GetNumMemberFunctions();
case clang::Type::Auto:
return CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetNumMemberFunctions();
case clang::Type::Elaborated:
return CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetNumMemberFunctions();
@ -4413,6 +4451,9 @@ ClangASTContext::GetMemberFunctionAtIndex (lldb::opaque_compiler_type_t type, si
case clang::Type::Typedef:
return GetMemberFunctionAtIndex(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), idx);
case clang::Type::Auto:
return GetMemberFunctionAtIndex(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), idx);
case clang::Type::Elaborated:
return GetMemberFunctionAtIndex(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), idx);
@ -4822,6 +4863,9 @@ ClangASTContext::GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count
case clang::Type::Enum: return lldb::eEncodingSint;
case clang::Type::Typedef:
return CompilerType(getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType()).GetEncoding(count);
case clang::Type::Auto:
return CompilerType(getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetEncoding(count);
case clang::Type::Elaborated:
return CompilerType(getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetEncoding(count);
@ -4836,7 +4880,6 @@ ClangASTContext::GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count
case clang::Type::TemplateTypeParm:
case clang::Type::SubstTemplateTypeParm:
case clang::Type::SubstTemplateTypeParmPack:
case clang::Type::Auto:
case clang::Type::InjectedClassName:
case clang::Type::DependentName:
case clang::Type::DependentTemplateSpecialization:
@ -5147,6 +5190,10 @@ ClangASTContext::GetNumChildren (lldb::opaque_compiler_type_t type, bool omit_em
case clang::Type::Typedef:
num_children = CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType()).GetNumChildren (omit_empty_base_classes);
break;
case clang::Type::Auto:
num_children = CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetNumChildren (omit_empty_base_classes);
break;
case clang::Type::Elaborated:
num_children = CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetNumChildren (omit_empty_base_classes);
@ -5274,6 +5321,10 @@ ClangASTContext::GetNumFields (lldb::opaque_compiler_type_t type)
case clang::Type::Typedef:
count = CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType()).GetNumFields();
break;
case clang::Type::Auto:
count = CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetNumFields();
break;
case clang::Type::Elaborated:
count = CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetNumFields();
@ -5474,6 +5525,14 @@ ClangASTContext::GetFieldAtIndex (lldb::opaque_compiler_type_t type, size_t idx,
bitfield_bit_size_ptr,
is_bitfield_ptr);
case clang::Type::Auto:
return CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).
GetFieldAtIndex (idx,
name,
bit_offset_ptr,
bitfield_bit_size_ptr,
is_bitfield_ptr);
case clang::Type::Elaborated:
return CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).
GetFieldAtIndex (idx,
@ -5549,6 +5608,10 @@ ClangASTContext::GetNumDirectBaseClasses (lldb::opaque_compiler_type_t type)
count = GetNumDirectBaseClasses(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
break;
case clang::Type::Auto:
count = GetNumDirectBaseClasses(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr());
break;
case clang::Type::Elaborated:
count = GetNumDirectBaseClasses(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
break;
@ -5584,6 +5647,10 @@ ClangASTContext::GetNumVirtualBaseClasses (lldb::opaque_compiler_type_t type)
count = GetNumVirtualBaseClasses(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
break;
case clang::Type::Auto:
count = GetNumVirtualBaseClasses(llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr());
break;
case clang::Type::Elaborated:
count = GetNumVirtualBaseClasses(llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
break;
@ -5686,6 +5753,9 @@ ClangASTContext::GetDirectBaseClassAtIndex (lldb::opaque_compiler_type_t type, s
case clang::Type::Typedef:
return GetDirectBaseClassAtIndex (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), idx, bit_offset_ptr);
case clang::Type::Auto:
return GetDirectBaseClassAtIndex (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), idx, bit_offset_ptr);
case clang::Type::Elaborated:
return GetDirectBaseClassAtIndex (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), idx, bit_offset_ptr);
@ -5737,7 +5807,10 @@ ClangASTContext::GetVirtualBaseClassAtIndex (lldb::opaque_compiler_type_t type,
case clang::Type::Typedef:
return GetVirtualBaseClassAtIndex (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), idx, bit_offset_ptr);
case clang::Type::Auto:
return GetVirtualBaseClassAtIndex (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), idx, bit_offset_ptr);
case clang::Type::Elaborated:
return GetVirtualBaseClassAtIndex (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), idx, bit_offset_ptr);
@ -5838,6 +5911,7 @@ ClangASTContext::GetNumPointeeChildren (clang::QualType type)
case clang::Type::UnresolvedUsing: return 0;
case clang::Type::Paren: return GetNumPointeeChildren (llvm::cast<clang::ParenType>(qual_type)->desugar());
case clang::Type::Typedef: return GetNumPointeeChildren (llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType());
case clang::Type::Auto: return GetNumPointeeChildren (llvm::cast<clang::AutoType>(qual_type)->getDeducedType());
case clang::Type::Elaborated: return GetNumPointeeChildren (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType());
case clang::Type::TypeOfExpr: return 0;
case clang::Type::TypeOf: return 0;
@ -6378,6 +6452,25 @@ ClangASTContext::GetChildCompilerTypeAtIndex (lldb::opaque_compiler_type_t type,
}
break;
case clang::Type::Auto:
{
CompilerType elaborated_clang_type (getASTContext(), llvm::cast<clang::AutoType>(parent_qual_type)->getDeducedType());
return elaborated_clang_type.GetChildCompilerTypeAtIndex (exe_ctx,
idx,
transparent_pointers,
omit_empty_base_classes,
ignore_array_bounds,
child_name,
child_byte_size,
child_byte_offset,
child_bitfield_bit_size,
child_bitfield_bit_offset,
child_is_base_class,
child_is_deref_of_parent,
valobj,
language_flags);
}
case clang::Type::Elaborated:
{
CompilerType elaborated_clang_type (getASTContext(), llvm::cast<clang::ElaboratedType>(parent_qual_type)->getNamedType());
@ -6761,18 +6854,23 @@ ClangASTContext::GetIndexOfChildMemberWithName (lldb::opaque_compiler_type_t typ
case clang::Type::Typedef:
return CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType()).GetIndexOfChildMemberWithName (name,
omit_empty_base_classes,
child_indexes);
omit_empty_base_classes,
child_indexes);
case clang::Type::Auto:
return CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetIndexOfChildMemberWithName (name,
omit_empty_base_classes,
child_indexes);
case clang::Type::Elaborated:
return CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetIndexOfChildMemberWithName (name,
omit_empty_base_classes,
child_indexes);
omit_empty_base_classes,
child_indexes);
case clang::Type::Paren:
return CompilerType (getASTContext(), llvm::cast<clang::ParenType>(qual_type)->desugar()).GetIndexOfChildMemberWithName (name,
omit_empty_base_classes,
child_indexes);
omit_empty_base_classes,
child_indexes);
default:
break;
@ -6967,6 +7065,9 @@ ClangASTContext::GetIndexOfChildWithName (lldb::opaque_compiler_type_t type, con
}
}
break;
case clang::Type::Auto:
return CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).GetIndexOfChildWithName (name, omit_empty_base_classes);
case clang::Type::Elaborated:
return CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).GetIndexOfChildWithName (name, omit_empty_base_classes);
@ -7010,6 +7111,9 @@ ClangASTContext::GetNumTemplateArguments (lldb::opaque_compiler_type_t type)
case clang::Type::Typedef:
return (CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType())).GetNumTemplateArguments();
case clang::Type::Auto:
return (CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType())).GetNumTemplateArguments();
case clang::Type::Elaborated:
return (CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType())).GetNumTemplateArguments();
@ -7089,6 +7193,9 @@ ClangASTContext::GetTemplateArgument (lldb::opaque_compiler_type_t type, size_t
case clang::Type::Typedef:
return (CompilerType (getASTContext(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType())).GetTemplateArgument(arg_idx, kind);
case clang::Type::Auto:
return (CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType())).GetTemplateArgument(arg_idx, kind);
case clang::Type::Elaborated:
return (CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType())).GetTemplateArgument(arg_idx, kind);
@ -8276,6 +8383,9 @@ ClangASTContext::GetHasExternalStorage (const CompilerType &type)
case clang::Type::Typedef:
return GetHasExternalStorage (CompilerType(type.GetTypeSystem(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr()));
case clang::Type::Auto:
return GetHasExternalStorage (CompilerType(type.GetTypeSystem(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr()));
case clang::Type::Elaborated:
return GetHasExternalStorage (CompilerType(type.GetTypeSystem(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr()));
@ -8345,6 +8455,9 @@ ClangASTContext::SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool
case clang::Type::Typedef:
return SetHasExternalStorage(llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), has_extern);
case clang::Type::Auto:
return SetHasExternalStorage (llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr(), has_extern);
case clang::Type::Elaborated:
return SetHasExternalStorage (llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), has_extern);
@ -8416,6 +8529,9 @@ ClangASTContext::CanImport (const CompilerType &type, lldb_private::ClangASTImpo
case clang::Type::Typedef:
return CanImport(CompilerType (type.GetTypeSystem(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr()), importer);
case clang::Type::Auto:
return CanImport(CompilerType (type.GetTypeSystem(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr()), importer);
case clang::Type::Elaborated:
return CanImport(CompilerType (type.GetTypeSystem(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr()), importer);
@ -8485,6 +8601,9 @@ ClangASTContext::Import (const CompilerType &type, lldb_private::ClangASTImporte
case clang::Type::Typedef:
return Import (CompilerType(type.GetTypeSystem(), llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr()), importer);
case clang::Type::Auto:
return Import (CompilerType(type.GetTypeSystem(),llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr()), importer);
case clang::Type::Elaborated:
return Import (CompilerType(type.GetTypeSystem(),llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr()), importer);
@ -8982,6 +9101,29 @@ ClangASTContext::DumpValue (lldb::opaque_compiler_type_t type, ExecutionContext
}
break;
case clang::Type::Auto:
{
clang::QualType elaborated_qual_type = llvm::cast<clang::AutoType>(qual_type)->getDeducedType();
CompilerType elaborated_clang_type (getASTContext(), elaborated_qual_type);
lldb::Format elaborated_format = elaborated_clang_type.GetFormat();
clang::TypeInfo elaborated_type_info = getASTContext()->getTypeInfo(elaborated_qual_type);
uint64_t elaborated_byte_size = elaborated_type_info.Width / 8;
return elaborated_clang_type.DumpValue (exe_ctx,
s, // Stream to dump to
elaborated_format, // The format with which to display the element
data, // Data buffer containing all bytes for this type
data_byte_offset, // Offset into "data" where to grab value from
elaborated_byte_size, // Size of this type in bytes
bitfield_bit_size, // Bitfield bit size
bitfield_bit_offset,// Bitfield bit offset
show_types, // Boolean indicating if we should show the variable types
show_summary, // Boolean indicating if we should show a summary for the current type
verbose, // Verbose output?
depth); // Scope depth for any types that have children
}
break;
case clang::Type::Elaborated:
{
clang::QualType elaborated_qual_type = llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType();
@ -9319,6 +9461,10 @@ ClangASTContext::DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream
}
}
break;
case clang::Type::Auto:
CompilerType (getASTContext(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType()).DumpTypeDescription(s);
return;
case clang::Type::Elaborated:
CompilerType (getASTContext(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()).DumpTypeDescription(s);
@ -9416,6 +9562,10 @@ ClangASTContext::DumpTypeName (const CompilerType &type)
printf("typedef %s", llvm::cast<clang::TypedefType>(qual_type)->getDecl()->getName().str().c_str());
break;
case clang::Type::Auto:
printf("auto ");
return DumpTypeName (CompilerType (type.GetTypeSystem(), llvm::cast<clang::AutoType>(qual_type)->getDeducedType().getAsOpaquePtr()));
case clang::Type::Elaborated:
printf("elaborated ");
return DumpTypeName (CompilerType (type.GetTypeSystem(), llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr()));