aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 5ea2fc2..871cdb7 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -1122,11 +1122,10 @@ void CodeGenAction::ExecuteAction() {
if (BA != Backend_EmitNothing && !OS)
return;
- bool Invalid;
SourceManager &SM = CI.getSourceManager();
FileID FID = SM.getMainFileID();
- const llvm::MemoryBuffer *MainFile = SM.getBuffer(FID, &Invalid);
- if (Invalid)
+ Optional<MemoryBufferRef> MainFile = SM.getBufferOrNone(FID);
+ if (!MainFile)
return;
TheModule = loadModule(*MainFile);
@@ -1141,8 +1140,7 @@ void CodeGenAction::ExecuteAction() {
TheModule->setTargetTriple(TargetOpts.Triple);
}
- EmbedBitcode(TheModule.get(), CodeGenOpts,
- MainFile->getMemBufferRef());
+ EmbedBitcode(TheModule.get(), CodeGenOpts, *MainFile);
LLVMContext &Ctx = TheModule->getContext();
Ctx.setInlineAsmDiagnosticHandler(BitcodeInlineAsmDiagHandler,