[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 12 00:40:56 PST 2023
================
@@ -9284,6 +9284,24 @@ TEST_P(ASTImporterOptionSpecificTestBase,
// EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1);
}
+const internal::VariadicDynCastAllOfMatcher<Stmt, BuiltinBitCastExpr>
+ builtinBitCastExpr;
+
+TEST_P(ASTImporterOptionSpecificTestBase, ImportBuiltinBitCastExpr) {
+ const char *CodeFrom =
+ R"(
+ void foo(int T) { (void)__builtin_bit_cast(float, T); }
+ )";
+ Decl *FromTU = getTuDecl(CodeFrom, Lang_CXX20);
+ auto *FromFoo = FirstDeclMatcher<FunctionDecl>().match(
+ FromTU, functionDecl(hasName("foo")));
+ auto *ToFoo = Import(FromFoo, Lang_CXX20);
+ EXPECT_TRUE(ToFoo);
+ auto *ToBuiltinBitCastExpr =
+ FirstDeclMatcher<BuiltinBitCastExpr>().match(ToFoo, builtinBitCastExpr());
+ EXPECT_TRUE(ToBuiltinBitCastExpr);
+}
----------------
balazske wrote:
Instead of this test a more simple test can be added in the `ImportExpr` section of **ASTImporterTest.cpp**.
https://github.com/llvm/llvm-project/pull/74813
More information about the cfe-commits
mailing list