aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend/CompilerInvocationTest.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2021-01-08 11:05:16 +0100
committerJan Svoboda <jan_svoboda@apple.com>2021-01-11 10:05:53 +0100
commit97100646d1b4526de1eac3aacdb0b098739c6ec9 (patch)
tree565398e18314f30c2d5639f97fd44b6fdc17b21f /clang/unittests/Frontend/CompilerInvocationTest.cpp
parentb7ccaca53700fce21b0e8e5d7bd2a956bd391fee (diff)
downloadllvm-97100646d1b4526de1eac3aacdb0b098739c6ec9.zip
llvm-97100646d1b4526de1eac3aacdb0b098739c6ec9.tar.gz
llvm-97100646d1b4526de1eac3aacdb0b098739c6ec9.tar.bz2
Reapply "[clang][cli] Port DiagnosticOpts to new option parsing system"
This reverts commit 8e3e148c This commit fixes two issues with the original patch: * The sanitizer build bot reported an uninitialized value. This was caused by normalizeStringIntegral not returning None on failure. * Some build bots complained about inaccessible keypaths. To mitigate that, "this->" was added back to the keypath to restore the previous behavior.
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
-rw-r--r--clang/unittests/Frontend/CompilerInvocationTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index 577059f..8efba9c 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -680,4 +680,19 @@ TEST_F(CommandLineTest, PresentAndNotImpliedGenerated) {
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-cl-mad-enable")));
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-menable-unsafe-fp-math")));
}
+
+// Diagnostic option.
+
+TEST_F(CommandLineTest, DiagnosticOptionPresent) {
+ const char *Args[] = {"-verify=xyz"};
+
+ ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
+
+ ASSERT_EQ(Invocation.getDiagnosticOpts().VerifyPrefixes,
+ std::vector<std::string>({"xyz"}));
+
+ Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+
+ ASSERT_THAT(GeneratedArgs, ContainsN(StrEq("-verify=xyz"), 1));
+}
} // anonymous namespace