| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s |
| 2 |
|
| 3 |
// expected-no-diagnostics |
| 4 |
|
| 5 |
#include "Inputs/no-store-suppression.h" |
| 6 |
|
| 7 |
using namespace std; |
| 8 |
|
| 9 |
namespace value_uninitialized_after_stream_shift { |
| 10 |
void use(char c); |
| 11 |
|
| 12 |
// Technically, it is absolutely necessary to check the status of cin after |
| 13 |
// read before using the value that just read from it. Practically, we don't |
| 14 |
// really care unless we eventually come up with a special security check |
| 15 |
// for just that purpose. Static Analyzer shouldn't be yelling at every person's |
| 16 |
// third program in their C++ 101. |
| 17 |
void foo() { |
| 18 |
char c; |
| 19 |
std::cin >> c; |
| 20 |
use(c); // no-warning |
| 21 |
} |
| 22 |
} // namespace value_uninitialized_after_stream_shift |