[Lldb-commits] [PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Qiu Chaofan via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG00c0ce0655da: [NFC] [Clang] Remove pre-computed complex 
float types (authored by qiucf).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111387/new/

https://reviews.llvm.org/D111387

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -60,11 +60,11 @@
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDouble),
   context.DoubleTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDoubleComplex),
-  context.DoubleComplexTy));
+  context.getComplexType(context.DoubleTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeFloat), context.FloatTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeFloatComplex),
-  context.FloatComplexTy));
+  context.getComplexType(context.FloatTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeHalf), context.HalfTy));
   EXPECT_TRUE(
@@ -75,8 +75,9 @@
   context.hasSameType(GetBasicQualType(eBasicTypeLong), context.LongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDouble),
   context.LongDoubleTy));
-  EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
-  context.LongDoubleComplexTy));
+  EXPECT_TRUE(
+  context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
+  context.getComplexType(context.LongDoubleTy)));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongLong),
   context.LongLongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeNullPtr),
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -981,21 +981,25 @@
 }
 break;
 
-  case DW_ATE_complex_float:
-if (QualTypeMatchesBitSize(bit_size, ast, ast.FloatComplexTy))
-  return GetType(ast.FloatComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.DoubleComplexTy))
-  return GetType(ast.DoubleComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.LongDoubleComplexTy))
-  return GetType(ast.LongDoubleComplexTy);
-else {
-  CompilerType complex_float_clang_type =
-  GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
-   bit_size / 2);
-  return GetType(
-  ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
-}
-break;
+  case DW_ATE_complex_float: {
+CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
+if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy))
+  return GetType(FloatComplexTy);
+
+CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, DoubleComplexTy))
+  return GetType(DoubleComplexTy);
+
+CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, LongDoubleComplexTy))
+  return GetType(LongDoubleComplexTy);
+
+CompilerType complex_float_clang_type =
+GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
+ bit_size / 2);
+return GetType(
+ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
+  }
 
   case DW_ATE_float:
 if (type_name == "float" &&
@@ -2051,11 +2055,11 @@
   case eBasicTypeLongDouble:
 return ast->LongDoubleTy.getAsOpaquePtr();
   case eBasicTypeFloatComplex:
-return ast->FloatComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->FloatTy).getAsOpaquePtr();
   case eBasicTypeDoubleComplex:
-return ast->DoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->DoubleTy).getAsOpaquePtr();
   case eBasicTypeLongDoubleComplex:
-return ast->LongDoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->LongDoubleTy).getAsOpaquePtr();
   case eBasicTypeObjCID:
 return ast->getObjCIdType().getAsOpaquePtr();
   case eBasicTypeObjCClass:
Index: clang/lib/AST/ASTContext.cpp

[Lldb-commits] [PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: JDevlieghere.

Would be nice to have the motivation for this in the commit message (IIUC this 
is based on the suggestion from D109948  ). 
Patch itself LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111387/new/

https://reviews.llvm.org/D111387

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Qiu Chaofan via Phabricator via lldb-commits
qiucf created this revision.
qiucf added reviewers: rjmccall, teemperor.
qiucf requested review of this revision.
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111387

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -60,11 +60,11 @@
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDouble),
   context.DoubleTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDoubleComplex),
-  context.DoubleComplexTy));
+  context.getComplexType(context.DoubleTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeFloat), context.FloatTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeFloatComplex),
-  context.FloatComplexTy));
+  context.getComplexType(context.FloatTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeHalf), context.HalfTy));
   EXPECT_TRUE(
@@ -75,8 +75,9 @@
   context.hasSameType(GetBasicQualType(eBasicTypeLong), context.LongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDouble),
   context.LongDoubleTy));
-  EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
-  context.LongDoubleComplexTy));
+  EXPECT_TRUE(
+  context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
+  context.getComplexType(context.LongDoubleTy)));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongLong),
   context.LongLongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeNullPtr),
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -981,21 +981,25 @@
 }
 break;
 
-  case DW_ATE_complex_float:
-if (QualTypeMatchesBitSize(bit_size, ast, ast.FloatComplexTy))
-  return GetType(ast.FloatComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.DoubleComplexTy))
-  return GetType(ast.DoubleComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.LongDoubleComplexTy))
-  return GetType(ast.LongDoubleComplexTy);
-else {
-  CompilerType complex_float_clang_type =
-  GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
-   bit_size / 2);
-  return GetType(
-  ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
-}
-break;
+  case DW_ATE_complex_float: {
+CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
+if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy))
+  return GetType(FloatComplexTy);
+
+CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, DoubleComplexTy))
+  return GetType(DoubleComplexTy);
+
+CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, LongDoubleComplexTy))
+  return GetType(LongDoubleComplexTy);
+
+CompilerType complex_float_clang_type =
+GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
+ bit_size / 2);
+return GetType(
+ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
+  }
 
   case DW_ATE_float:
 if (type_name == "float" &&
@@ -2051,11 +2055,11 @@
   case eBasicTypeLongDouble:
 return ast->LongDoubleTy.getAsOpaquePtr();
   case eBasicTypeFloatComplex:
-return ast->FloatComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->FloatTy).getAsOpaquePtr();
   case eBasicTypeDoubleComplex:
-return ast->DoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->DoubleTy).getAsOpaquePtr();
   case eBasicTypeLongDoubleComplex:
-return ast->LongDoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->LongDoubleTy).getAsOpaquePtr();
   case eBasicTypeObjCID:
 return ast->getObjCIdType().getAsOpaquePtr();
   case eBasicTypeObjCClass:
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1411,12 +1411,6