[Lldb-commits] [lldb] r256051 - Add support for seeing through clang::AutoType in ClangASTContext

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 18 14:41:26 PST 2015


Author: enrico
Date: Fri Dec 18 16:41:25 2015
New Revision: 256051

URL: http://llvm.org/viewvc/llvm-project?rev=256051&view=rev
Log:
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


Added:
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
Modified:
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile?rev=256051&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile Fri Dec 18 16:41:25 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py?rev=256051&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py Fri Dec 18 16:41:25 2015
@@ -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'])

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp?rev=256051&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp Fri Dec 18 16:41:25 2015
@@ -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
+}

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=256051&r1=256050&r2=256051&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Dec 18 16:41:25 2015
@@ -2584,6 +2584,7 @@ ClangASTContext::GetDeclContextForType (
         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 *
         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::
         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::
             }
             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::opaq
                                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::o
                 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
             
         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 (
                 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::op
                 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::IsPointerOrReferenceTyp
                 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::
                 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 (
                                               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::opaq
             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::opa
         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::opa
         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 (
                 
             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::GetMemberFunctionAtInde
                 
             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::opaq
         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::opaq
         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::o
         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::opa
         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::
                              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
             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::GetNumVirtualBaseClasse
             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::GetDirectBaseClassAtInd
         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::GetVirtualBaseClassAtIn
 
         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 (
         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::GetChildCompilerTypeAtI
         }
             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::GetIndexOfChildMemberWi
                 
             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
                 }
             }
                 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
             
         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 (ll
             
         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 (
         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 (
             
         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 Compil
             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 CompilerT
             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
         }
             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 (ll
                 }
             }
                 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 Com
                 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()));




More information about the lldb-commits mailing list