28 bool onlyPrivateGlobals) {
37 if (!
usage->isDead(*varDecl.var())) {
41 usage->remove(&varDecl);
48 bool onlyPrivateGlobals) {
53 size_t numElements = module.
fElements.size();
57 [&](
const std::unique_ptr<ProgramElement>& pe) {
58 return isDeadVariable(*pe);
62 return module.
fElements.size() < numElements;
72 if (program.
fConfig->fSettings.fRemoveDeadVariables) {
75 [&](
const std::unique_ptr<ProgramElement>& pe) {
76 return isDeadVariable(*pe);
82 return isDeadVariable(*pe);
VarDeclaration & varDeclaration()
static bool is_dead_variable(const ProgramElement &element, ProgramUsage *usage, bool onlyPrivateGlobals)
constexpr bool starts_with(std::string_view str, std::string_view prefix)
static void usage(char *argv0)
std::vector< std::unique_ptr< ProgramElement > > fElements
ProgramSettings fSettings
bool fRemoveDeadVariables
std::vector< std::unique_ptr< ProgramElement > > fOwnedElements
std::unique_ptr< ProgramUsage > fUsage
std::vector< const ProgramElement * > fSharedElements
std::unique_ptr< ProgramConfig > fConfig