brintos

brintos / llvm-project-archived public Read only

0
0
Text · 687 B · 0ef4e0c Raw
23 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s2 3// expected-no-diagnostics4 5#include "Inputs/no-store-suppression.h"6 7using namespace std;8 9namespace value_uninitialized_after_stream_shift {10void use(char c);11 12// Technically, it is absolutely necessary to check the status of cin after13// read before using the value that just read from it. Practically, we don't14// really care unless we eventually come up with a special security check15// for just that purpose. Static Analyzer shouldn't be yelling at every person's16// third program in their C++ 101.17void foo() {18  char c;19  std::cin >> c;20  use(c); // no-warning21}22} // namespace value_uninitialized_after_stream_shift23