diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp index 21e8b107c9e..172ce346f1b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp @@ -137,6 +137,10 @@ void UndefResultChecker::checkPostStmt(const BinaryOperator *B, OS << " greater or equal to the width of type '" << B->getLHS()->getType().getAsString() << "'."; + } else if (B->getOpcode() == BinaryOperatorKind::BO_Shl && + C.isNegative(B->getLHS())) { + OS << "The result of the left shift is undefined because the left " + "operand is negative"; } else { OS << "The result of the '" << BinaryOperator::getOpcodeStr(B->getOpcode()) |

