[llvm-branch-commits] [clang] f825ec8 - [clang][cli] CompilerInvocationTest: rename member variable in fixture
Jan Svoboda via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 9 00:03:30 PST 2020
Author: Jan Svoboda
Date: 2020-12-09T08:58:45+01:00
New Revision: f825ec86e14b1369a9edf382d65259351eae679e
URL: https://github.com/llvm/llvm-project/commit/f825ec86e14b1369a9edf382d65259351eae679e
DIFF: https://github.com/llvm/llvm-project/commit/f825ec86e14b1369a9edf382d65259351eae679e.diff
LOG: [clang][cli] CompilerInvocationTest: rename member variable in fixture
Depends on D92825.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D92826
Added:
Modified:
clang/unittests/Frontend/CompilerInvocationTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index 0394308e8015..69a807056f29 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -27,7 +27,7 @@ class CommandLineTest : public ::testing::Test {
IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
SmallVector<const char *, 32> GeneratedArgs;
SmallVector<std::string, 32> GeneratedArgsStorage;
- CompilerInvocation CInvok;
+ CompilerInvocation Invocation;
const char *operator()(const Twine &Arg) {
return GeneratedArgsStorage.emplace_back(Arg.str()).c_str();
@@ -40,41 +40,41 @@ class CommandLineTest : public ::testing::Test {
TEST_F(CommandLineTest, OptIsInitializedWithCustomDefaultValue) {
const char *Args[] = {"clang", "-xc++"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- ASSERT_TRUE(CInvok.getFrontendOpts().UseTemporary);
+ ASSERT_TRUE(Invocation.getFrontendOpts().UseTemporary);
}
TEST_F(CommandLineTest, OptOfNegativeFlagIsPopulatedWithFalse) {
const char *Args[] = {"clang", "-xc++", "-fno-temp-file"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- ASSERT_FALSE(CInvok.getFrontendOpts().UseTemporary);
+ ASSERT_FALSE(Invocation.getFrontendOpts().UseTemporary);
}
TEST_F(CommandLineTest, OptsOfImpliedPositiveFlagArePopulatedWithTrue) {
const char *Args[] = {"clang", "-xc++", "-cl-unsafe-math-optimizations"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
// Explicitly provided flag.
- ASSERT_TRUE(CInvok.getLangOpts()->CLUnsafeMath);
+ ASSERT_TRUE(Invocation.getLangOpts()->CLUnsafeMath);
// Flags directly implied by explicitly provided flag.
- ASSERT_TRUE(CInvok.getCodeGenOpts().LessPreciseFPMAD);
- ASSERT_TRUE(CInvok.getLangOpts()->UnsafeFPMath);
+ ASSERT_TRUE(Invocation.getCodeGenOpts().LessPreciseFPMAD);
+ ASSERT_TRUE(Invocation.getLangOpts()->UnsafeFPMath);
// Flag transitively implied by explicitly provided flag.
- ASSERT_TRUE(CInvok.getLangOpts()->AllowRecip);
+ ASSERT_TRUE(Invocation.getLangOpts()->AllowRecip);
}
TEST_F(CommandLineTest, CanGenerateCC1CommandLineFlag) {
const char *Args[] = {"clang", "-xc++", "-fmodules-strict-context-hash", "-"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fmodules-strict-context-hash")));
}
@@ -83,9 +83,9 @@ TEST_F(CommandLineTest, CanGenerateCC1CommandLineSeparate) {
const char *TripleCStr = "i686-apple-darwin9";
const char *Args[] = {"clang", "-xc++", "-triple", TripleCStr, "-"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Contains(StrEq(TripleCStr)));
}
@@ -96,9 +96,9 @@ TEST_F(CommandLineTest, CanGenerateCC1CommandLineSeparateRequiredPresent) {
const char *Args[] = {"clang", "-xc++", "-triple", DefaultTriple.c_str(),
"-"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Triple should always be emitted even if it is the default
ASSERT_THAT(GeneratedArgs, Contains(StrEq(DefaultTriple.c_str())));
@@ -109,9 +109,9 @@ TEST_F(CommandLineTest, CanGenerateCC1CommandLineSeparateRequiredAbsent) {
llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple());
const char *Args[] = {"clang", "-xc++", "-"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Triple should always be emitted even if it is the default
ASSERT_THAT(GeneratedArgs, Contains(StrEq(DefaultTriple.c_str())));
@@ -122,9 +122,9 @@ TEST_F(CommandLineTest, CanGenerateCC1CommandLineSeparateEnum) {
const char *Args[] = {"clang", "-xc++", "-mrelocation-model",
RelocationModelCStr, "-"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Non default relocation model
ASSERT_THAT(GeneratedArgs, Contains(StrEq(RelocationModelCStr)));
@@ -133,19 +133,19 @@ TEST_F(CommandLineTest, CanGenerateCC1CommandLineSeparateEnum) {
RelocationModelCStr = "pic";
Args[3] = RelocationModelCStr;
- CompilerInvocation CInvok1;
- CompilerInvocation::CreateFromArgs(CInvok1, Args, *Diags);
+ CompilerInvocation Invocation2;
+ CompilerInvocation::CreateFromArgs(Invocation2, Args, *Diags);
- CInvok1.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation2.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Each(StrNe(RelocationModelCStr)));
}
TEST_F(CommandLineTest, NotPresentNegativeFlagNotGenerated) {
const char *Args[] = {"clang", "-xc++"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-temp-file"))));
}
@@ -153,9 +153,9 @@ TEST_F(CommandLineTest, NotPresentNegativeFlagNotGenerated) {
TEST_F(CommandLineTest, PresentNegativeFlagGenerated) {
const char *Args[] = {"clang", "-xc++", "-fno-temp-file"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-temp-file")));
}
@@ -163,9 +163,9 @@ TEST_F(CommandLineTest, PresentNegativeFlagGenerated) {
TEST_F(CommandLineTest, NotPresentAndNotImpliedNotGenerated) {
const char *Args[] = {"clang", "-xc++"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Missing options are not generated.
ASSERT_THAT(GeneratedArgs,
@@ -177,9 +177,9 @@ TEST_F(CommandLineTest, NotPresentAndNotImpliedNotGenerated) {
TEST_F(CommandLineTest, NotPresentAndImpliedNotGenerated) {
const char *Args[] = {"clang", "-xc++", "-cl-unsafe-math-optimizations"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Missing options that were implied are not generated.
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-cl-unsafe-math-optimizations")));
@@ -191,9 +191,9 @@ TEST_F(CommandLineTest, PresentAndImpliedNotGenerated) {
const char *Args[] = {"clang", "-xc++", "-cl-unsafe-math-optimizations",
"-cl-mad-enable", "-menable-unsafe-fp-math"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Present options that were also implied are not generated.
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-cl-unsafe-math-optimizations")));
@@ -205,9 +205,9 @@ TEST_F(CommandLineTest, PresentAndNotImpliedGenerated) {
const char *Args[] = {"clang", "-xc++", "-cl-mad-enable",
"-menable-unsafe-fp-math"};
- CompilerInvocation::CreateFromArgs(CInvok, Args, *Diags);
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
- CInvok.generateCC1CommandLine(GeneratedArgs, *this);
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
// Present options that were not implied are generated.
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-cl-mad-enable")));
More information about the llvm-branch-commits
mailing list