Debian Codegraph @

js/src/devtools/rootAnalysis/t/exceptions/test.py

raw
1 # flake8: noqa: F821
2
3 test.compile("source.cpp", "-fno-exceptions")
4 test.run_analysis_script("gcTypes")
5
6 hazards = test.load_hazards()
7 assert len(hazards) == 0
8
9 # If we compile with exceptions, then there *should* be a hazard because
10 # AutoSomething::AutoSomething might throw an exception, which would cause the
11 # partially-constructed value to be torn down, which will call ~RAII_GC.
12
13 test.compile("source.cpp", "-fexceptions")
14 test.run_analysis_script("gcTypes")
15
16 hazards = test.load_hazards()
17 assert len(hazards) == 1
18 hazard = hazards[0]
19 assert hazard.function == "void f()"
20 assert hazard.variable == "thing"
21 assert "AutoSomething::AutoSomething" in hazard.GCFunction