-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansi_c_parsert: construct with message handler
This both avoids an object of static lifetime as well as it fixes the (transitive) use of the deprecated messaget() constructor.
- Loading branch information
1 parent
1068770
commit d1d421c
Showing
7 changed files
with
48 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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 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,8 +10,6 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "c_storage_spec.h" | ||
|
||
ansi_c_parsert ansi_c_parser; | ||
|
||
ansi_c_id_classt ansi_c_parsert::lookup( | ||
const irep_idt &base_name, | ||
irep_idt &identifier, // output | ||
|
@@ -73,14 +71,6 @@ void ansi_c_parsert::add_tag_with_body(irept &tag) | |
} | ||
} | ||
|
||
extern char *yyansi_ctext; | ||
|
||
int yyansi_cerror(const std::string &error) | ||
{ | ||
ansi_c_parser.parse_error(error, yyansi_ctext); | ||
return 0; | ||
} | ||
|
||
void ansi_c_parsert::add_declarator( | ||
exprt &declaration, | ||
irept &declarator) | ||
|
This file contains 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 |
---|---|---|
|
@@ -18,15 +18,17 @@ Author: Daniel Kroening, [email protected] | |
#include "ansi_c_parse_tree.h" | ||
#include "ansi_c_scope.h" | ||
|
||
int yyansi_cparse(); | ||
class ansi_c_parsert; | ||
int yyansi_cparse(ansi_c_parsert &); | ||
|
||
class ansi_c_parsert:public parsert | ||
{ | ||
public: | ||
ansi_c_parse_treet parse_tree; | ||
|
||
ansi_c_parsert() | ||
: tag_following(false), | ||
explicit ansi_c_parsert(message_handlert &message_handler) | ||
: parsert(message_handler), | ||
tag_following(false), | ||
asm_block_following(false), | ||
parenthesis_counter(0), | ||
mode(modet::NONE), | ||
|
@@ -35,11 +37,14 @@ class ansi_c_parsert:public parsert | |
for_has_scope(false), | ||
ts_18661_3_Floatn_types(false) | ||
{ | ||
// set up global scope | ||
scopes.clear(); | ||
scopes.push_back(scopet()); | ||
} | ||
|
||
virtual bool parse() override | ||
{ | ||
return yyansi_cparse()!=0; | ||
return yyansi_cparse(*this) != 0; | ||
} | ||
|
||
virtual void clear() override | ||
|
@@ -166,9 +171,6 @@ class ansi_c_parsert:public parsert | |
std::list<std::map<const irep_idt, bool>> pragma_cprover_stack; | ||
}; | ||
|
||
extern ansi_c_parsert ansi_c_parser; | ||
|
||
int yyansi_cerror(const std::string &error); | ||
void ansi_c_scanner_init(); | ||
void ansi_c_scanner_init(ansi_c_parsert &); | ||
|
||
#endif // CPROVER_ANSI_C_ANSI_C_PARSER_H |
This file contains 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 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 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 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