Skip to content

Commit a6da216

Browse files
author
Daniel Kroening
committed
deprecate a split_string variant
This deprecates the variant of split_string which uses a parameter to return the result. This is no longer appropriate since C++11's rvalue references.
1 parent c725d86 commit a6da216

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/goto-harness/memory_snapshot_harness_generator.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ void memory_snapshot_harness_generatort::handle_option(
9090
}
9191
else if(option == MEMORY_SNAPSHOT_HARNESS_HAVOC_VARIABLES_OPT)
9292
{
93-
std::vector<std::string> havoc_candidates;
94-
split_string(values.front(), ',', havoc_candidates, true);
93+
std::vector<std::string> havoc_candidates =
94+
split_string(values.front(), ',', true);
9595
for(const auto &candidate : havoc_candidates)
9696
{
9797
variables_to_havoc.insert(candidate);
@@ -431,8 +431,7 @@ memory_snapshot_harness_generatort::entry_goto_locationt
431431
memory_snapshot_harness_generatort::parse_goto_location(
432432
const std::string &cmdl_option)
433433
{
434-
std::vector<std::string> start;
435-
split_string(cmdl_option, ':', start, true);
434+
std::vector<std::string> start = split_string(cmdl_option, ':', true);
436435

437436
if(
438437
start.empty() || start.front().empty() ||

src/goto-instrument/splice_call.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ static bool parse_caller_callee(
3131
const std::string &callercallee,
3232
std::vector<std::string> &result)
3333
{
34-
split_string(callercallee, ',', result);
35-
return (result.size()!= 2);
34+
result = split_string(callercallee, ',');
35+
return result.size() != 2;
3636
}
3737

3838
bool splice_call(

src/util/string_utils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Author: Daniel Poetzl
1010
#ifndef CPROVER_UTIL_STRING_UTILS_H
1111
#define CPROVER_UTIL_STRING_UTILS_H
1212

13+
#include "deprecate.h"
14+
1315
#include <iosfwd>
1416
#include <string>
1517
#include <vector>
@@ -26,6 +28,11 @@ std::string strip_string(const std::string &s);
2628
/// \param remove_empty: If true, all empty-string elements will be removed.
2729
/// This is applied after strip so whitespace only elements will be removed if
2830
/// both are set to true.
31+
DEPRECATED(SINCE(
32+
2019,
33+
11,
34+
14,
35+
"use split_string(s, delim, strip, remove_empty) instead"))
2936
void split_string(
3037
const std::string &s,
3138
char delim,

0 commit comments

Comments
 (0)