From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- .../Checkers/DebugIteratorModeling.cpp | 54 +--------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp') diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp index 4717fef96341..5833eea56da8 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp @@ -29,11 +29,6 @@ class DebugIteratorModeling std::unique_ptr DebugMsgBugType; - template - 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 void analyzerIteratorDataField(const CallExpr *CE, CheckerContext &C, Getter get, SVal Default) const; @@ -46,10 +41,6 @@ class DebugIteratorModeling CheckerContext &) const; CallDescriptionMap 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}, @@ -86,49 +77,6 @@ bool DebugIteratorModeling::evalCall(const CallEvent &Call, return true; } -template -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 void DebugIteratorModeling::analyzerIteratorDataField(const CallExpr *CE, CheckerContext &C, @@ -191,6 +139,6 @@ void ento::registerDebugIteratorModeling(CheckerManager &mgr) { mgr.registerChecker(); } -bool ento::shouldRegisterDebugIteratorModeling(const LangOptions &LO) { +bool ento::shouldRegisterDebugIteratorModeling(const CheckerManager &mgr) { return true; } -- cgit v1.2.3