summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-09-07 00:43:17 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-09-07 00:43:17 +0000
commit55e3d1ec353a5849a0c3da72faa44cec6d528dfa (patch)
treeaf36bc77bf3c821a4485ab26955d7ecf93a1ed7a /clang/test
parent5f8d361c9cb718a1001d52442bdf88cd046b6174 (diff)
downloadbcm5719-llvm-55e3d1ec353a5849a0c3da72faa44cec6d528dfa.tar.gz
bcm5719-llvm-55e3d1ec353a5849a0c3da72faa44cec6d528dfa.zip
[analyzer] Do not add invalid source location to the coverage information
Invalid source locations may arise from generated code. Differential Revision: https://reviews.llvm.org/D51761 llvm-svn: 341618
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp b/clang/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp
new file mode 100644
index 00000000000..a4e30e3c9af
--- /dev/null
+++ b/clang/test/Analysis/html_diagnostics/relevant_lines/synthesized_body.cpp
@@ -0,0 +1,25 @@
+// Faking std::call_once implementation.
+namespace std {
+typedef struct once_flag_s {
+ int _M_once = 0;
+} once_flag;
+
+template <class Callable, class... Args>
+void call_once(once_flag &o, Callable&& func, Args&&... args);
+} // namespace std
+
+int deref(int *x) {
+ return *x;
+}
+
+void call_deref_once() {
+ static std::once_flag once;
+ int *p = nullptr;
+ std::call_once(once, &deref, p);
+}
+
+
+// RUN: rm -rf %t.output
+// RUN: %clang_analyze_cc1 -analyze -analyzer-checker=core -analyzer-output html -o %t.output %s
+// RUN: cat %t.output/* | FileCheck %s --match-full-lines
+// CHECK: var relevant_lines = {"1": {"3": 1, "8": 1, "11": 1, "12": 1, "15": 1, "16": 1, "17": 1, "18": 1}};
OpenPOWER on IntegriCloud