aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/ASTMerge.cpp3
-rw-r--r--lib/Frontend/ASTUnit.cpp53
-rw-r--r--lib/Frontend/ChainedIncludesSource.cpp5
-rw-r--r--lib/Frontend/CompilerInstance.cpp9
-rw-r--r--lib/Frontend/CompilerInvocation.cpp12
-rw-r--r--lib/Frontend/FrontendAction.cpp38
-rw-r--r--lib/Frontend/FrontendActions.cpp8
-rw-r--r--lib/Frontend/VerifyDiagnosticConsumer.cpp2
8 files changed, 61 insertions, 69 deletions
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp
index cb195d11fb..a4104115f2 100644
--- a/lib/Frontend/ASTMerge.cpp
+++ b/lib/Frontend/ASTMerge.cpp
@@ -26,8 +26,7 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI,
// FIXME: This is a hack. We need a better way to communicate the
// AST file, compiler instance, and file name than member variables
// of FrontendAction.
- AdaptedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind(),
- takeCurrentASTUnit());
+ AdaptedAction->setCurrentInput(getCurrentInput(), takeCurrentASTUnit());
AdaptedAction->setCompilerInstance(&CI);
return AdaptedAction->BeginSourceFileAction(CI, Filename);
}
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index e31bf5500b..c23c64497a 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1003,7 +1003,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
CCInvocation(new CompilerInvocation(*Invocation));
Clang->setInvocation(CCInvocation.getPtr());
- OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].second;
+ OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].File;
// Set up diagnostics, capturing any diagnostics that would
// otherwise be dropped.
@@ -1026,9 +1026,9 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
assert(Clang->getFrontendOpts().Inputs.size() == 1 &&
"Invocation must have exactly one source file!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_AST &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_AST &&
"FIXME: AST inputs not yet supported here!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_LLVM_IR &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_LLVM_IR &&
"IR inputs not support here!");
// Configure the various subsystems.
@@ -1095,8 +1095,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(Act.get());
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0].second,
- Clang->getFrontendOpts().Inputs[0].first))
+ if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
goto error;
if (OverrideMainBuffer) {
@@ -1182,7 +1181,7 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation,
// command line (to another file) or directly through the compiler invocation
// (to a memory buffer).
llvm::MemoryBuffer *Buffer = 0;
- llvm::sys::PathWithStatus MainFilePath(FrontendOpts.Inputs[0].second);
+ llvm::sys::PathWithStatus MainFilePath(FrontendOpts.Inputs[0].File);
if (const llvm::sys::FileStatus *MainFileStatus = MainFilePath.getFileStatus()) {
// Check whether there is a file-file remapping of the main file
for (PreprocessorOptions::remapped_file_iterator
@@ -1232,7 +1231,7 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation,
// If the main source file was not remapped, load it now.
if (!Buffer) {
- Buffer = getBufferForFile(FrontendOpts.Inputs[0].second);
+ Buffer = getBufferForFile(FrontendOpts.Inputs[0].File);
if (!Buffer)
return std::make_pair((llvm::MemoryBuffer*)0, std::make_pair(0, true));
@@ -1394,7 +1393,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
// buffer size we reserved when creating the preamble.
return CreatePaddedMainFileBuffer(NewPreamble.first,
PreambleReservedSize,
- FrontendOpts.Inputs[0].second);
+ FrontendOpts.Inputs[0].File);
}
}
@@ -1447,7 +1446,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
// Save the preamble text for later; we'll need to compare against it for
// subsequent reparses.
- StringRef MainFilename = PreambleInvocation->getFrontendOpts().Inputs[0].second;
+ StringRef MainFilename = PreambleInvocation->getFrontendOpts().Inputs[0].File;
Preamble.assign(FileMgr->getFile(MainFilename),
NewPreamble.first->getBufferStart(),
NewPreamble.first->getBufferStart()
@@ -1457,7 +1456,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
delete PreambleBuffer;
PreambleBuffer
= llvm::MemoryBuffer::getNewUninitMemBuffer(PreambleReservedSize,
- FrontendOpts.Inputs[0].second);
+ FrontendOpts.Inputs[0].File);
memcpy(const_cast<char*>(PreambleBuffer->getBufferStart()),
NewPreamble.first->getBufferStart(), Preamble.size());
memset(const_cast<char*>(PreambleBuffer->getBufferStart()) + Preamble.size(),
@@ -1465,7 +1464,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
const_cast<char*>(PreambleBuffer->getBufferEnd())[-1] = '\n';
// Remap the main source file to the preamble buffer.
- llvm::sys::PathWithStatus MainFilePath(FrontendOpts.Inputs[0].second);
+ llvm::sys::PathWithStatus MainFilePath(FrontendOpts.Inputs[0].File);
PreprocessorOpts.addRemappedFile(MainFilePath.str(), PreambleBuffer);
// Tell the compiler invocation to generate a temporary precompiled header.
@@ -1483,7 +1482,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
CICleanup(Clang.get());
Clang->setInvocation(&*PreambleInvocation);
- OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].second;
+ OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].File;
// Set up diagnostics, capturing all of the diagnostics produced.
Clang->setDiagnostics(&getDiagnostics());
@@ -1509,9 +1508,9 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
assert(Clang->getFrontendOpts().Inputs.size() == 1 &&
"Invocation must have exactly one source file!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_AST &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_AST &&
"FIXME: AST inputs not yet supported here!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_LLVM_IR &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_LLVM_IR &&
"IR inputs not support here!");
// Clear out old caches and data.
@@ -1530,8 +1529,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
llvm::OwningPtr<PrecompilePreambleAction> Act;
Act.reset(new PrecompilePreambleAction(*this));
- if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0].second,
- Clang->getFrontendOpts().Inputs[0].first)) {
+ if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
llvm::sys::Path(FrontendOpts.OutputFile).eraseFromDisk();
Preamble.clear();
PreambleRebuildCounter = DefaultPreambleRebuildInterval;
@@ -1599,7 +1597,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
return CreatePaddedMainFileBuffer(NewPreamble.first,
PreambleReservedSize,
- FrontendOpts.Inputs[0].second);
+ FrontendOpts.Inputs[0].File);
}
void ASTUnit::RealizeTopLevelDeclsFromPreamble() {
@@ -1618,7 +1616,7 @@ void ASTUnit::RealizeTopLevelDeclsFromPreamble() {
}
StringRef ASTUnit::getMainFileName() const {
- return Invocation->getFrontendOpts().Inputs[0].second;
+ return Invocation->getFrontendOpts().Inputs[0].File;
}
ASTUnit *ASTUnit::create(CompilerInvocation *CI,
@@ -1690,7 +1688,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
CICleanup(Clang.get());
Clang->setInvocation(CI);
- AST->OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].second;
+ AST->OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].File;
// Set up diagnostics, capturing any diagnostics that would
// otherwise be dropped.
@@ -1711,9 +1709,9 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
assert(Clang->getFrontendOpts().Inputs.size() == 1 &&
"Invocation must have exactly one source file!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_AST &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_AST &&
"FIXME: AST inputs not yet supported here!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_LLVM_IR &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_LLVM_IR &&
"IR inputs not supported here!");
// Configure the various subsystems.
@@ -1740,9 +1738,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(CompilerInvocation *CI,
llvm::CrashRecoveryContextCleanupRegistrar<TopLevelDeclTrackerAction>
ActCleanup(TrackerAct.get());
- if (!Act->BeginSourceFile(*Clang.get(),
- Clang->getFrontendOpts().Inputs[0].second,
- Clang->getFrontendOpts().Inputs[0].first))
+ if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
return 0;
if (Persistent && !TrackerAct) {
@@ -2255,7 +2251,7 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
CICleanup(Clang.get());
Clang->setInvocation(&*CCInvocation);
- OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].second;
+ OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].File;
// Set up diagnostics, capturing any diagnostics produced.
Clang->setDiagnostics(&Diag);
@@ -2281,9 +2277,9 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
assert(Clang->getFrontendOpts().Inputs.size() == 1 &&
"Invocation must have exactly one source file!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_AST &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_AST &&
"FIXME: AST inputs not yet supported here!");
- assert(Clang->getFrontendOpts().Inputs[0].first != IK_LLVM_IR &&
+ assert(Clang->getFrontendOpts().Inputs[0].Kind != IK_LLVM_IR &&
"IR inputs not support here!");
@@ -2358,8 +2354,7 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column,
llvm::OwningPtr<SyntaxOnlyAction> Act;
Act.reset(new SyntaxOnlyAction);
- if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0].second,
- Clang->getFrontendOpts().Inputs[0].first)) {
+ if (Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) {
if (OverrideMainBuffer) {
std::string ModName = getPreambleFile(this);
TranslateStoredDiagnostics(Clang->getModuleManager(), ModName,
diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp
index f1aa8a1d05..9694bc0403 100644
--- a/lib/Frontend/ChainedIncludesSource.cpp
+++ b/lib/Frontend/ChainedIncludesSource.cpp
@@ -63,7 +63,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) {
assert(!includes.empty() && "No '-chain-include' in options!");
llvm::OwningPtr<ChainedIncludesSource> source(new ChainedIncludesSource());
- InputKind IK = CI.getFrontendOpts().Inputs[0].first;
+ InputKind IK = CI.getFrontendOpts().Inputs[0].Kind;
SmallVector<llvm::MemoryBuffer *, 4> serialBufs;
SmallVector<std::string, 4> serialBufNames;
@@ -82,7 +82,8 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) {
CInvok->getPreprocessorOpts().Macros.clear();
CInvok->getFrontendOpts().Inputs.clear();
- CInvok->getFrontendOpts().Inputs.push_back(std::make_pair(IK, includes[i]));
+ CInvok->getFrontendOpts().Inputs.push_back(FrontendInputFile(includes[i],
+ IK));
TextDiagnosticPrinter *DiagClient =
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 1f0d87c062..c3f3e3711a 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -648,13 +648,11 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
llvm::EnableStatistics();
for (unsigned i = 0, e = getFrontendOpts().Inputs.size(); i != e; ++i) {
- const std::string &InFile = getFrontendOpts().Inputs[i].second;
-
// Reset the ID tables if we are reusing the SourceManager.
if (hasSourceManager())
getSourceManager().clearIDTables();
- if (Act.BeginSourceFile(*this, InFile, getFrontendOpts().Inputs[i].first)) {
+ if (Act.BeginSourceFile(*this, getFrontendOpts().Inputs[i])) {
Act.Execute();
Act.EndSourceFile();
}
@@ -1019,7 +1017,8 @@ static void compileModule(CompilerInstance &ImportingInstance,
if (const FileEntry *ModuleMapFile
= ModMap.getContainingModuleMapFile(Module)) {
// Use the module map where this module resides.
- FrontendOpts.Inputs.push_back(std::make_pair(IK, ModuleMapFile->getName()));
+ FrontendOpts.Inputs.push_back(FrontendInputFile(ModuleMapFile->getName(),
+ IK));
} else {
// Create a temporary module map file.
TempModuleMapFileName = Module->Name;
@@ -1037,7 +1036,7 @@ static void compileModule(CompilerInstance &ImportingInstance,
llvm::raw_fd_ostream OS(FD, /*shouldClose=*/true);
Module->print(OS);
FrontendOpts.Inputs.push_back(
- std::make_pair(IK, TempModuleMapFileName.str().str()));
+ FrontendInputFile(TempModuleMapFileName.str().str(), IK));
}
// Don't free the remapped file buffers; they are owned by our caller.
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 60e3442837..a64b8cf883 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -492,17 +492,17 @@ static void FrontendOptsToArgs(const FrontendOptions &Opts,
bool NeedLang = false;
for (unsigned i = 0, e = Opts.Inputs.size(); i != e; ++i)
- if (FrontendOptions::getInputKindForExtension(Opts.Inputs[i].second) !=
- Opts.Inputs[i].first)
+ if (FrontendOptions::getInputKindForExtension(Opts.Inputs[i].File) !=
+ Opts.Inputs[i].Kind)
NeedLang = true;
if (NeedLang) {
Res.push_back("-x");
- Res.push_back(getInputKindName(Opts.Inputs[0].first));
+ Res.push_back(getInputKindName(Opts.Inputs[0].Kind));
}
for (unsigned i = 0, e = Opts.Inputs.size(); i != e; ++i) {
- assert((!NeedLang || Opts.Inputs[i].first == Opts.Inputs[0].first) &&
+ assert((!NeedLang || Opts.Inputs[i].Kind == Opts.Inputs[0].Kind) &&
"Unable to represent this input vector!");
- Res.push_back(Opts.Inputs[i].second);
+ Res.push_back(Opts.Inputs[i].File);
}
if (!Opts.OutputFile.empty()) {
@@ -1463,7 +1463,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
if (i == 0)
DashX = IK;
}
- Opts.Inputs.push_back(std::make_pair(IK, Inputs[i]));
+ Opts.Inputs.push_back(FrontendInputFile(Inputs[i], IK));
}
return DashX;
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 7e4ae023d0..42ba4d5a09 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -115,10 +115,9 @@ FrontendAction::FrontendAction() : Instance(0) {}
FrontendAction::~FrontendAction() {}
-void FrontendAction::setCurrentFile(StringRef Value, InputKind Kind,
- ASTUnit *AST) {
- CurrentFile = Value;
- CurrentFileKind = Kind;
+void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
+ ASTUnit *AST) {
+ this->CurrentInput = CurrentInput;
CurrentASTUnit.reset(AST);
}
@@ -156,11 +155,10 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
}
bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
- StringRef Filename,
- InputKind InputKind) {
+ const FrontendInputFile &Input) {
assert(!Instance && "Already processing a source file!");
- assert(!Filename.empty() && "Unexpected empty filename!");
- setCurrentFile(Filename, InputKind);
+ assert(!Input.File.empty() && "Unexpected empty filename!");
+ setCurrentInput(Input);
setCompilerInstance(&CI);
if (!BeginInvocation(CI))
@@ -168,7 +166,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
// AST files follow a very different path, since they share objects via the
// AST unit.
- if (InputKind == IK_AST) {
+ if (Input.Kind == IK_AST) {
assert(!usesPreprocessorOnly() &&
"Attempt to pass AST file to preprocessor only action!");
assert(hasASTFileSupport() &&
@@ -176,12 +174,12 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
std::string Error;
- ASTUnit *AST = ASTUnit::LoadFromASTFile(Filename, Diags,
+ ASTUnit *AST = ASTUnit::LoadFromASTFile(Input.File, Diags,
CI.getFileSystemOpts());
if (!AST)
goto failure;
- setCurrentFile(Filename, InputKind, AST);
+ setCurrentInput(Input, AST);
// Set the shared objects, these are reset when we finish processing the
// file, otherwise the CompilerInstance will happily destroy them.
@@ -191,11 +189,11 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.setASTContext(&AST->getASTContext());
// Initialize the action.
- if (!BeginSourceFileAction(CI, Filename))
+ if (!BeginSourceFileAction(CI, Input.File))
goto failure;
/// Create the AST consumer.
- CI.setASTConsumer(CreateWrappedASTConsumer(CI, Filename));
+ CI.setASTConsumer(CreateWrappedASTConsumer(CI, Input.File));
if (!CI.hasASTConsumer())
goto failure;
@@ -209,7 +207,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.createSourceManager(CI.getFileManager());
// IR files bypass the rest of initialization.
- if (InputKind == IK_LLVM_IR) {
+ if (Input.Kind == IK_LLVM_IR) {
assert(hasIRSupport() &&
"This action does not have IR file support!");
@@ -217,7 +215,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0);
// Initialize the action.
- if (!BeginSourceFileAction(CI, Filename))
+ if (!BeginSourceFileAction(CI, Input.File))
goto failure;
return true;
@@ -231,7 +229,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
&CI.getPreprocessor());
// Initialize the action.
- if (!BeginSourceFileAction(CI, Filename))
+ if (!BeginSourceFileAction(CI, Input.File))
goto failure;
/// Create the AST context and consumer unless this is a preprocessor only
@@ -240,7 +238,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.createASTContext();
llvm::OwningPtr<ASTConsumer> Consumer(
- CreateWrappedASTConsumer(CI, Filename));
+ CreateWrappedASTConsumer(CI, Input.File));
if (!Consumer)
goto failure;
@@ -300,7 +298,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
}
CI.getDiagnosticClient().EndSourceFile();
- setCurrentFile("", IK_None);
+ setCurrentInput(FrontendInputFile());
setCompilerInstance(0);
return false;
}
@@ -375,7 +373,7 @@ void FrontendAction::EndSourceFile() {
}
setCompilerInstance(0);
- setCurrentFile("", IK_None);
+ setCurrentInput(FrontendInputFile());
}
//===----------------------------------------------------------------------===//
@@ -419,7 +417,7 @@ bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) {
}
bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI,
StringRef Filename) {
- WrappedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind());
+ WrappedAction->setCurrentInput(getCurrentInput());
WrappedAction->setCompilerInstance(&CI);
return WrappedAction->BeginSourceFileAction(CI, Filename);
}
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index 2261b30712..272474cea7 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -255,7 +255,8 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI,
if (UmbrellaHeader && HeaderContents.empty()) {
// Simple case: we have an umbrella header and there are no additional
// includes, we can just parse the umbrella header directly.
- setCurrentFile(UmbrellaHeader->getName(), getCurrentFileKind());
+ setCurrentInput(FrontendInputFile(UmbrellaHeader->getName(),
+ getCurrentFileKind()));
return true;
}
@@ -311,9 +312,8 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI,
ModTime);
llvm::MemoryBuffer *HeaderContentsBuf
= llvm::MemoryBuffer::getMemBufferCopy(HeaderContents);
- CI.getSourceManager().overrideFileContents(HeaderFile, HeaderContentsBuf);
-
- setCurrentFile(HeaderName, getCurrentFileKind());
+ CI.getSourceManager().overrideFileContents(HeaderFile, HeaderContentsBuf);
+ setCurrentInput(FrontendInputFile(HeaderName, getCurrentFileKind()));
return true;
}
diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 88e36ade57..c8d6be6509 100644
--- a/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -40,7 +40,7 @@ VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer() {
// DiagnosticConsumer interface.
void VerifyDiagnosticConsumer::BeginSourceFile(const LangOptions &LangOpts,
- const Preprocessor *PP) {
+ const Preprocessor *PP) {
// FIXME: Const hack, we screw up the preprocessor but in practice its ok
// because it doesn't get reused. It would be better if we could make a copy
// though.