aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend/CompilerInvocationTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
-rw-r--r--clang/unittests/Frontend/CompilerInvocationTest.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index 798b616..673b34d 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -506,7 +506,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedNone) {
const char *Args[] = {""};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_TRUE(Invocation.getLangOpts()->CommentOpts.BlockCommandNames.empty());
+ ASSERT_TRUE(Invocation.getLangOpts().CommentOpts.BlockCommandNames.empty());
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -518,7 +518,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedSingle) {
const char *Args[] = {"-fcomment-block-commands=x,y"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_EQ(Invocation.getLangOpts()->CommentOpts.BlockCommandNames,
+ ASSERT_EQ(Invocation.getLangOpts().CommentOpts.BlockCommandNames,
std::vector<std::string>({"x", "y"}));
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -532,7 +532,7 @@ TEST_F(CommandLineTest, StringVectorCommaJoinedMultiple) {
"-fcomment-block-commands=a,b"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_EQ(Invocation.getLangOpts()->CommentOpts.BlockCommandNames,
+ ASSERT_EQ(Invocation.getLangOpts().CommentOpts.BlockCommandNames,
std::vector<std::string>({"x", "y", "a", "b"}));
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -549,9 +549,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -565,9 +565,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -582,9 +582,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfNonsenseSyclStdArg) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_TRUE(Diags->hasErrorOccurred());
- ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_None);
+ ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -599,9 +599,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg1) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
+ ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -616,9 +616,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg2) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
+ ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -633,9 +633,9 @@ TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg3) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_TRUE(Invocation.getLangOpts()->SYCLIsDevice);
- ASSERT_FALSE(Invocation.getLangOpts()->SYCLIsHost);
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
+ ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
+ ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -650,7 +650,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentHost) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(),
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(),
LangOptions::SYCL_Default);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -665,7 +665,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentDevice) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(),
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(),
LangOptions::SYCL_Default);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -680,7 +680,7 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
ASSERT_FALSE(Diags->hasErrorOccurred());
- ASSERT_EQ(Invocation.getLangOpts()->getSYCLVersion(), LangOptions::SYCL_2017);
+ ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -712,10 +712,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsNoFlagPresent) {
const char *Args[] = {""};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_FALSE(Invocation.getLangOpts()->CLUnsafeMath);
+ ASSERT_FALSE(Invocation.getLangOpts().CLUnsafeMath);
ASSERT_FALSE(Invocation.getCodeGenOpts().LessPreciseFPMAD);
- ASSERT_FALSE(Invocation.getLangOpts()->UnsafeFPMath);
- ASSERT_FALSE(Invocation.getLangOpts()->AllowRecip);
+ ASSERT_FALSE(Invocation.getLangOpts().UnsafeFPMath);
+ ASSERT_FALSE(Invocation.getLangOpts().AllowRecip);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -733,12 +733,12 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsRootFlagPresent) {
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
// Explicitly provided root flag.
- ASSERT_TRUE(Invocation.getLangOpts()->CLUnsafeMath);
+ ASSERT_TRUE(Invocation.getLangOpts().CLUnsafeMath);
// Directly implied by explicitly provided root flag.
ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD);
- ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath);
+ ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath);
// Transitively implied by explicitly provided root flag.
- ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip);
+ ASSERT_TRUE(Invocation.getLangOpts().AllowRecip);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -756,10 +756,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsAllFlagsPresent) {
"-funsafe-math-optimizations", "-freciprocal-math"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_TRUE(Invocation.getLangOpts()->CLUnsafeMath);
+ ASSERT_TRUE(Invocation.getLangOpts().CLUnsafeMath);
ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD);
- ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath);
- ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip);
+ ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath);
+ ASSERT_TRUE(Invocation.getLangOpts().AllowRecip);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
@@ -777,10 +777,10 @@ TEST_F(CommandLineTest, ImpliedBoolOptionsImpliedFlagsPresent) {
"-freciprocal-math"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_FALSE(Invocation.getLangOpts()->CLUnsafeMath);
+ ASSERT_FALSE(Invocation.getLangOpts().CLUnsafeMath);
ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD);
- ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath);
- ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip);
+ ASSERT_TRUE(Invocation.getLangOpts().UnsafeFPMath);
+ ASSERT_TRUE(Invocation.getLangOpts().AllowRecip);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Not generated - missing.
@@ -826,7 +826,7 @@ TEST_F(CommandLineTest, DigraphsImplied) {
const char *Args[] = {""};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_TRUE(Invocation.getLangOpts()->Digraphs);
+ ASSERT_TRUE(Invocation.getLangOpts().Digraphs);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-digraphs"))));
@@ -837,7 +837,7 @@ TEST_F(CommandLineTest, DigraphsDisabled) {
const char *Args[] = {"-fno-digraphs"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_FALSE(Invocation.getLangOpts()->Digraphs);
+ ASSERT_FALSE(Invocation.getLangOpts().Digraphs);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-digraphs")));
@@ -848,7 +848,7 @@ TEST_F(CommandLineTest, DigraphsNotImplied) {
const char *Args[] = {"-std=c89"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_FALSE(Invocation.getLangOpts()->Digraphs);
+ ASSERT_FALSE(Invocation.getLangOpts().Digraphs);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-digraphs"))));
@@ -859,7 +859,7 @@ TEST_F(CommandLineTest, DigraphsEnabled) {
const char *Args[] = {"-std=c89", "-fdigraphs"};
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_TRUE(Invocation.getLangOpts()->Digraphs);
+ ASSERT_TRUE(Invocation.getLangOpts().Digraphs);
Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fdigraphs")));
@@ -964,8 +964,8 @@ TEST_F(CommandLineTest, RoundTrip) {
ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
- ASSERT_TRUE(Invocation.getLangOpts()->C17);
- ASSERT_EQ(Invocation.getLangOpts()->MaxTokens, 10u);
+ ASSERT_TRUE(Invocation.getLangOpts().C17);
+ ASSERT_EQ(Invocation.getLangOpts().MaxTokens, 10u);
ASSERT_EQ(Invocation.getTargetOpts().SDKVersion, llvm::VersionTuple(1, 2, 3));
ASSERT_EQ(Invocation.getTargetOpts().EABIVersion, EABI::EABI4);