vabridgers updated this revision to Diff 471328.
vabridgers added a comment.

remove commented code from test case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136886

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp


Index: clang/unittests/AST/ASTImporterTest.cpp
===================================================================
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -8075,6 +8075,34 @@
   EXPECT_FALSE(SharedStatePtr->isNewDecl(ToBar));
 }
 
+TEST_P(ASTImporterOptionSpecificTestBase, isSugaredImport) {
+  Decl *FromTU = getTuDecl(
+      R"(
+      typedef __builtin_va_list va_list;
+      void dbgout(char* fmt, ...)
+      {
+        va_list va;
+      } 
+      )",
+      Lang_C99);
+  Decl *ToTU = getToTuDecl(
+      R"(
+      typedef __builtin_va_list va_list;
+      void dbgout(char* fmt, ...);
+      void maindbgout(char* str)
+      {
+        dbgout((char*)str);
+      }
+      )",
+      Lang_C99);
+  auto *FromOther = FirstDeclMatcher<FunctionDecl>().match(
+      FromTU, functionDecl(hasName("dbgout")));
+  ASSERT_TRUE(FromOther);
+
+  auto *ToOther = Import(FromOther, Lang_C99);
+  ASSERT_TRUE(ToOther);
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
                          DefaultTestValuesForRunOptions);
 
Index: clang/lib/AST/ASTImporter.cpp
===================================================================
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -1358,7 +1358,8 @@
   Expected<TypedefNameDecl *> ToDeclOrErr = import(T->getDecl());
   if (!ToDeclOrErr)
     return ToDeclOrErr.takeError();
-  ExpectedType ToUnderlyingTypeOrErr = import(T->desugar());
+  ExpectedType ToUnderlyingTypeOrErr =
+      import(QualType(T, 0).getDesugaredType(T->getDecl()->getASTContext()));
   if (!ToUnderlyingTypeOrErr)
     return ToUnderlyingTypeOrErr.takeError();
 


Index: clang/unittests/AST/ASTImporterTest.cpp
===================================================================
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -8075,6 +8075,34 @@
   EXPECT_FALSE(SharedStatePtr->isNewDecl(ToBar));
 }
 
+TEST_P(ASTImporterOptionSpecificTestBase, isSugaredImport) {
+  Decl *FromTU = getTuDecl(
+      R"(
+      typedef __builtin_va_list va_list;
+      void dbgout(char* fmt, ...)
+      {
+        va_list va;
+      } 
+      )",
+      Lang_C99);
+  Decl *ToTU = getToTuDecl(
+      R"(
+      typedef __builtin_va_list va_list;
+      void dbgout(char* fmt, ...);
+      void maindbgout(char* str)
+      {
+        dbgout((char*)str);
+      }
+      )",
+      Lang_C99);
+  auto *FromOther = FirstDeclMatcher<FunctionDecl>().match(
+      FromTU, functionDecl(hasName("dbgout")));
+  ASSERT_TRUE(FromOther);
+
+  auto *ToOther = Import(FromOther, Lang_C99);
+  ASSERT_TRUE(ToOther);
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
                          DefaultTestValuesForRunOptions);
 
Index: clang/lib/AST/ASTImporter.cpp
===================================================================
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -1358,7 +1358,8 @@
   Expected<TypedefNameDecl *> ToDeclOrErr = import(T->getDecl());
   if (!ToDeclOrErr)
     return ToDeclOrErr.takeError();
-  ExpectedType ToUnderlyingTypeOrErr = import(T->desugar());
+  ExpectedType ToUnderlyingTypeOrErr =
+      import(QualType(T, 0).getDesugaredType(T->getDecl()->getASTContext()));
   if (!ToUnderlyingTypeOrErr)
     return ToUnderlyingTypeOrErr.takeError();
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to