File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
regression/cbmc-cover/location2 Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1+ #include <string.h>
2+
3+ #define BUFLEN 100
4+
5+ static void * (* const volatile memset_func )(void * , int , size_t ) = memset ;
6+
7+ int main ()
8+ {
9+ char buffer [BUFLEN ];
10+ memset_func (& buffer , 0 , BUFLEN );
11+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --cover location
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^\[main.coverage.1\] file main.c line 9 function main block 1 \(lines main.c:main:9,10\): SATISFIED$
7+ ^\[main.coverage.2\] file main.c line 11 function main block 2 \(lines main.c:main:11\): SATISFIED$
8+ ^\*\* 2 of 2 covered \(100.0%\)
9+ --
10+ ^warning: ignoring
11+ main.c::5
12+ --
13+ Expressions outside a function should not end up listed as part of source code
14+ blocks.
Original file line number Diff line number Diff line change @@ -163,8 +163,11 @@ void cover_basic_blockst::add_block_lines(
163163 }
164164 };
165165 add_location (instruction.source_location ());
166- instruction.get_code ().visit_pre (
167- [&](const exprt &expr) { add_location (expr.source_location ()); });
166+ instruction.get_code ().visit_pre ([&](const exprt &expr) {
167+ const auto &location = expr.source_location ();
168+ if (!location.get_function ().empty ())
169+ add_location (location);
170+ });
168171}
169172
170173cover_basic_blocks_javat::cover_basic_blocks_javat (
You can’t perform that action at this time.
0 commit comments