JDevlieghere updated this revision to Diff 134955.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

Make sure the lit test actually checks the lldb output instead of the # CHECK 
lines.

Without the check-next, CHECK matches the # CHECK lines, as they are printed by 
lldb:

  (lldb) # RUN: %lldb -b -s %s | FileCheck %s
  (lldb) expression int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 = 1
  (lldb) # CHECK: (lldb) expression int i; __typeof__(i) j = 1; j
  (lldb) # CHECK-NEXT: (typeof (i)) $0 = 1
  (lldb) expression int i; typeof(i) j = 1; j
  (typeof (i)) $1 = 1
  (lldb) # CHECK: (lldb) expression int i; typeof(i) j = 1; j
  (lldb) # CHECK-NEXT: (typeof (i)) $1 = 1
  (lldb) expression int i; decltype(i) j = 1; j
  (decltype(i)) $2 = 1
  (lldb) # CHECK: (lldb) expression int i; decltype(i) j = 1; j
  (lldb) # CHECK-NEXT: (decltype(i)) $2 = 1


https://reviews.llvm.org/D43471

Files:
  lit/Expr/TestTypeOfDeclTypeExpr.test
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -3964,7 +3964,10 @@
   case clang::Type::DependentTemplateSpecialization:
     return eTypeIsTemplate;
   case clang::Type::Decltype:
-    return 0;
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::DecltypeType>(qual_type)->getUnderlyingType())
+        .GetTypeInfo(pointee_or_element_clang_type);
 
   case clang::Type::Enum:
     if (pointee_or_element_clang_type)
@@ -4046,9 +4049,16 @@
                             ->getUnderlyingType())
                .GetTypeInfo(pointee_or_element_clang_type);
   case clang::Type::TypeOfExpr:
-    return 0;
+    return CompilerType(getASTContext(),
+                        llvm::cast<clang::TypeOfExprType>(qual_type)
+                            ->getUnderlyingExpr()
+                            ->getType())
+        .GetTypeInfo(pointee_or_element_clang_type);
   case clang::Type::TypeOf:
-    return 0;
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType())
+        .GetTypeInfo(pointee_or_element_clang_type);
   case clang::Type::UnresolvedUsing:
     return 0;
 
@@ -4255,11 +4265,21 @@
     break;
 
   case clang::Type::TypeOfExpr:
-    break;
+    return CompilerType(getASTContext(),
+                        llvm::cast<clang::TypeOfExprType>(qual_type)
+                            ->getUnderlyingExpr()
+                            ->getType())
+        .GetTypeClass();
   case clang::Type::TypeOf:
-    break;
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType())
+        .GetTypeClass();
   case clang::Type::Decltype:
-    break;
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType())
+        .GetTypeClass();
   case clang::Type::TemplateSpecialization:
     break;
   case clang::Type::DeducedTemplateSpecialization:
@@ -5060,7 +5080,22 @@
     return CompilerType(getASTContext(),
                         llvm::cast<clang::ParenType>(qual_type)->desugar())
         .GetEncoding(count);
-
+  case clang::Type::TypeOfExpr:
+    return CompilerType(getASTContext(),
+                        llvm::cast<clang::TypeOfExprType>(qual_type)
+                            ->getUnderlyingExpr()
+                            ->getType())
+        .GetEncoding(count);
+  case clang::Type::TypeOf:
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType())
+        .GetEncoding(count);
+  case clang::Type::Decltype:
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::DecltypeType>(qual_type)->getUnderlyingType())
+        .GetEncoding(count);
   case clang::Type::DependentSizedArray:
   case clang::Type::DependentSizedExtVector:
   case clang::Type::UnresolvedUsing:
@@ -5074,9 +5109,6 @@
   case clang::Type::PackExpansion:
   case clang::Type::ObjCObject:
 
-  case clang::Type::TypeOfExpr:
-  case clang::Type::TypeOf:
-  case clang::Type::Decltype:
   case clang::Type::TemplateSpecialization:
   case clang::Type::DeducedTemplateSpecialization:
   case clang::Type::Atomic:
@@ -5214,6 +5246,22 @@
                getASTContext(),
                llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType())
         .GetFormat();
+  case clang::Type::TypeOfExpr:
+    return CompilerType(getASTContext(),
+                        llvm::cast<clang::TypeOfExprType>(qual_type)
+                            ->getUnderlyingExpr()
+                            ->getType())
+        .GetFormat();
+  case clang::Type::TypeOf:
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType())
+        .GetFormat();
+  case clang::Type::Decltype:
+    return CompilerType(
+               getASTContext(),
+               llvm::cast<clang::DecltypeType>(qual_type)->getUnderlyingType())
+        .GetFormat();
   case clang::Type::DependentSizedArray:
   case clang::Type::DependentSizedExtVector:
   case clang::Type::UnresolvedUsing:
@@ -5227,9 +5275,6 @@
   case clang::Type::PackExpansion:
   case clang::Type::ObjCObject:
 
-  case clang::Type::TypeOfExpr:
-  case clang::Type::TypeOf:
-  case clang::Type::Decltype:
   case clang::Type::TemplateSpecialization:
   case clang::Type::DeducedTemplateSpecialization:
   case clang::Type::Atomic:
@@ -6264,11 +6309,15 @@
     return GetNumPointeeChildren(
         llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType());
   case clang::Type::TypeOfExpr:
-    return 0;
+    return GetNumPointeeChildren(llvm::cast<clang::TypeOfExprType>(qual_type)
+                                     ->getUnderlyingExpr()
+                                     ->getType());
   case clang::Type::TypeOf:
-    return 0;
+    return GetNumPointeeChildren(
+        llvm::cast<clang::TypeOfType>(qual_type)->getUnderlyingType());
   case clang::Type::Decltype:
-    return 0;
+    return GetNumPointeeChildren(
+        llvm::cast<clang::DecltypeType>(qual_type)->getUnderlyingType());
   case clang::Type::Record:
     return 0;
   case clang::Type::Enum:
@@ -10086,4 +10135,3 @@
   lldbassert(m_scratch_ast_source_ap != nullptr);
   return m_scratch_ast_source_ap->GetMergerUnchecked();
 }
-
Index: lit/Expr/TestTypeOfDeclTypeExpr.test
===================================================================
--- /dev/null
+++ lit/Expr/TestTypeOfDeclTypeExpr.test
@@ -0,0 +1,13 @@
+# RUN: %lldb -b -s %s | FileCheck %s
+
+expression int i; __typeof__(i) j = 1; j
+# CHECK: (lldb) expression int i; __typeof__(i) j = 1; j
+# CHECK-NEXT: (typeof (i)) $0 = 1
+
+expression int i; typeof(i) j = 1; j
+# CHECK: (lldb) expression int i; typeof(i) j = 1; j
+# CHECK-NEXT: (typeof (i)) $1 = 1
+
+expression int i; decltype(i) j = 1; j
+# CHECK: (lldb) expression int i; decltype(i) j = 1; j
+# CHECK-NEXT: (decltype(i)) $2 = 1
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to