<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 24, 2016 at 8:31 AM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Wait, I thought the check was mostly useful for C code, where it detects real issues? Etienne, can you comment?</div></blockquote><div><br></div><div>See below. This is only checking for cases that are already ill-formed, some of which we accept as an extension, and all of which have frontend warnings.</div><div><br></div><div>We should consider enabling those of the below warnings that are disabled by default, and should definitely give them warning flags, but I don't think we need clang-tidy checks for ill-formed code that the frontend already diagnoses. (Note that prior to DR1512, some of the cases detected by this check were valid in C++).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 21, 2016 at 11:50 PM, Richard Smith 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:1px solid rgb(204,204,204);padding-left:1ex">Author: rsmith<br>
Date: Fri Oct 21 16:50:28 2016<br>
New Revision: 284888<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=284888&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=284888&view=rev</a><br>
Log:<br>
Remove 'misc-pointer-and-integral-ope<wbr>ration' clang-tidy check. The only cases<br>
it detects are ill-formed (some per C++ core issue 1512, others always have<br>
been).<br>
<br>
Removed:<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.cpp<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.h<br>
    clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/misc-pointer-<wbr>and-integral-operation.rst<br>
    clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation-cxx98.cpp<br>
    clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation.cpp<br>
Modified:<br>
    clang-tools-extra/trunk/clang-<wbr>tidy-vs/ClangTidy/Resources/Cl<wbr>angTidyChecks.yaml<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/misc/CMakeLists.txt<br>
    clang-tools-extra/trunk/clang-<wbr>tidy/misc/MiscTidyModule.cpp<br>
    clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy-vs/ClangTidy/Resources/Cl<wbr>angTidyChecks.yaml<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy-vs/ClangTidy/Resources/ClangTidyChecks.yaml?rev=284888&r1=284887&r2=284888&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy-vs/ClangTidy/Resour<wbr>ces/ClangTidyChecks.yaml?rev=<wbr>284888&r1=284887&r2=284888&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy-vs/ClangTidy/Resources/Cl<wbr>angTidyChecks.yaml (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy-vs/ClangTidy/Resources/Cl<wbr>angTidyChecks.yaml Fri Oct 21 16:50:28 2016<br>
@@ -239,10 +239,6 @@ Checks:<br>
     Description:<br>
     Name:        misc-non-copyable-objects<br>
   - Category:    Miscellaneous<br>
-    Label:       Suspicious pointer / integer operations<br>
-    Description:<br>
-    Name:        misc-pointer-and-integral-oper<wbr>ation<br>
-  - Category:    Miscellaneous<br>
     Label:       Find redundant expressions<br>
     Description:<br>
     Name:        misc-redundant-expression<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/misc/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt?rev=284888&r1=284887&r2=284888&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/misc/CMakeLists.<wbr>txt?rev=284888&r1=284887&r2=<wbr>284888&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/misc/CMakeLists.txt (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/misc/CMakeLists.txt Fri Oct 21 16:50:28 2016<br>
@@ -24,7 +24,6 @@ add_clang_library(clangTidyMis<wbr>cModule<br>
   NewDeleteOverloadsCheck.cpp<br>
   NoexceptMoveConstructorCheck.<wbr>cpp<br>
   NonCopyableObjects.cpp<br>
-  PointerAndIntegralOperationChe<wbr>ck.cpp<br>
   RedundantExpressionCheck.cpp<br>
   SizeofContainerCheck.cpp<br>
   SizeofExpressionCheck.cpp<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/misc/MiscTidyModule.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=284888&r1=284887&r2=284888&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/misc/MiscTidyModule<wbr>.cpp?rev=284888&r1=284887&r2=<wbr>284888&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/misc/MiscTidyModule.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/misc/MiscTidyModule.cpp Fri Oct 21 16:50:28 2016<br>
@@ -32,7 +32,6 @@<br>
 #include "NewDeleteOverloadsCheck.h"<br>
 #include "NoexceptMoveConstructorCheck.<wbr>h"<br>
 #include "NonCopyableObjects.h"<br>
-#include "PointerAndIntegralOperationCh<wbr>eck.h"<br>
 #include "RedundantExpressionCheck.h"<br>
 #include "SizeofContainerCheck.h"<br>
 #include "SizeofExpressionCheck.h"<br>
@@ -104,8 +103,6 @@ public:<br>
         "misc-noexcept-move-construct<wbr>or");<br>
     CheckFactories.registerCheck<<wbr>NonCopyableObjectsCheck>(<br>
         "misc-non-copyable-objects");<br>
-    CheckFactories.registerCheck<P<wbr>ointerAndIntegralOperationChec<wbr>k>(<br>
-        "misc-pointer-and-integral-ope<wbr>ration");<br>
     CheckFactories.registerCheck<<wbr>RedundantExpressionCheck>(<br>
         "misc-redundant-expression");<br>
     CheckFactories.registerCheck<<wbr>SizeofContainerCheck>("misc-si<wbr>zeof-container");<br>
<br>
Removed: clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/PointerAndIntegralOperationCheck.cpp?rev=284887&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/misc/PointerAndInte<wbr>gralOperationCheck.cpp?rev=<wbr>284887&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.cpp (removed)<br>
@@ -1,104 +0,0 @@<br>
-//===--- PointerAndIntegralOperationChe<wbr>ck.cpp - clang-tidy-----------------===<wbr>//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-<br>
-#include "PointerAndIntegralOperationCh<wbr>eck.h"<br>
-#include "clang/AST/ASTContext.h"<br>
-#include "clang/ASTMatchers/ASTMatchFin<wbr>der.h"<br>
-#include "../utils/Matchers.h"<br>
-<br>
-using namespace clang::ast_matchers;<br>
-<br>
-namespace clang {<br>
-namespace tidy {<br>
-namespace misc {<br>
-<br>
-void PointerAndIntegralOperationChe<wbr>ck::registerMatchers(MatchFind<wbr>er *Finder) {<br>
-  const auto PointerExpr = expr(hasType(pointerType()));<br>
-  const auto BoolExpr = ignoringParenImpCasts(hasType(<wbr>booleanType()));<br>
-  const auto CharExpr = ignoringParenImpCasts(hasType(<wbr>isAnyCharacter()));<br>
-<br>
-  const auto BinOpWithPointerExpr =<br>
-      binaryOperator(unless(anyOf(ha<wbr>sOperatorName(","), hasOperatorName("="))),<br>
-                     hasEitherOperand(PointerExpr)<wbr>);<br>
-<br>
-  const auto AssignToPointerExpr =<br>
-      binaryOperator(hasOperatorName<wbr>("="), hasLHS(PointerExpr));<br>
-<br>
-  const auto CompareToPointerExpr =<br>
-      binaryOperator(matchers::isRel<wbr>ationalOperator(),<br>
-                     hasEitherOperand(PointerExpr)<wbr>);<br>
-<br>
-  // Detect expression like: ptr = (x != y);<br>
-  Finder->addMatcher(binaryOpera<wbr>tor(AssignToPointerExpr, hasRHS(BoolExpr))<br>
-                         .bind("assign-bool-to-<wbr>pointer"),<br>
-                     this);<br></blockquote></div></div></div></div></blockquote><div><br></div><div>This is ill-formed in C and C++. Clang accepts in C as an extension (with enabled-by-default warning), rejects with -pedantic-errors or -Werror=int-conversion.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-  // Detect expression like: ptr = A[i]; where A is char*.<br>
-  Finder->addMatcher(binaryOpera<wbr>tor(AssignToPointerExpr, hasRHS(CharExpr))<br>
-                         .bind("assign-char-to-<wbr>pointer"),<br>
-                     this);</blockquote></div></div></div></div></blockquote><div><br></div><div>This is ill-formed in C and C++. Clang accepts in C as an extension (with enabled-by-default warning), rejects with -pedantic-errors or -Werror=int-conversion.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-  // Detect expression like: ptr < false;<br>
-  Finder->addMatcher(<br>
-      binaryOperator(BinOpWithPointe<wbr>rExpr,<br>
-                     hasEitherOperand(ignoringPare<wbr>nImpCasts(cxxBoolLiteral())))<br>
-          .bind("pointer-and-bool-litera<wbr>l"),<br>
-      this);<br></blockquote></div></div></div></div></blockquote><div><br></div><div>This is ill-formed in C (assuming 'false' is the macro from <stdbool.h> and C++. Clang accepts in C as an extension (with disabled-by-default warning), rejects with -pedantic-errors. Clang used to accept in C++98 (prior to applying fix for DR1512), now rejects in all C++ language modes.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-  // Detect expression like: ptr < 'a';<br>
-  Finder->addMatcher(binaryOpera<wbr>tor(BinOpWithPointerExpr,<br>
-                                    hasEitherOperand(ignoringParen<wbr>ImpCasts(<br>
-                                        characterLiteral())))<br>
-                         .bind("pointer-and-char-liter<wbr>al"),<br>
-                     this);<br></blockquote></div></div></div></div></blockquote><div><br></div><div>This is ill-formed in C and C++. Clang accepts in C as an extension (with enabled-by-default warning), rejects with -pedantic-errors.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-  // Detect expression like: ptr < 0;<br>
-  Finder->addMatcher(binaryOpera<wbr>tor(CompareToPointerExpr,<br>
-                                    hasEitherOperand(ignoringParen<wbr>ImpCasts(<br>
-                                        integerLiteral(equals(0)))))<br>
-                         .bind("compare-pointer-to-zer<wbr>o"),<br>
-                     this);<br></blockquote></div></div></div></div></blockquote><div><br></div><div><div>This is ill-formed in C and C++. Clang accepts in C as an extension (with disabled-by-default warning), rejects with -pedantic-errors. Clang used to accept in all C++ language modes (prior to applying fix for DR1512), now rejects in all C++ language modes.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-  // Detect expression like: ptr < nullptr;<br>
-  Finder->addMatcher(binaryOpera<wbr>tor(CompareToPointerExpr,<br>
-                                    hasEitherOperand(ignoringParen<wbr>ImpCasts(<br>
-                                        cxxNullPtrLiteralExpr())))<br>
-                         .bind("compare-pointer-to-nul<wbr>l"),<br>
-                     this);<br></blockquote></div></div></div></div></blockquote><div><br></div><div><div>This is ill-formed (in C++; C doesn't have nullptr). Clang used to accept in all C++ language modes (prior to applying fix for DR1512), now rejects in all C++ language modes.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-}<br>
-<br>
-void PointerAndIntegralOperationChe<wbr>ck::check(<br>
-    const MatchFinder::MatchResult &Result) {<br>
-  if (const auto *E =<br>
-          Result.Nodes.getNodeAs<BinaryO<wbr>perator>("assign-bool-to-<wbr>pointer")) {<br>
-    diag(E->getOperatorLoc(), "suspicious assignment from bool to pointer");<br>
-  } else if (const auto *E = Result.Nodes.getNodeAs<BinaryO<wbr>perator>(<br>
-                 "assign-char-to-pointer")) {<br>
-    diag(E->getOperatorLoc(), "suspicious assignment from char to pointer");<br>
-  } else if (const auto *E = Result.Nodes.getNodeAs<BinaryO<wbr>perator>(<br>
-                 "pointer-and-bool-literal")) {<br>
-    diag(E->getOperatorLoc(),<br>
-         "suspicious operation between pointer and bool literal");<br>
-  } else if (const auto *E = Result.Nodes.getNodeAs<BinaryO<wbr>perator>(<br>
-                 "pointer-and-char-literal")) {<br>
-    diag(E->getOperatorLoc(),<br>
-         "suspicious operation between pointer and character literal");<br>
-  } else if (const auto *E = Result.Nodes.getNodeAs<BinaryO<wbr>perator>(<br>
-                 "compare-pointer-to-zero")) {<br>
-    diag(E->getOperatorLoc(), "suspicious comparison of pointer with zero");<br>
-  } else if (const auto *E = Result.Nodes.getNodeAs<BinaryO<wbr>perator>(<br>
-                 "compare-pointer-to-null")) {<br>
-    diag(E->getOperatorLoc(),<br>
-         "suspicious comparison of pointer with null expression");<br>
-  }<br>
-}<br>
-<br>
-} // namespace misc<br>
-} // namespace tidy<br>
-} // namespace clang<br>
<br>
Removed: clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/PointerAndIntegralOperationCheck.h?rev=284887&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>clang-tidy/misc/PointerAndInte<wbr>gralOperationCheck.h?rev=<wbr>284887&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.h (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/misc/PointerAndIntegralOp<wbr>erationCheck.h (removed)<br>
@@ -1,35 +0,0 @@<br>
-//===--- PointerAndIntegralOperationChe<wbr>ck.h - clang-tidy---------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-<br>
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MISC_POINTER_AND_INTEGRAL_<wbr>OPERATION_H<br>
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MISC_POINTER_AND_INTEGRAL_<wbr>OPERATION_H<br>
-<br>
-#include "../ClangTidy.h"<br>
-<br>
-namespace clang {<br>
-namespace tidy {<br>
-namespace misc {<br>
-<br>
-/// Find suspicious expressions involving pointer and integral types.<br>
-///<br>
-/// For the user-facing documentation see:<br>
-/// <a href="http://clang.llvm.org/extra/clang-tidy/checks/misc-pointer-and-integral-operation.html" rel="noreferrer" target="_blank">http://clang.llvm.org/extra/cl<wbr>ang-tidy/checks/misc-pointer-<wbr>and-integral-operation.html</a><br>
-class PointerAndIntegralOperationChe<wbr>ck : public ClangTidyCheck {<br>
-public:<br>
-  PointerAndIntegralOperationChe<wbr>ck(StringRef Name, ClangTidyContext *Context)<br>
-      : ClangTidyCheck(Name, Context) {}<br>
-  void registerMatchers(ast_matchers:<wbr>:MatchFinder *Finder) override;<br>
-  void check(const ast_matchers::MatchFinder::Mat<wbr>chResult &Result) override;<br>
-};<br>
-<br>
-} // namespace misc<br>
-} // namespace tidy<br>
-} // namespace clang<br>
-<br>
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_T<wbr>IDY_MISC_POINTER_AND_INTEGRAL_<wbr>OPERATION_H<br>
<br>
Modified: clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=284888&r1=284887&r2=284888&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>docs/clang-tidy/checks/list.<wbr>rst?rev=284888&r1=284887&r2=<wbr>284888&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst (original)<br>
+++ clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/list.rst Fri Oct 21 16:50:28 2016<br>
@@ -74,7 +74,6 @@ Clang-Tidy Checks<br>
    misc-new-delete-overloads<br>
    misc-noexcept-move-constructor<br>
    misc-non-copyable-objects<br>
-   misc-pointer-and-integral-ope<wbr>ration<br>
    misc-redundant-expression<br>
    misc-sizeof-container<br>
    misc-sizeof-expression<br>
<br>
Removed: clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/misc-pointer-<wbr>and-integral-operation.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-pointer-and-integral-operation.rst?rev=284887&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>docs/clang-tidy/checks/misc-<wbr>pointer-and-integral-operation<wbr>.rst?rev=284887&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/misc-pointer-<wbr>and-integral-operation.rst (original)<br>
+++ clang-tools-extra/trunk/docs/c<wbr>lang-tidy/checks/misc-pointer-<wbr>and-integral-operation.rst (removed)<br>
@@ -1,24 +0,0 @@<br>
-.. title:: clang-tidy - misc-pointer-and-integral-oper<wbr>ation<br>
-<br>
-misc-pointer-and-integral-ope<wbr>ration<br>
-=============================<wbr>======<br>
-<br>
-Looks for operation involving pointers and integral types. A common mistake is<br>
-to forget to dereference a pointer. These errors may be detected when a pointer<br>
-object is compare to an object with integral type.<br>
-<br>
-Examples:<br>
-<br>
-.. code-block:: c++<br>
-<br>
-  char* ptr;<br>
-  if ((ptr = malloc(...)) < nullptr)   // Pointer comparison with operator '<'<br>
-    ...                                // Should probably be '!='<br>
-<br>
-  if (ptr == '\0')   // Should probably be *ptr<br>
-    ...<br>
-<br>
-  void Process(std::string path, bool* error) {<br>
-    [...]<br>
-    if (error != false)  // Should probably be *error<br>
-      ...<br>
<br>
Removed: clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation-cxx98.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-pointer-and-integral-operation-cxx98.cpp?rev=284887&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>test/clang-tidy/misc-pointer-<wbr>and-integral-operation-cxx98.<wbr>cpp?rev=284887&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation-cxx98.cpp (original)<br>
+++ clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation-cxx98.cpp (removed)<br>
@@ -1,45 +0,0 @@<br>
-// RUN: %check_clang_tidy %s misc-pointer-and-integral-oper<wbr>ation %t -- -- -std=c++98<br>
-<br>
-bool* pb;<br>
-char* pc;<br>
-int* pi;<br>
-<br>
-int Test() {<br>
-  pb = false;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: suspicious assignment from bool to pointer [misc-pointer-and-integral-ope<wbr>ration]<br>
-  pc = '\0';<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: suspicious assignment from char to pointer<br>
-<br>
-  pb = (false?false:false);<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: suspicious assignment from bool to pointer<br>
-  pb = (4 != 5?false:false);<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: suspicious assignment from bool to pointer<br>
-<br>
-  if (pb < false) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and bool literal<br>
-  if (pb != false) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and bool literal<br>
-  if (pc < '\0') return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and character literal<br>
-  if (pc != '\0') return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and character literal<br>
-  if (pi < '\0') return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and character literal<br>
-  if (pi != '\0') return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious operation between pointer and character literal<br>
-<br>
-  return 1;<br>
-}<br>
-<br>
-int Valid() {<br>
-  *pb = false;<br>
-  *pc = '\0';<br>
-<br>
-  pb += 0;<br>
-  pc += 0;<br>
-  pi += 0;<br>
-<br>
-  pb += (pb != 0);<br>
-  pc += (pc != 0);<br>
-  pi += (pi != 0);<br>
-}<br>
<br>
Removed: clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-pointer-and-integral-operation.cpp?rev=284887&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/clang-tools-extra/trunk/<wbr>test/clang-tidy/misc-pointer-<wbr>and-integral-operation.cpp?<wbr>rev=284887&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation.cpp (original)<br>
+++ clang-tools-extra/trunk/test/c<wbr>lang-tidy/misc-pointer-and-int<wbr>egral-operation.cpp (removed)<br>
@@ -1,30 +0,0 @@<br>
-// RUN: %check_clang_tidy %s misc-pointer-and-integral-oper<wbr>ation %t<br>
-<br>
-bool* pb;<br>
-char* pc;<br>
-int* pi;<br>
-<br>
-int Test() {<br>
-  if (pi < 0) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious comparison of pointer with zero [misc-pointer-and-integral-ope<wbr>ration]<br>
-  if (pi <= 0) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious comparison of pointer with zero<br>
-<br>
-  if (nullptr <= pb) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: suspicious comparison of pointer with null<br>
-  if (pc < nullptr) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious comparison of pointer with null<br>
-  if (pi > nullptr) return 0;<br>
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious comparison of pointer with null<br>
-<br>
-  return 1;<br>
-}<br>
-<br>
-int Valid() {<br>
-  *pb = false;<br>
-  *pc = '\0';<br>
-<br>
-  pi += (pi != nullptr);<br>
-  pi -= (pi == nullptr);<br>
-  pc += (pb != nullptr);<br>
-}<br>
<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>