diff options
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp')
| -rw-r--r-- | lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp index 5353310e6d5a9..38d2aa6d8f9de 100644 --- a/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp @@ -7,7 +7,7 @@  //  //===----------------------------------------------------------------------===//  // -// This defines UndefResultChecker, a builtin check in ExprEngine that  +// This defines UndefResultChecker, a builtin check in ExprEngine that  // performs checks for undefined results of non-assignment binary operators.  //  //===----------------------------------------------------------------------===// @@ -25,7 +25,7 @@ using namespace clang;  using namespace ento;  namespace { -class UndefResultChecker  +class UndefResultChecker    : public Checker< check::PostStmt<BinaryOperator> > {    mutable std::unique_ptr<BugType> BT; @@ -50,10 +50,10 @@ void UndefResultChecker::checkPostStmt(const BinaryOperator *B,          return;      // Generate an error node. -    ExplodedNode *N = C.generateSink(); +    ExplodedNode *N = C.generateErrorNode();      if (!N)        return; -     +      if (!BT)        BT.reset(            new BuiltinBug(this, "Result of operation is garbage or undefined")); @@ -62,7 +62,7 @@ void UndefResultChecker::checkPostStmt(const BinaryOperator *B,      llvm::raw_svector_ostream OS(sbuf);      const Expr *Ex = nullptr;      bool isLeft = true; -     +      if (state->getSVal(B->getLHS(), LCtx).isUndef()) {        Ex = B->getLHS()->IgnoreParenCasts();        isLeft = true; @@ -71,13 +71,13 @@ void UndefResultChecker::checkPostStmt(const BinaryOperator *B,        Ex = B->getRHS()->IgnoreParenCasts();        isLeft = false;      } -     +      if (Ex) {        OS << "The " << (isLeft ? "left" : "right")           << " operand of '"           << BinaryOperator::getOpcodeStr(B->getOpcode())           << "' is a garbage value"; -    }           +    }      else {        // Neither operand was undefined, but the result is undefined.        OS << "The result of the '" @@ -91,7 +91,7 @@ void UndefResultChecker::checkPostStmt(const BinaryOperator *B,      }      else        bugreporter::trackNullOrUndefValue(N, B, *report); -     +      C.emitReport(std::move(report));    }  }  | 
