aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/getline-cpp.cpp
blob: ef9d3186009c7fa4920368f7ab27910562d71acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,debug.ExprInspection -verify %s

// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,alpha.unix,debug.ExprInspection -verify %s
//
// expected-no-diagnostics

#include "Inputs/system-header-simulator-cxx.h"

void test_std_getline() {
  std::string userid, comment;
  // MallocChecker should not confuse the POSIX function getline() and the
  // unrelated C++ standard library function std::getline.
  std::getline(std::cin, userid, ' '); // no-crash
  std::getline(std::cin, comment); // no-crash
}