summaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp b/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp
index 934d17b3c925..d724bbce3749 100644
--- a/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp
+++ b/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp
@@ -10,8 +10,6 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
-#include "clang/Basic/Builtins.h"
-#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
@@ -217,7 +215,7 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
Consumers.push_back(std::move(C));
}
- return std::make_unique<MultiplexConsumer>(std::move(Consumers));
+ return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
}
/// For preprocessed files, if the first line is the linemarker and specifies
@@ -372,7 +370,7 @@ static std::error_code collectModuleHeaderIncludes(
.Default(false))
continue;
- auto Header = FileMgr.getFile(Dir->path());
+ const FileEntry *Header = FileMgr.getFile(Dir->path());
// FIXME: This shouldn't happen unless there is a file system race. Is
// that worth diagnosing?
if (!Header)
@@ -380,7 +378,7 @@ static std::error_code collectModuleHeaderIncludes(
// If this header is marked 'unavailable' in this module, don't include
// it.
- if (ModMap.isHeaderUnavailableInModule(*Header, Module))
+ if (ModMap.isHeaderUnavailableInModule(Header, Module))
continue;
// Compute the relative path from the directory to this file.
@@ -394,7 +392,7 @@ static std::error_code collectModuleHeaderIncludes(
llvm::sys::path::append(RelativeHeader, *It);
// Include this header as part of the umbrella directory.
- Module->addTopHeader(*Header);
+ Module->addTopHeader(Header);
addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC);
}
@@ -483,7 +481,7 @@ static Module *prepareToBuildModule(CompilerInstance &CI,
// the module map, rather than adding it after the fact.
StringRef OriginalModuleMapName = CI.getFrontendOpts().OriginalModuleMap;
if (!OriginalModuleMapName.empty()) {
- auto OriginalModuleMap =
+ auto *OriginalModuleMap =
CI.getFileManager().getFile(OriginalModuleMapName,
/*openFile*/ true);
if (!OriginalModuleMap) {
@@ -491,11 +489,11 @@ static Module *prepareToBuildModule(CompilerInstance &CI,
<< OriginalModuleMapName;
return nullptr;
}
- if (*OriginalModuleMap != CI.getSourceManager().getFileEntryForID(
+ if (OriginalModuleMap != CI.getSourceManager().getFileEntryForID(
CI.getSourceManager().getMainFileID())) {
M->IsInferred = true;
CI.getPreprocessor().getHeaderSearchInfo().getModuleMap()
- .setInferredModuleAllowedBy(M, *OriginalModuleMap);
+ .setInferredModuleAllowedBy(M, OriginalModuleMap);
}
}
@@ -676,8 +674,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// Set up embedding for any specified files. Do this before we load any
// source files, including the primary module map for the compilation.
for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) {
- if (auto FE = CI.getFileManager().getFile(F, /*openFile*/true))
- CI.getSourceManager().setFileIsTransient(*FE);
+ if (const auto *FE = CI.getFileManager().getFile(F, /*openFile*/true))
+ CI.getSourceManager().setFileIsTransient(FE);
else
CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F;
}
@@ -685,7 +683,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.getSourceManager().setAllFilesAreTransient(true);
// IR files bypass the rest of initialization.
- if (Input.getKind().getLanguage() == Language::LLVM_IR) {
+ if (Input.getKind().getLanguage() == InputKind::LLVM_IR) {
assert(hasIRSupport() &&
"This action does not have IR file support!");
@@ -711,10 +709,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
StringRef PCHInclude = PPOpts.ImplicitPCHInclude;
std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath();
- if (auto PCHDir = FileMgr.getDirectory(PCHInclude)) {
+ if (const DirectoryEntry *PCHDir = FileMgr.getDirectory(PCHInclude)) {
std::error_code EC;
SmallString<128> DirNative;
- llvm::sys::path::native((*PCHDir)->getName(), DirNative);
+ llvm::sys::path::native(PCHDir->getName(), DirNative);
bool Found = false;
llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();
for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC),
@@ -794,9 +792,9 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// If we were asked to load any module map files, do so now.
for (const auto &Filename : CI.getFrontendOpts().ModuleMapFiles) {
- if (auto File = CI.getFileManager().getFile(Filename))
+ if (auto *File = CI.getFileManager().getFile(Filename))
CI.getPreprocessor().getHeaderSearchInfo().loadModuleMapFile(
- *File, /*IsSystem*/false);
+ File, /*IsSystem*/false);
else
CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename;
}
@@ -871,9 +869,9 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// extended by an external source.
if (CI.getLangOpts().Modules || !CI.hasASTContext() ||
!CI.getASTContext().getExternalSource()) {
- CI.createASTReader();
- CI.getASTReader()->setDeserializationListener(DeserialListener,
- DeleteDeserialListener);
+ CI.createModuleManager();
+ CI.getModuleManager()->setDeserializationListener(DeserialListener,
+ DeleteDeserialListener);
}
}
@@ -892,7 +890,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
} else {
// FIXME: If this is a problem, recover from it by creating a multiplex
// source.
- assert((!CI.getLangOpts().Modules || CI.getASTReader()) &&
+ assert((!CI.getLangOpts().Modules || CI.getModuleManager()) &&
"modules enabled but created an external source that "
"doesn't support modules");
}