summaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp54
1 files changed, 1 insertions, 53 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
index 4717fef963410..5833eea56da88 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
@@ -30,11 +30,6 @@ class DebugIteratorModeling
std::unique_ptr<BugType> DebugMsgBugType;
template <typename Getter>
- void analyzerContainerDataField(const CallExpr *CE, CheckerContext &C,
- Getter get) const;
- void analyzerContainerBegin(const CallExpr *CE, CheckerContext &C) const;
- void analyzerContainerEnd(const CallExpr *CE, CheckerContext &C) const;
- template <typename Getter>
void analyzerIteratorDataField(const CallExpr *CE, CheckerContext &C,
Getter get, SVal Default) const;
void analyzerIteratorPosition(const CallExpr *CE, CheckerContext &C) const;
@@ -46,10 +41,6 @@ class DebugIteratorModeling
CheckerContext &) const;
CallDescriptionMap<FnCheck> Callbacks = {
- {{0, "clang_analyzer_container_begin", 1},
- &DebugIteratorModeling::analyzerContainerBegin},
- {{0, "clang_analyzer_container_end", 1},
- &DebugIteratorModeling::analyzerContainerEnd},
{{0, "clang_analyzer_iterator_position", 1},
&DebugIteratorModeling::analyzerIteratorPosition},
{{0, "clang_analyzer_iterator_container", 1},
@@ -87,49 +78,6 @@ bool DebugIteratorModeling::evalCall(const CallEvent &Call,
}
template <typename Getter>
-void DebugIteratorModeling::analyzerContainerDataField(const CallExpr *CE,
- CheckerContext &C,
- Getter get) const {
- if (CE->getNumArgs() == 0) {
- reportDebugMsg("Missing container argument", C);
- return;
- }
-
- auto State = C.getState();
- const MemRegion *Cont = C.getSVal(CE->getArg(0)).getAsRegion();
- if (Cont) {
- const auto *Data = getContainerData(State, Cont);
- if (Data) {
- SymbolRef Field = get(Data);
- if (Field) {
- State = State->BindExpr(CE, C.getLocationContext(),
- nonloc::SymbolVal(Field));
- C.addTransition(State);
- return;
- }
- }
- }
-
- auto &BVF = C.getSValBuilder().getBasicValueFactory();
- State = State->BindExpr(CE, C.getLocationContext(),
- nonloc::ConcreteInt(BVF.getValue(llvm::APSInt::get(0))));
-}
-
-void DebugIteratorModeling::analyzerContainerBegin(const CallExpr *CE,
- CheckerContext &C) const {
- analyzerContainerDataField(CE, C, [](const ContainerData *D) {
- return D->getBegin();
- });
-}
-
-void DebugIteratorModeling::analyzerContainerEnd(const CallExpr *CE,
- CheckerContext &C) const {
- analyzerContainerDataField(CE, C, [](const ContainerData *D) {
- return D->getEnd();
- });
-}
-
-template <typename Getter>
void DebugIteratorModeling::analyzerIteratorDataField(const CallExpr *CE,
CheckerContext &C,
Getter get,
@@ -191,6 +139,6 @@ void ento::registerDebugIteratorModeling(CheckerManager &mgr) {
mgr.registerChecker<DebugIteratorModeling>();
}
-bool ento::shouldRegisterDebugIteratorModeling(const LangOptions &LO) {
+bool ento::shouldRegisterDebugIteratorModeling(const CheckerManager &mgr) {
return true;
}