|
@@ -989,7 +989,7 @@ TEST_P(ASTImporterTestBase, ImportRecordTypeInFunc) {
|
|
" return 0;"
|
|
" return 0;"
|
|
"}",
|
|
"}",
|
|
Lang_C, "input.c");
|
|
Lang_C, "input.c");
|
|
- auto FromVar =
|
|
|
|
|
|
+ auto *FromVar =
|
|
FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("d")));
|
|
FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("d")));
|
|
ASSERT_TRUE(FromVar);
|
|
ASSERT_TRUE(FromVar);
|
|
auto ToType =
|
|
auto ToType =
|
|
@@ -999,12 +999,41 @@ TEST_P(ASTImporterTestBase, ImportRecordTypeInFunc) {
|
|
|
|
|
|
TEST_P(ASTImporterTestBase, ImportRecordDeclInFuncParams) {
|
|
TEST_P(ASTImporterTestBase, ImportRecordDeclInFuncParams) {
|
|
// This construct is not supported by ASTImporter.
|
|
// This construct is not supported by ASTImporter.
|
|
- Decl *FromTU =
|
|
|
|
- getTuDecl("int declToImport(struct data_t{int a;int b;} *d){ return 0; }",
|
|
|
|
- Lang_C, "input.c");
|
|
|
|
- auto From = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
|
|
|
|
|
|
+ Decl *FromTU = getTuDecl(
|
|
|
|
+ "int declToImport(struct data_t{int a;int b;} ***d){ return 0; }",
|
|
|
|
+ Lang_C, "input.c");
|
|
|
|
+ auto *From = FirstDeclMatcher<FunctionDecl>().match(
|
|
|
|
+ FromTU, functionDecl(hasName("declToImport")));
|
|
|
|
+ ASSERT_TRUE(From);
|
|
|
|
+ auto *To = Import(From, Lang_C);
|
|
|
|
+ EXPECT_EQ(To, nullptr);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_P(ASTImporterTestBase, ImportRecordDeclInFuncFromMacro) {
|
|
|
|
+ Decl *FromTU = getTuDecl(
|
|
|
|
+ "#define NONAME_SIZEOF(type) sizeof(struct{type *dummy;}) \n"
|
|
|
|
+ "int declToImport(){ return NONAME_SIZEOF(int); }",
|
|
|
|
+ Lang_C, "input.c");
|
|
|
|
+ auto *From = FirstDeclMatcher<FunctionDecl>().match(
|
|
|
|
+ FromTU, functionDecl(hasName("declToImport")));
|
|
|
|
+ ASSERT_TRUE(From);
|
|
|
|
+ auto *To = Import(From, Lang_C);
|
|
|
|
+ ASSERT_TRUE(To);
|
|
|
|
+ EXPECT_TRUE(MatchVerifier<FunctionDecl>().match(
|
|
|
|
+ To, functionDecl(hasName("declToImport"),
|
|
|
|
+ hasDescendant(unaryExprOrTypeTraitExpr()))));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TEST_P(ASTImporterTestBase, ImportRecordDeclInFuncParamsFromMacro) {
|
|
|
|
+ // This construct is not supported by ASTImporter.
|
|
|
|
+ Decl *FromTU = getTuDecl(
|
|
|
|
+ "#define PAIR_STRUCT(type) struct data_t{type a;type b;} \n"
|
|
|
|
+ "int declToImport(PAIR_STRUCT(int) ***d){ return 0; }",
|
|
|
|
+ Lang_C, "input.c");
|
|
|
|
+ auto *From = FirstDeclMatcher<FunctionDecl>().match(
|
|
|
|
+ FromTU, functionDecl(hasName("declToImport")));
|
|
ASSERT_TRUE(From);
|
|
ASSERT_TRUE(From);
|
|
- auto To = Import(From, Lang_C);
|
|
|
|
|
|
+ auto *To = Import(From, Lang_C);
|
|
EXPECT_EQ(To, nullptr);
|
|
EXPECT_EQ(To, nullptr);
|
|
}
|
|
}
|
|
|
|
|