smatch_param_limit: extra: store parameter implications in return_states
[smatch.git] / smatch_scripts / db / fill_db_no_side_effects.pl
blob213ab238234fc68089db6dc8d8700375ec84cd76
1 #!/usr/bin/perl -w
3 use strict;
4 use DBI;
6 my $warns = shift;
8 if (!defined($warns)) {
9 print "usage: $0 <warns.txt>\n";
10 exit(1);
13 my $db = DBI->connect("dbi:SQLite:smatch_db.sqlite", "", "", {AutoCommit => 0});
14 $db->do("PRAGMA synchronous = OFF");
15 $db->do("PRAGMA cache_size = 800000");
16 $db->do("PRAGMA journal_mode = OFF");
18 $db->do("delete from no_side_effects;");
20 my ($file_and_line, $file, $func, $gs, $static, $dummy);
22 open(WARNS, "<$warns");
23 while (<WARNS>) {
24 # info: no_side_effects
25 if (!($_ =~ /info: no_side_effects /)) {
26 next;
29 ($file_and_line, $func, $dummy, $dummy, $gs) = split(/ /, $_);
30 ($file, $dummy) = split(/:/, $file_and_line);
31 $func =~ s/\(\)//;
33 $static = 0;
34 if ($gs =~ /static/) {
35 $static = 1;
38 $db->do("insert into no_side_effects values ('$file', '$func', $static)");
40 $db->commit();
41 $db->disconnect();