Exemple #1
0
/// AddImplicitIncludePTH - Add an implicit #include using the original file
///  used to generate a PTH cache.
static void AddImplicitIncludePTH(std::vector<char> &Buf, Preprocessor &PP,
  const std::string& ImplicitIncludePTH) {
  PTHManager *P = PP.getPTHManager();
  assert(P && "No PTHManager.");
  const char *OriginalFile = P->getOriginalSourceFile();

  if (!OriginalFile) {
    PP.getDiagnostics().Report(diag::err_fe_pth_file_has_no_source_header)
      << ImplicitIncludePTH;
    return;
  }

  AddImplicitInclude(Buf, OriginalFile);
}
/// AddImplicitIncludePTH - Add an implicit \#include using the original file
/// used to generate a PTH cache.
static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP,
                                  StringRef ImplicitIncludePTH) {
  PTHManager *P = PP.getPTHManager();
  // Null check 'P' in the corner case where it couldn't be created.
  const char *OriginalFile = P ? P->getOriginalSourceFile() : nullptr;

  if (!OriginalFile) {
    PP.getDiagnostics().Report(diag::err_fe_pth_file_has_no_source_header)
      << ImplicitIncludePTH;
    return;
  }

  AddImplicitInclude(Builder, OriginalFile);
}
/// AddImplicitIncludePTH - Add an implicit #include using the original file
///  used to generate a PTH cache.
static void AddImplicitIncludePTH(std::vector<char> &Buf, Preprocessor &PP,
                                  const std::string& ImplicitIncludePTH) {
    PTHManager *P = PP.getPTHManager();
    assert(P && "No PTHManager.");
    const char *OriginalFile = P->getOriginalSourceFile();

    if (!OriginalFile) {
        assert(!ImplicitIncludePTH.empty());
        fprintf(stderr, "error: PTH file '%s' does not designate an original "
                "source header file for -include-pth\n",
                ImplicitIncludePTH.c_str());
        exit (1);
    }

    AddImplicitInclude(Buf, OriginalFile);
}