[clang] f85a6a8 - [NFC] Add unittest for Decl::isInExportDeclContext
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 23 00:30:00 PST 2022
Author: Chuanqi Xu
Date: 2022-02-23T16:29:42+08:00
New Revision: f85a6a812718cfdaeb1d0dc971ce3875aa82fafe
URL: https://github.com/llvm/llvm-project/commit/f85a6a812718cfdaeb1d0dc971ce3875aa82fafe
DIFF: https://github.com/llvm/llvm-project/commit/f85a6a812718cfdaeb1d0dc971ce3875aa82fafe.diff
LOG: [NFC] Add unittest for Decl::isInExportDeclContext
Added:
Modified:
clang/unittests/AST/DeclTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/AST/DeclTest.cpp b/clang/unittests/AST/DeclTest.cpp
index 588ef859a181e..a84ebbd9835db 100644
--- a/clang/unittests/AST/DeclTest.cpp
+++ b/clang/unittests/AST/DeclTest.cpp
@@ -157,3 +157,17 @@ TEST(Decl, EnumDeclRange) {
EXPECT_EQ(SM.getFileOffset(BarRange.getBegin()), Code.range().Begin);
EXPECT_EQ(SM.getFileOffset(BarRange.getEnd()), Code.range().End);
}
+
+TEST(Decl, IsInExportDeclContext) {
+ llvm::Annotations Code(R"(
+ export module m;
+ export template <class T>
+ void f() {})");
+ auto AST =
+ tooling::buildASTFromCodeWithArgs(Code.code(), /*Args=*/{"-std=c++20"});
+ ASTContext &Ctx = AST->getASTContext();
+
+ const auto *f =
+ selectFirst<FunctionDecl>("f", match(functionDecl().bind("f"), Ctx));
+ EXPECT_TRUE(f->isInExportDeclContext());
+}
More information about the cfe-commits
mailing list