diff options
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp')
| -rw-r--r-- | lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp index 7a31efc8cef8..c3dcf1fac197 100644 --- a/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp @@ -60,6 +60,14 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val,    const Expr *ex = nullptr;    while (StoreE) { +    if (const UnaryOperator *U = dyn_cast<UnaryOperator>(StoreE)) { +      str = "The expression is an uninitialized value. " +            "The computed value will also be garbage"; + +      ex = U->getSubExpr(); +      break; +    } +      if (const BinaryOperator *B = dyn_cast<BinaryOperator>(StoreE)) {        if (B->isCompoundAssignmentOp()) {          ProgramStateRef state = C.getState();  | 
