Example #1
0
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
  SmallVector<char, 64> Buf;
  // FIXME: Flush the diagnostics in order.
  for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error,
                                       escapeDiag(it->second, Buf)));
  for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                                       escapeDiag(it->second, Buf)));
  for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Note,
                                       escapeDiag(it->second, Buf)));
}
Example #2
0
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
  // FIXME: Flush the diagnostics in order.
  for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error, "%0"))
        << it->second;
  for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Warning, "%0"))
        << it->second;
  for (const_iterator it = remark_begin(), ie = remark_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Remark, "%0"))
        << it->second;
  for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
    Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Note, "%0"))
        << it->second;
}
Example #3
0
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
                              const CodeGenOptions &CGOpts,
                              const clang::TargetOptions &TOpts,
                              const LangOptions &LOpts, const llvm::DataLayout &TDesc,
                              Module *M, BackendAction Action,
                              std::unique_ptr<raw_pwrite_stream> OS) {
  if (!CGOpts.ThinLTOIndexFile.empty()) {
    runThinLTOBackend(CGOpts, M, std::move(OS));
    return;
  }

  EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M);

  AsmHelper.EmitAssembly(Action, std::move(OS));

  // Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
  // DataLayout.
  if (AsmHelper.TM) {
    std::string DLDesc = M->getDataLayout().getStringRepresentation();
    if (DLDesc != TDesc.getStringRepresentation()) {
      unsigned DiagID = Diags.getCustomDiagID(
          DiagnosticsEngine::Error, "backend data layout '%0' does not match "
                                    "expected target description '%1'");
      Diags.Report(DiagID) << DLDesc << TDesc.getStringRepresentation();
    }
  }
}
Example #4
0
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
                              const HeaderSearchOptions &HeaderOpts,
                              const CodeGenOptions &CGOpts,
                              const clang::TargetOptions &TOpts,
                              const LangOptions &LOpts,
                              const llvm::DataLayout &TDesc, Module *M,
                              BackendAction Action,
                              std::unique_ptr<raw_pwrite_stream> OS) {
  if (!CGOpts.ThinLTOIndexFile.empty()) {
    // If we are performing a ThinLTO importing compile, load the function index
    // into memory and pass it into runThinLTOBackend, which will run the
    // function importer and invoke LTO passes.
    Expected<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
        llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile,
                                           /*IgnoreEmptyThinLTOIndexFile*/true);
    if (!IndexOrErr) {
      logAllUnhandledErrors(IndexOrErr.takeError(), errs(),
                            "Error loading index file '" +
                            CGOpts.ThinLTOIndexFile + "': ");
      return;
    }
    std::unique_ptr<ModuleSummaryIndex> CombinedIndex = std::move(*IndexOrErr);
    // A null CombinedIndex means we should skip ThinLTO compilation
    // (LLVM will optionally ignore empty index files, returning null instead
    // of an error).
    bool DoThinLTOBackend = CombinedIndex != nullptr;
    if (DoThinLTOBackend) {
      runThinLTOBackend(CombinedIndex.get(), M, HeaderOpts, CGOpts, TOpts,
                        LOpts, std::move(OS), CGOpts.SampleProfileFile, Action);
      return;
    }
  }

  EmitAssemblyHelper AsmHelper(Diags, HeaderOpts, CGOpts, TOpts, LOpts, M);

  if (CGOpts.ExperimentalNewPassManager)
    AsmHelper.EmitAssemblyWithNewPassManager(Action, std::move(OS));
  else
    AsmHelper.EmitAssembly(Action, std::move(OS));

  // Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
  // DataLayout.
  if (AsmHelper.TM) {
    std::string DLDesc = M->getDataLayout().getStringRepresentation();
    if (DLDesc != TDesc.getStringRepresentation()) {
      unsigned DiagID = Diags.getCustomDiagID(
          DiagnosticsEngine::Error, "backend data layout '%0' does not match "
                                    "expected target description '%1'");
      Diags.Report(DiagID) << DLDesc << TDesc.getStringRepresentation();
    }
  }
}
Example #5
0
	bool HtTpg::areAllSgConnected(DiagnosticsEngine &diag)
	{
		// fill in connections where possible
		bool bProgress;
		do {
			bProgress = false;

			for (size_t i = 0; i < m_sgNameList.size(); i += 1) {
				for (size_t j = 0; j < m_sgNameList.size(); j += 1) {
					if (getUrsDelta(i, j) != RS_DELTA_UNKNOWN)
						continue;

					for (size_t k = 0; k < m_sgNameList.size(); k += 1) {
						if (getUrsDelta(i, k) == RS_DELTA_UNKNOWN || getUrsDelta(k, j) == RS_DELTA_UNKNOWN)
							continue;

						int delta = getUrsDelta(i, k) + getUrsDelta(k, j);
						setUrsDelta(i, j, delta);
						setUrsDelta(j, i, -delta);

						bProgress = true;
						break;
					}
				}
			}

		} while (bProgress);

		// now check connectivity
		bool bFullyConnected = true;
		for (size_t i = 0; i < m_sgNameList.size(); i += 1) {
			for (size_t j = 0; j < i; j += 1) {
				if (m_pSgUrsMatrix[j * m_sgNameList.size() + i] == RS_DELTA_UNKNOWN) {
					bFullyConnected = false;
					char errorMsg[256];
					sprintf(errorMsg, "subgroups of timing path group '%s' are not fully connected (%s and %s)",
						m_name.c_str(), m_sgNameList[j].c_str(), m_sgNameList[i].c_str());
					unsigned DiagID = diag.getCustomDiagID(DiagnosticsEngine::Error, errorMsg);
					diag.Report(DiagID);
				}
			}
		}
		return bFullyConnected;
	}
