xref: /llvm-project/clang/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp (revision e4d242768aefabc0091dd01fabecaffbc2b6984b)
1 // Faking std::call_once implementation.
2 namespace std {
3 typedef struct once_flag_s {
4   int _M_once = 0;
5 } once_flag;
6 
7 template <class Callable, class... Args>
8 void call_once(once_flag &o, Callable&& func, Args&&... args);
9 } // namespace std
10 
deref(int * x)11 int deref(int *x) {
12   return *x;
13 }
14 
call_deref_once()15 void 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 -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