Changeset View
Changeset View
Standalone View
Standalone View
flang/lib/Frontend/CompilerInstance.cpp
//===--- CompilerInstance.cpp ---------------------------------------------===// | //===--- CompilerInstance.cpp ---------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "flang/Frontend/CompilerInstance.h" | #include "flang/Frontend/CompilerInstance.h" | ||||
#include "flang/Frontend/CompilerInvocation.h" | #include "flang/Frontend/CompilerInvocation.h" | ||||
#include "clang/Frontend/TextDiagnosticPrinter.h" | #include "flang/Frontend/TextDiagnosticPrinter.h" | ||||
#include "llvm/Support/raw_ostream.h" | #include "llvm/Support/raw_ostream.h" | ||||
using namespace Fortran::frontend; | using namespace Fortran::frontend; | ||||
CompilerInstance::CompilerInstance() : invocation_(new CompilerInvocation()) {} | CompilerInstance::CompilerInstance() : invocation_(new CompilerInvocation()) {} | ||||
CompilerInstance::~CompilerInstance() = default; | CompilerInstance::~CompilerInstance() = default; | ||||
Show All 11 Lines | CompilerInstance::CreateDiagnostics(clang::DiagnosticOptions *opts, | ||||
clang::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diags( | clang::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diags( | ||||
new clang::DiagnosticsEngine(diagID, opts)); | new clang::DiagnosticsEngine(diagID, opts)); | ||||
// Create the diagnostic client for reporting errors or for | // Create the diagnostic client for reporting errors or for | ||||
// implementing -verify. | // implementing -verify. | ||||
if (client) { | if (client) { | ||||
diags->setClient(client, shouldOwnClient); | diags->setClient(client, shouldOwnClient); | ||||
} else { | } else { | ||||
diags->setClient(new clang::TextDiagnosticPrinter(llvm::errs(), opts)); | diags->setClient(new TextDiagnosticPrinter(llvm::errs(), opts)); | ||||
} | } | ||||
return diags; | return diags; | ||||
} | } |