File tree 3 files changed +12
-3
lines changed
regression/crangler/remove-static
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ int foo()
5
5
6
6
int bar ();
7
7
8
+ static void foobar2 ();
9
+
8
10
static void foobar1 ()
9
11
{
10
12
}
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ remove_static1.json
6
6
^EXIT=0$
7
7
^SIGNAL=0$
8
8
--
9
+ static\s+(void\s+)?foobar[12]\(\)$
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ static void mangle_function(
368
368
const c_wranglert::functiont &function_config,
369
369
std::ostream &out)
370
370
{
371
- if (function_config.stub .has_value ())
371
+ if (function_config.stub .has_value () && declaration. has_body () )
372
372
{
373
373
// replace by stub
374
374
out << function_config.stub .value ();
@@ -399,6 +399,13 @@ static void mangle_function(
399
399
for (auto &t : declaration.post_declarator )
400
400
out << t.text ;
401
401
402
+ if (!declaration.has_body ())
403
+ {
404
+ for (auto &t : declaration.initializer )
405
+ out << t.text ;
406
+ return ;
407
+ }
408
+
402
409
for (const auto &entry : function_config.contract )
403
410
out << ' ' << CPROVER_PREFIX << entry.clause << ' ('
404
411
<< defines (entry.content ) << ' )' ;
@@ -498,8 +505,7 @@ static void mangle(
498
505
std::ostream &out)
499
506
{
500
507
auto name_opt = declaration.declared_identifier ();
501
- if (
502
- declaration.is_function () && name_opt.has_value () && declaration.has_body ())
508
+ if (declaration.is_function () && name_opt.has_value ())
503
509
{
504
510
for (const auto &entry : config.functions )
505
511
{
You can’t perform that action at this time.
0 commit comments