Update Clang for 3.5 rebase (r209713).
Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index 2657c98..5c56ee3 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -49,7 +49,7 @@
StringRef InFile) {
if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile))
return CreateASTPrinter(OS, CI.getFrontendOpts().ASTDumpFilter);
- return 0;
+ return nullptr;
}
ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI,
@@ -77,13 +77,14 @@
StringRef InFile) {
std::string Sysroot;
std::string OutputFile;
- raw_ostream *OS = 0;
+ raw_ostream *OS = nullptr;
if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
- return 0;
+ return nullptr;
if (!CI.getFrontendOpts().RelocatablePCH)
Sysroot.clear();
- return new PCHGenerator(CI.getPreprocessor(), OutputFile, 0, Sysroot, OS);
+ return new PCHGenerator(CI.getPreprocessor(), OutputFile, nullptr, Sysroot,
+ OS);
}
bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI,
@@ -114,10 +115,10 @@
StringRef InFile) {
std::string Sysroot;
std::string OutputFile;
- raw_ostream *OS = 0;
+ raw_ostream *OS = nullptr;
if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
- return 0;
-
+ return nullptr;
+
return new PCHGenerator(CI.getPreprocessor(), OutputFile, Module,
Sysroot, OS);
}
@@ -213,7 +214,7 @@
// If this header is marked 'unavailable' in this module, don't include
// it.
if (const FileEntry *Header = FileMgr.getFile(Dir->path())) {
- if (ModMap.isHeaderInUnavailableModule(Header))
+ if (ModMap.isHeaderUnavailableInModule(Header, Module))
continue;
Module->addTopHeader(Header);
}
@@ -288,7 +289,8 @@
if (!Module->isAvailable(CI.getLangOpts(), CI.getTarget(), Requirement,
MissingHeader)) {
if (MissingHeader.FileNameLoc.isValid()) {
- CI.getDiagnostics().Report(diag::err_module_header_missing)
+ CI.getDiagnostics().Report(MissingHeader.FileNameLoc,
+ diag::err_module_header_missing)
<< MissingHeader.IsUmbrella << MissingHeader.FileName;
} else {
CI.getDiagnostics().Report(diag::err_module_unavailable)
@@ -299,6 +301,11 @@
return false;
}
+ if (!ModuleMapForUniquing)
+ ModuleMapForUniquing = ModuleMap;
+ Module->ModuleMap = ModuleMapForUniquing;
+ assert(Module->ModuleMap && "missing module map file");
+
FileManager &FileMgr = CI.getFileManager();
// Collect the set of #includes we need to build the module.
@@ -337,10 +344,9 @@
// in the module cache.
if (CI.getFrontendOpts().OutputFile.empty()) {
HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
- SmallString<256> ModuleFileName(HS.getModuleCachePath());
- llvm::sys::path::append(ModuleFileName,
- CI.getLangOpts().CurrentModule + ".pcm");
- CI.getFrontendOpts().OutputFile = ModuleFileName.str();
+ CI.getFrontendOpts().OutputFile =
+ HS.getModuleFileName(CI.getLangOpts().CurrentModule,
+ ModuleMapForUniquing->getName());
}
// We use createOutputFile here because this is exposed via libclang, and we
@@ -412,6 +418,13 @@
return ASTReaderListener::ReadFullVersionInformation(FullVersion);
}
+ void ReadModuleName(StringRef ModuleName) override {
+ Out.indent(2) << "Module name: " << ModuleName << "\n";
+ }
+ void ReadModuleMapFile(StringRef ModuleMapPath) override {
+ Out.indent(2) << "Module map file: " << ModuleMapPath << "\n";
+ }
+
bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain) override {
Out.indent(2) << "Language options:\n";
@@ -434,7 +447,6 @@
Out.indent(4) << " Triple: " << TargetOpts.Triple << "\n";
Out.indent(4) << " CPU: " << TargetOpts.CPU << "\n";
Out.indent(4) << " ABI: " << TargetOpts.ABI << "\n";
- Out.indent(4) << " Linker version: " << TargetOpts.LinkerVersion << "\n";
if (!TargetOpts.FeaturesAsWritten.empty()) {
Out.indent(4) << "Target features:\n";
@@ -447,6 +459,25 @@
return false;
}
+ virtual bool
+ ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts,
+ bool Complain) override {
+ Out.indent(2) << "Diagnostic options:\n";
+#define DIAGOPT(Name, Bits, Default) DUMP_BOOLEAN(DiagOpts->Name, #Name);
+#define ENUM_DIAGOPT(Name, Type, Bits, Default) \
+ Out.indent(4) << #Name << ": " << DiagOpts->get##Name() << "\n";
+#define VALUE_DIAGOPT(Name, Bits, Default) \
+ Out.indent(4) << #Name << ": " << DiagOpts->Name << "\n";
+#include "clang/Basic/DiagnosticOptions.def"
+
+ Out.indent(4) << "Warning options:\n";
+ for (const std::string &Warning : DiagOpts->Warnings) {
+ Out.indent(6) << "-W" << Warning << "\n";
+ }
+
+ return false;
+ }
+
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
bool Complain) override {
Out.indent(2) << "Header search options:\n";
@@ -562,7 +593,7 @@
Preprocessor &PP = getCompilerInstance().getPreprocessor();
// Ignore unknown pragmas.
- PP.AddPragmaHandler(new EmptyPragmaHandler());
+ PP.IgnorePragmas();
Token Tok;
// Start parsing the specified input file.