3 topfunc = re.compile(
"::(produce|analyze|filter|beginLuminosityBlock|beginRun)\(")
4 baseclass = re.compile(
"edm::(one::|stream::|global::)?ED(Producer|Filter|Analyzer)(Base)?")
5 farg = re.compile(
"\(.*\)")
8 skipfunc = re.compile(
"(edm::EDProductGetter::getIt|edm::Event::|edm::eventsetup::EventSetupRecord::get|edm::eventsetup::DataProxy::getImpl|edm::EventPrincipal::unscheduledFill|edm::ServiceRegistry::get|edm::eventsetup::EventSetupRecord::getImplementation|edm::eventsetup::EventSetupRecord::getFromProxy|edm::eventsetup::DataProxy::get)")
17 fields = line.split(
"'")
18 if fields[2] ==
' calls function ' :
19 if skipfunc.search(line) : skipfuncs.add(line)
20 else : G.add_edge(fields[1],fields[3],kind=fields[2])
21 if fields[2] ==
' overrides function ' :
22 if baseclass.search(fields[3]) :
23 if topfunc.search(fields[3]) : toplevelfuncs.add(fields[1])
24 G.add_edge(fields[1],fields[3],kind=
' overrides function ')
26 if skipfunc.search(line) : skipfuncs.add(line)
27 else : G.add_edge(fields[3],fields[1],kind=
' calls function ')
28 if fields[2] ==
' static variable ' :
29 G.add_edge(fields[1],fields[3],kind=
' static variable ')
30 statics.add(fields[3])
33 for static
in statics:
34 for tfunc
in toplevelfuncs:
35 if nx.has_path(G,tfunc,static):
36 path = nx.shortest_path(G,tfunc,static)
37 print "Non-const static variable \'"+re.sub(farg,
"()",static)+
"\' is accessed in call stack ",
40 print re.sub(farg,
"()",p)+
"; ",
42 for key
in G[tfunc].
keys() :
43 if 'kind' in G[tfunc][key]
and G[tfunc][key][
'kind'] ==
' overrides function ' :
44 print "'"+re.sub(farg,
"()",tfunc)+
"'"+G[tfunc][key][
'kind']+
"'"+re.sub(farg,
"()",key)+
"'",
46 path = nx.shortest_path(G,tfunc,static)
47 print "In call stack ' ",
49 print re.sub(farg,
"()",p)+
"; ",
51 print " non-const static variable \'"+re.sub(farg,
"()",static)+
"\' is accessed. ",
52 for key
in G[tfunc].
keys() :
53 if 'kind' in G[tfunc][key]
and G[tfunc][key][
'kind'] ==
' overrides function ' :
54 print "'"+re.sub(farg,
"()",tfunc)+
"'"+G[tfunc][key][
'kind']+
"'"+re.sub(farg,
"()",key)+
"'",