Mercurial > hg > CbC > CbC_llvm
comparison clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
84 class StatefulChecker : public Checker<check::PreCall> { | 84 class StatefulChecker : public Checker<check::PreCall> { |
85 mutable std::unique_ptr<BugType> BT; | 85 mutable std::unique_ptr<BugType> BT; |
86 | 86 |
87 public: | 87 public: |
88 void checkPreCall(const CallEvent &Call, CheckerContext &C) const { | 88 void checkPreCall(const CallEvent &Call, CheckerContext &C) const { |
89 if (CallDescription{"preventError", 0}.matches(Call)) { | 89 if (CallDescription{{"preventError"}, 0}.matches(Call)) { |
90 C.addTransition(C.getState()->set<ErrorPrevented>(true)); | 90 C.addTransition(C.getState()->set<ErrorPrevented>(true)); |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 if (CallDescription{"allowError", 0}.matches(Call)) { | 94 if (CallDescription{{"allowError"}, 0}.matches(Call)) { |
95 C.addTransition(C.getState()->set<ErrorPrevented>(false)); | 95 C.addTransition(C.getState()->set<ErrorPrevented>(false)); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 if (CallDescription{"error", 0}.matches(Call)) { | 99 if (CallDescription{{"error"}, 0}.matches(Call)) { |
100 if (C.getState()->get<ErrorPrevented>()) | 100 if (C.getState()->get<ErrorPrevented>()) |
101 return; | 101 return; |
102 const ExplodedNode *N = C.generateErrorNode(); | 102 const ExplodedNode *N = C.generateErrorNode(); |
103 if (!N) | 103 if (!N) |
104 return; | 104 return; |