[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)
Qizhi Hu via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 17 06:15:02 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);
+}
----------------
jcsxky wrote:
Another testcase has been added to `ImportExpr`
https://github.com/llvm/llvm-project/pull/74813
More information about the cfe-commits
mailing list