Skip to content

Commit 95801e7

Browse files
committed
add unit test
1 parent 30a88ad commit 95801e7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

clang/unittests/Frontend/CompilerInvocationTest.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,26 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
732732
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2017")));
733733
}
734734

735+
TEST_F(CommandLineTest, ConditionalParsingIfHLSLFlagPresent) {
736+
const char *Args[] = {"-xhlsl"};
737+
738+
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
739+
740+
ASSERT_EQ(Invocation.getLangOpts().MaxMatrixDimension, 4u);
741+
742+
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
743+
}
744+
745+
TEST_F(CommandLineTest, ConditionalParsingIfHLSLFlagNotPresent) {
746+
const char *Args[] = {""};
747+
748+
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
749+
750+
ASSERT_EQ(Invocation.getLangOpts().MaxMatrixDimension, 1048575u);
751+
752+
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
753+
}
754+
735755
// Wide integer option.
736756

737757
TEST_F(CommandLineTest, WideIntegerHighValue) {

0 commit comments

Comments
 (0)