Clang Project

clang_source_code/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp
1// Faking std::call_once implementation.
2namespace std {
3typedef struct once_flag_s {
4  int _M_once = 0;
5} once_flag;
6
7template <class Callable, class... Args>
8void call_once(once_flag &o, Callable&& func, Args&&... args);
9} // namespace std
10
11int deref(int *x) {
12  return *x;
13}
14
15void call_deref_once() {
16  static std::once_flag once;
17  int *p = nullptr;
18  std::call_once(once, &deref, p);
19}
20
21
22// RUN: rm -rf %t.output
23// RUN: %clang_analyze_cc1 -std=c++11 -analyze -analyzer-checker=core -analyzer-output html -o %t.output %s
24// RUN: cat %t.output/* | FileCheck %s --match-full-lines
25// CHECK: var relevant_lines = {"1": {"3": 1,  "8": 1, "11": 1, "12": 1, "15": 1, "16": 1, "17": 1, "18": 1}};
26