summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Basic/DiagnosticTest.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2019-03-07 10:13:50 +0000
committerIvan Donchevskii <ivan.donchevskii@qt.io>2019-03-07 10:13:50 +0000
commit878271b2945e89b868fb8daefea3dfaffce32710 (patch)
treef0f94102c32dede3e59498b4ed18d9db3d8fa1eb /clang/unittests/Basic/DiagnosticTest.cpp
parentfd4156ed4d30828fbcca7b42618dde0550c9b674 (diff)
downloadbcm5719-llvm-878271b2945e89b868fb8daefea3dfaffce32710.tar.gz
bcm5719-llvm-878271b2945e89b868fb8daefea3dfaffce32710.zip
[libclang] Fix CXTranslationUnit_KeepGoing
Since commit 56f548bbbb7e4387a69708f70724d00e9e076153 [modules] Round-trip -Werror flag through explicit module build. the behavior of CXTranslationUnit_KeepGoing changed: Unresolved #includes are fatal errors again. As a consequence, some templates are not instantiated and lead to confusing errors. Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal errors are mapped to errors. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D58501 llvm-svn: 355586
Diffstat (limited to 'clang/unittests/Basic/DiagnosticTest.cpp')
-rw-r--r--clang/unittests/Basic/DiagnosticTest.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp
index 6377e57b355..ffb750bdaae 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -46,13 +46,13 @@ TEST(DiagnosticTest, suppressAndTrap) {
EXPECT_FALSE(Diags.hasUnrecoverableErrorOccurred());
}
-// Check that SuppressAfterFatalError works as intended
-TEST(DiagnosticTest, suppressAfterFatalError) {
- for (unsigned Suppress = 0; Suppress != 2; ++Suppress) {
+// Check that FatalsAsError works as intended
+TEST(DiagnosticTest, fatalsAsError) {
+ for (unsigned FatalsAsError = 0; FatalsAsError != 2; ++FatalsAsError) {
DiagnosticsEngine Diags(new DiagnosticIDs(),
new DiagnosticOptions,
new IgnoringDiagConsumer());
- Diags.setSuppressAfterFatalError(Suppress);
+ Diags.setFatalsAsError(FatalsAsError);
// Diag that would set UnrecoverableErrorOccurred and ErrorOccurred.
Diags.Report(diag::err_cannot_open_file) << "file" << "error";
@@ -62,16 +62,15 @@ TEST(DiagnosticTest, suppressAfterFatalError) {
Diags.Report(diag::warn_mt_message) << "warning";
EXPECT_TRUE(Diags.hasErrorOccurred());
- EXPECT_TRUE(Diags.hasFatalErrorOccurred());
+ EXPECT_EQ(Diags.hasFatalErrorOccurred(), FatalsAsError ? 0u : 1u);
EXPECT_TRUE(Diags.hasUncompilableErrorOccurred());
EXPECT_TRUE(Diags.hasUnrecoverableErrorOccurred());
// The warning should be emitted and counted only if we're not suppressing
// after fatal errors.
- EXPECT_EQ(Diags.getNumWarnings(), Suppress ? 0u : 1u);
+ EXPECT_EQ(Diags.getNumWarnings(), FatalsAsError);
}
}
-
TEST(DiagnosticTest, diagnosticError) {
DiagnosticsEngine Diags(new DiagnosticIDs(), new DiagnosticOptions,
new IgnoringDiagConsumer());
OpenPOWER on IntegriCloud