Skip to content

Commit f85a6a8

Browse files
committed
[NFC] Add unittest for Decl::isInExportDeclContext
1 parent 7ea103d commit f85a6a8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/unittests/AST/DeclTest.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,17 @@ TEST(Decl, EnumDeclRange) {
157157
EXPECT_EQ(SM.getFileOffset(BarRange.getBegin()), Code.range().Begin);
158158
EXPECT_EQ(SM.getFileOffset(BarRange.getEnd()), Code.range().End);
159159
}
160+
161+
TEST(Decl, IsInExportDeclContext) {
162+
llvm::Annotations Code(R"(
163+
export module m;
164+
export template <class T>
165+
void f() {})");
166+
auto AST =
167+
tooling::buildASTFromCodeWithArgs(Code.code(), /*Args=*/{"-std=c++20"});
168+
ASTContext &Ctx = AST->getASTContext();
169+
170+
const auto *f =
171+
selectFirst<FunctionDecl>("f", match(functionDecl().bind("f"), Ctx));
172+
EXPECT_TRUE(f->isInExportDeclContext());
173+
}

0 commit comments

Comments
 (0)