#include "findTypeVariables.h"
#include "type.h"
#include "symbol.h"
#include "symtab.h"

FindVariableType::FindVariableType(Vec<VariableType*>* init_variableTypes) {
  variableTypes = init_variableTypes;
}

void FindVariableType::preProcessSymbol(Symbol* symbol) {
  if (dynamic_cast<TypeSymbol*>(symbol)) {
    forv_Vec(VariableType, variableType, *variableTypes) {
      if (variableType == symbol->type) {
        found = true;
      }
    }
  }
}

void FindVariableType::preProcessType(Type* type) {
  if (dynamic_cast<VariableType*>(type)) {
    forv_Vec(VariableType, variableType, *variableTypes) {
      if (variableType == type) {
        found = true;
      }
    }
  }
}

bool functionContainsVariableType(FnSymbol* fn,
                                  Vec<VariableType*>* variableTypes) {
  FindVariableType* traversal = new FindVariableType(variableTypes);
  TRAVERSE(fn, traversal, true);
  return traversal->found;
}

#include "findTypeVariables.h"
#include "type.h"
#include "symbol.h"
#include "symtab.h"

FindVariableType::FindVariableType(Vec<VariableType*>* init_variableTypes) {
  found = false;
  variableTypes = init_variableTypes;
}

void FindVariableType::preProcessSymbol(Symbol* symbol) {
  if (dynamic_cast<TypeSymbol*>(symbol)) {
    forv_Vec(VariableType, variableType, *variableTypes) {
      if (variableType == symbol->type) {
        found = true;
      }
    }
  }
}

void FindVariableType::preProcessType(Type* type) {
  if (dynamic_cast<VariableType*>(type)) {
    forv_Vec(VariableType, variableType, *variableTypes) {
      if (variableType == type) {
        found = true;
      }
    }
  }
}

bool functionContainsVariableType(FnSymbol* fn,
                                  Vec<VariableType*>* variableTypes) {
  FindVariableType* traversal = new FindVariableType(variableTypes);
  TRAVERSE(fn, traversal, true);
  return traversal->found;
}

Fix uninitialized variable which was causing valgrind failures. (the "found" variable was not initialised to "false").
Fix uninitialized variable which was causing valgrind failures.
(the "found" variable was not initialised to "false").


git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@3054 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
