From d0fa7a05be92617a0262ec8b622f158971a54c54 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Jan 2021 10:12:53 +0100 Subject: Revert "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo" This reverts commit 77db83ae --- .../unittests/Frontend/CompilerInvocationTest.cpp | 62 ---------------------- 1 file changed, 62 deletions(-) (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp') diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 8fcf34d..257290a 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -508,68 +508,6 @@ TEST_F(CommandLineTest, StringVectorMultiple) { ASSERT_THAT(GeneratedArgs, ContainsN(HasSubstr("-fmodule-map-file"), 2)); } -// A flag that should be parsed only if a condition is met. - -TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) { - const char *Args[] = {""}; - - CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); - - ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_FALSE(Invocation.getLangOpts()->SYCL); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); - - Invocation.generateCC1CommandLine(GeneratedArgs, *this); - - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl")))); - ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=")))); -} - -TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) { - const char *Args[] = {"-sycl-std=2017"}; - - CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); - - ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_FALSE(Invocation.getLangOpts()->SYCL); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); - - Invocation.generateCC1CommandLine(GeneratedArgs, *this); - - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl")))); - ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=")))); -} - -TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresent) { - const char *Args[] = {"-fsycl"}; - - CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); - - ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCL); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None); - - Invocation.generateCC1CommandLine(GeneratedArgs, *this); - - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl"))); - ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std=")))); -} - -TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) { - const char *Args[] = {"-fsycl", "-sycl-std=2017"}; - - CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags); - - ASSERT_FALSE(Diags->hasErrorOccurred()); - ASSERT_TRUE(Invocation.getLangOpts()->SYCL); - ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017); - - Invocation.generateCC1CommandLine(GeneratedArgs, *this); - - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl"))); - ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2017"))); -} - // Wide integer option. TEST_F(CommandLineTest, WideIntegerHighValue) { -- cgit v1.1