Example #6
0
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
                              const CodeGenOptions &CGOpts,
                              const clang::TargetOptions &TOpts,
                              const LangOptions &LOpts, StringRef TDesc,
                              Module *M, BackendAction Action,
                              raw_pwrite_stream *OS) {
  EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M);

  AsmHelper.EmitAssembly(Action, OS);

  // If an optional clang TargetInfo description string was passed in, use it to
  // verify the LLVM TargetMachine's DataLayout.
  if (AsmHelper.TM && !TDesc.empty()) {
    std::string DLDesc = M->getDataLayout().getStringRepresentation();
    if (DLDesc != TDesc) {
      unsigned DiagID = Diags.getCustomDiagID(
          DiagnosticsEngine::Error, "backend data layout '%0' does not match "
                                    "expected target description '%1'");
      Diags.Report(DiagID) << DLDesc << TDesc;
    }
  }
}
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
  for (const auto &I : All) {
    auto Diag = Diags.Report(Diags.getCustomDiagID(I.first, "%0"));
    switch (I.first) {
    default: llvm_unreachable(
                           "Diagnostic not handled during diagnostic flushing!");
    case DiagnosticsEngine::Note:
      Diag << Notes[I.second].second;
      break;
    case DiagnosticsEngine::Warning:
      Diag << Warnings[I.second].second;
      break;
    case DiagnosticsEngine::Remark:
      Diag << Remarks[I.second].second;
      break;
    case DiagnosticsEngine::Error:
    case DiagnosticsEngine::Fatal:
      Diag << Errors[I.second].second;
      break;
    }
  }
}
Example #8
0
OMPPragmaHandler::OMPPragmaHandler(PragmaDirectiveMap &Directives,
                                   DiagnosticsEngine &Diags) 
  : PragmaHandler("omp"),
    Directives(Directives),
    Diags(Diags),
    DiagUnrecognisedIdentifier(0),
    DiagFoundPragmaStmt(0),
    DiagUnsupportedConstruct(0),
    DiagMalformedStatement(0),
    DiagUnknownClause(0),
    DiagUnknownDirective(0) {

  DiagUnrecognisedIdentifier = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Unrecognised identifier");

  DiagFoundPragmaStmt = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Found pragma statement");

  DiagUnsupportedConstruct = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Unsupported construct");

  DiagMalformedStatement = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Malformed statement");

  DiagUnknownClause = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Unknown clause");
    
  DiagUnknownDirective = 
        Diags.getCustomDiagID(DiagnosticsEngine::Warning,
                              "Pragma Handler: Unknown directive");
    
}
Example #9
0
bool FileRemapper::report(const Twine &err, DiagnosticsEngine &Diag) {
  Diag.Report(Diag.getCustomDiagID(DiagnosticsEngine::Error, "%0"))
      << err.str();
  return true;
}