Exemplo n.º 1
0
void lowerErrorHandling() {
  if (!fMinimalModules)
    INT_ASSERT(dtError->inTree());

  forv_Vec(FnSymbol, fn, gFnSymbols) {
    // Determine if compiler-generated fns should be marked 'throws'
    if (fn->hasFlag(FLAG_ON)) {
      if (canBlockThrow(fn->body))
        fn->throwsErrorInit();
    } else {
      // Otherwise, just check for error-handling errors.
      checkErrorHandling(fn);
    }
  }

  // Quit if fatal errors were encountered by checkErrorHandling above.
  USR_STOP();

  forv_Vec(FnSymbol, fn, gFnSymbols) {
    ArgSymbol*   outError = NULL;
    LabelSymbol* epilogue = NULL;

    if (fn->throwsError()) {
      SET_LINENO(fn);

      outError = new ArgSymbol(INTENT_REF, "error_out", dtError);
      fn->insertFormalAtTail(outError);

      epilogue = fn->getOrCreateEpilogueLabel();
      INT_ASSERT(epilogue); // throws requires an epilogue
    }

    ErrorHandlingVisitor visitor = ErrorHandlingVisitor(outError, epilogue);
    fn->accept(&visitor);
  }
Exemplo n.º 2
0
void runPasses(PhaseTracker& tracker, bool isChpldoc) {
  size_t passListSize = sizeof(sPassList) / sizeof(sPassList[0]);

  setupLogfiles();

  if (printPasses == true || printPassesFile != 0) {
    tracker.ReportPass();
  }

  for (size_t i = 0; i < passListSize; i++) {
    runPass(tracker, i);

    USR_STOP(); // quit if fatal errors were encountered in pass

    currentPassNo++;

    // Break early if this is a chpl doc run
    if (isChpldoc == true && strcmp(sPassList[i].name, "docs") == 0) {
      break;
    }
  }

  destroyAst();
  teardownLogfiles();
}
Exemplo n.º 3
0
void checkConfigs() {
  if (fMinimalModules == false && fUseIPE == false) {
    bool             anyBadConfigParams = false;
    Vec<const char*> configParamSetNames;

    configMap.get_keys(configParamSetNames);

    forv_Vec(const char, name, configParamSetNames) {
      if (!usedConfigParams.in(name)) {
        USR_FATAL_CONT("Trying to set unrecognized config param '%s' via -s flag", name);
        anyBadConfigParams = true;
      }
    }

    if (anyBadConfigParams) {
      USR_STOP();
    }
  }
Exemplo n.º 4
0
void runPasses(void) {
  setupLogfiles();
  PassInfo* pass = passlist+1;  // skip over FIRST
  bool chpldoc = strcmp(chplBinaryName, "chpldoc") == 0;
  if (chpldoc) 
    fDocs = true;
  while (pass->name != NULL) {
    advanceCurrentPass(pass->name);
    runPass(pass->name, pass->pass_fn, pass->check_fn, pass->log_tag);
    USR_STOP(); // quit if fatal errors were encountered in pass
    if (chpldoc && (strcmp(pass->name, "docs") == 0)) {
      break;
    }
    pass++;
  }
  advanceCurrentPass("finishing up");
  destroyAst();
  teardownLogfiles();
}