<div dir="ltr">Thank you for the suggestions. This should be addressed in r262618.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 March 2016 at 14:42, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 3, 2016 at 2:08 PM, Gabor Horvath via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: xazax<br>
Date: Thu Mar 3 07:08:11 2016<br>
New Revision: 262615<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=262615&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=262615&view=rev</a><br>
Log:<br>
[clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.<br>
<br>
Added:<br>
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp<br>
Modified:<br>
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp<br>
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst<br>
<br>
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615&r1=262614&r2=262615&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615&r1=262614&r2=262615&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp Thu Mar 3 07:08:11 2016<br>
@@ -7,8 +7,8 @@<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
-#include "../utils/LexerUtils.h"<br>
#include "SuspiciousSemicolonCheck.h"<br>
+#include "../utils/LexerUtils.h"<br>
#include "clang/AST/ASTContext.h"<br>
#include "clang/ASTMatchers/ASTMatchFinder.h"<br>
<br>
@@ -30,6 +30,9 @@ void SuspiciousSemicolonCheck::registerM<br>
}<br>
<br>
void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult &Result) {<br>
+ if (Result.Context->getDiagnostics().hasErrorOccurred())<br>
+ return;<br>
+<br>
const auto *Semicolon = Result.Nodes.getNodeAs<NullStmt>("semi");<br>
SourceLocation LocStart = Semicolon->getLocStart();<br>
<br>
<br>
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615&r1=262614&r2=262615&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615&r1=262614&r2=262615&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst (original)<br>
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst Thu Mar 3 07:08:11 2016<br>
@@ -11,7 +11,7 @@ intentional.<br>
<br>
.. code-block:: c++<br>
<br>
- if(x < y);<br>
+ if (x < y);<br>
{<br>
x++;<br>
}<br>
@@ -22,7 +22,7 @@ the first line, and `x` will be incremen<br>
<br>
.. code-block:: c++<br>
<br>
- while((line = readLine(file)) != NULL);<br>
+ while ((line = readLine(file)) != NULL);<br>
processLine(line);<br>
<br>
As a result of this code, `processLine()` will only be called once, when the<br>
@@ -32,7 +32,7 @@ the code indicates the intention of the<br>
<br>
.. code-block:: c++<br>
<br>
- if(x >= y);<br>
+ if (x >= y);<br>
x -= y;<br>
<br>
While the indentation does not imply any nesting, there is simply no valid<br>
@@ -45,7 +45,7 @@ line. For example:<br>
<br>
.. code-block:: c++<br>
<br>
- while(readWhitespace());<br>
+ while (readWhitespace());<br>
Token t = readNextToken();<br>
<br>
Here the second line is indented in a way that suggests that it is meant to be<br>
@@ -56,14 +56,14 @@ Either remove the indentation from the s<br>
<br>
.. code-block:: c++<br>
<br>
- while(readWhitespace());<br>
+ while (readWhitespace());<br>
Token t = readNextToken();<br>
<br>
... or move the semicolon from the end of the first line to a new line:<br>
<br>
.. code-block:: c++<br>
<br>
- while(readWhitespace())<br>
+ while (readWhitespace())<br>
;<br>
<br>
Token t = readNextToken();<br>
<br>
Added: clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615&view=auto</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp (added)<br>
+++ clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp Thu Mar 3 07:08:11 2016<br>
@@ -0,0 +1,13 @@<br>
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 > %t<br>
+// RUN: FileCheck --input-file=%t %s<br></blockquote><div><br></div><div><span style="color:rgb(0,0,0);font-family:'Segoe UI','Segoe UI Web Regular','Segoe UI Symbol','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.85px">Please pipe the output to FileCheck instead of redirecting it to a temporary file.</span><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
+// Note: This test verifies that, the checker does not emit any warning for<br>
+// files that do not compile.<br>
+<br>
+bool g();<br>
+<br>
+void f() {<br>
+ if (g());<br>
+ // CHECK-NOT: :[[@LINE-1]]:11: warning: potentially unintended semicolon [misc-suspicious-semicolon]<br></blockquote><div><br></div><div><span style="color:rgb(0,0,0);font-family:'Segoe UI','Segoe UI Web Regular','Segoe UI Symbol','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.85px">Please make the check line more broad for more tolerance to bugs and changes to the check. Just match the core of the message or even just the check name.</span><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ int a<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></div>