Mercurial > hg > CbC > CbC_llvm
comparison clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp @ 173:0572611fdcc8 llvm10 llvm12
reorgnization done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 11:55:54 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
172:9fbae9c8bf63 | 173:0572611fdcc8 |
---|---|
25 hasType(decltypeType(hasUnderlyingType(pointerType())))); | 25 hasType(decltypeType(hasUnderlyingType(pointerType())))); |
26 | 26 |
27 // Flag all operators +, -, +=, -=, ++, -- that result in a pointer | 27 // Flag all operators +, -, +=, -=, ++, -- that result in a pointer |
28 Finder->addMatcher( | 28 Finder->addMatcher( |
29 binaryOperator( | 29 binaryOperator( |
30 anyOf(hasOperatorName("+"), hasOperatorName("-"), | 30 hasAnyOperatorName("+", "-", "+=", "-="), AllPointerTypes, |
31 hasOperatorName("+="), hasOperatorName("-=")), | |
32 AllPointerTypes, | |
33 unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit())))))) | 31 unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit())))))) |
34 .bind("expr"), | 32 .bind("expr"), |
35 this); | 33 this); |
36 | 34 |
37 Finder->addMatcher( | 35 Finder->addMatcher( |
38 unaryOperator(anyOf(hasOperatorName("++"), hasOperatorName("--")), | 36 unaryOperator(hasAnyOperatorName("++", "--"), hasType(pointerType())) |
39 hasType(pointerType())) | |
40 .bind("expr"), | 37 .bind("expr"), |
41 this); | 38 this); |
42 | 39 |
43 // Array subscript on a pointer (not an array) is also pointer arithmetic | 40 // Array subscript on a pointer (not an array) is also pointer arithmetic |
44 Finder->addMatcher( | 41 Finder->addMatcher( |