[clang-tools-extra] r294467 - [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 8 08:11:23 PST 2017
Author: alexfh
Date: Wed Feb 8 10:11:22 2017
New Revision: 294467
URL: http://llvm.org/viewvc/llvm-project?rev=294467&view=rev
Log:
[clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()
hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about
errors that lead to invalid AST.
Modified:
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=294467&r1=294466&r2=294467&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Wed Feb 8 10:11:22 2017
@@ -72,7 +72,7 @@ void DefinitionsInHeadersCheck::register
void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
// Don't run the check in failing TUs.
- if (Result.Context->getDiagnostics().hasErrorOccurred())
+ if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
return;
// C++ [basic.def.odr] p6:
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=294467&r1=294466&r2=294467&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp Wed Feb 8 10:11:22 2017
@@ -30,7 +30,7 @@ void SuspiciousSemicolonCheck::registerM
}
void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {
- if (Result.Context->getDiagnostics().hasErrorOccurred())
+ if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
return;
const auto *Semicolon = Result.Nodes.getNodeAs<NullStmt>("semi");
Modified: clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=294467&r1=294466&r2=294467&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp Wed Feb 8 10:11:22 2017
@@ -1,4 +1,10 @@
-// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 | FileCheck %s
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- -DERROR 2>&1 \
+// RUN: | FileCheck %s -check-prefix=CHECK-ERROR \
+// RUN: -implicit-check-not="{{warning|error}}:"
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon,clang-diagnostic*" \
+// RUN: -- -DWERROR -Wno-everything -Werror=unused-variable 2>&1 \
+// RUN: | FileCheck %s -check-prefix=CHECK-WERROR \
+// RUN: -implicit-check-not="{{warning|error}}:"
// Note: This test verifies that, the checker does not emit any warning for
// files that do not compile.
@@ -7,6 +13,14 @@ bool g();
void f() {
if (g());
- // CHECK-NOT: [misc-suspicious-semicolon]
+ // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon [misc-suspicious-semicolon]
+#if ERROR
int a
+ // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-diagnostic-error]
+#elif WERROR
+ int a;
+ // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' [clang-diagnostic-unused-variable]
+#else
+#error "One of ERROR or WERROR should be defined.
+#endif
}
More information about the cfe-commits
mailing list