-
Notifications
You must be signed in to change notification settings - Fork 274
Replace owning raw pointers #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+428
−337
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,14 @@ Author: Daniel Kroening, [email protected] | |
#ifndef CPROVER_ANALYSES_AI_H | ||
#define CPROVER_ANALYSES_AI_H | ||
|
||
#include <map> | ||
#include <iosfwd> | ||
#include <map> | ||
#include <memory> | ||
|
||
#include <util/json.h> | ||
#include <util/xml.h> | ||
#include <util/expr.h> | ||
#include <util/make_unique.h> | ||
|
||
#include <goto-programs/goto_model.h> | ||
|
||
|
@@ -334,7 +336,7 @@ class ai_baset | |
const namespacet &ns)=0; | ||
virtual statet &get_state(locationt l)=0; | ||
virtual const statet &find_state(locationt l) const=0; | ||
virtual statet* make_temporary_state(const statet &s)=0; | ||
virtual std::unique_ptr<statet> make_temporary_state(const statet &s)=0; | ||
}; | ||
|
||
// domainT is expected to be derived from ai_domain_baseT | ||
|
@@ -400,9 +402,9 @@ class ait:public ai_baset | |
static_cast<const domainT &>(src), from, to); | ||
} | ||
|
||
statet *make_temporary_state(const statet &s) override | ||
std::unique_ptr<statet> make_temporary_state(const statet &s) override | ||
{ | ||
return new domainT(static_cast<const domainT &>(s)); | ||
return util_make_unique<domainT>(static_cast<const domainT &>(s)); | ||
} | ||
|
||
void fixedpoint( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,11 @@ Author: Daniel Kroening, [email protected] | |
#ifndef CPROVER_ANALYSES_LOCAL_MAY_ALIAS_H | ||
#define CPROVER_ANALYSES_LOCAL_MAY_ALIAS_H | ||
|
||
#include <stack> | ||
#include <memory> | ||
#include <stack> | ||
|
||
#include <util/union_find.h> | ||
#include <util/make_unique.h> | ||
|
||
#include "locals.h" | ||
#include "dirty.h" | ||
|
@@ -117,8 +118,7 @@ class local_may_alias_factoryt | |
goto_functionst::function_mapt::const_iterator f_it2= | ||
goto_functions->function_map.find(fkt); | ||
assert(f_it2!=goto_functions->function_map.end()); | ||
return *(fkt_map[fkt]=std::unique_ptr<local_may_aliast>( | ||
new local_may_aliast(f_it2->second))); | ||
return *(fkt_map[fkt]=util_make_unique<local_may_aliast>(f_it2->second)); | ||
} | ||
|
||
local_may_aliast &operator()(goto_programt::const_targett t) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,13 @@ Author: Daniel Kroening, [email protected] | |
#error Deprecated, use ai.h instead | ||
#endif | ||
|
||
#include <map> | ||
#include <iosfwd> | ||
#include <map> | ||
#include <memory> | ||
#include <unordered_set> | ||
|
||
#include <util/make_unique.h> | ||
|
||
#include <goto-programs/goto_functions.h> | ||
|
||
// don't use me -- I am just a base class | ||
|
@@ -252,7 +255,7 @@ class static_analysis_baset | |
virtual void generate_state(locationt l)=0; | ||
virtual statet &get_state(locationt l)=0; | ||
virtual const statet &get_state(locationt l) const=0; | ||
virtual statet* make_temporary_state(statet &s)=0; | ||
virtual std::unique_ptr<statet> make_temporary_state(statet &s)=0; | ||
|
||
typedef domain_baset::expr_sett expr_sett; | ||
|
||
|
@@ -331,9 +334,9 @@ class static_analysist:public static_analysis_baset | |
return static_cast<T &>(a).merge(static_cast<const T &>(b), to); | ||
} | ||
|
||
virtual statet *make_temporary_state(statet &s) | ||
virtual std::unique_ptr<statet> make_temporary_state(statet &s) | ||
{ | ||
return new T(static_cast<T &>(s)); | ||
return util_make_unique<T>(static_cast<T &>(s)); | ||
} | ||
|
||
virtual void generate_state(locationt l) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,12 @@ Author: Daniel Kroening, [email protected] | |
#ifndef CPROVER_ANSI_C_ANSI_C_LANGUAGE_H | ||
#define CPROVER_ANSI_C_ANSI_C_LANGUAGE_H | ||
|
||
/*! \defgroup gr_ansi_c ANSI-C front-end */ | ||
|
||
#include <memory> | ||
|
||
#include <util/language.h> | ||
#include <util/make_unique.h> | ||
|
||
#include "ansi_c_parse_tree.h" | ||
|
||
|
@@ -59,8 +64,8 @@ class ansi_c_languaget:public languaget | |
exprt &expr, | ||
const namespacet &ns) override; | ||
|
||
languaget *new_language() override | ||
{ return new ansi_c_languaget; } | ||
std::unique_ptr<languaget> new_language() override | ||
{ return util_make_unique<ansi_c_languaget>(); } | ||
|
||
std::string id() const override { return "C"; } | ||
std::string description() const override { return "ANSI-C 99"; } | ||
|
@@ -73,6 +78,6 @@ class ansi_c_languaget:public languaget | |
std::string parse_path; | ||
}; | ||
|
||
languaget *new_ansi_c_language(); | ||
std::unique_ptr<languaget> new_ansi_c_language(); | ||
|
||
#endif // CPROVER_ANSI_C_ANSI_C_LANGUAGE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself: no idea why I've used
string_hash
instead ofirep_id_hash
here. I'll git grep and cleanup, no need for you to make any changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget about that one, btw, it's for the
!USE_DSTRING
case, and thus makes sense.