Skip to content

Commit 257b297

Browse files
[flang][driver] Add the new flang compiler and frontend drivers
Summary: This is the first patch implementing the new Flang driver as outlined in [1], [2] & [3]. It creates Flang driver (`flang-new`) and Flang frontend driver (`flang-new -fc1`). These will be renamed as `flang` and `flang -fc1` once the current Flang throwaway driver, `flang`, can be replaced with `flang-new`. Currently only 2 options are supported: `-help` and `--version`. `flang-new` is implemented in terms of libclangDriver, defaulting the driver mode to `FlangMode` (added to libclangDriver in [4]). This ensures that the driver runs in Flang mode regardless of the name of the binary inferred from argv[0]. The design of the new Flang compiler and frontend drivers is inspired by it counterparts in Clang [3]. Currently, the new Flang compiler and frontend drivers re-use Clang libraries: clangBasic, clangDriver and clangFrontend. To identify Flang options, this patch adds FlangOption/FC1Option enums. Driver::printHelp is updated so that `flang-new` prints only Flang options. The new Flang driver is disabled by default. To enable it, set `-DBUILD_FLANG_NEW_DRIVER=ON` when configuring CMake and add clang to `LLVM_ENABLE_PROJECTS` (e.g. -DLLVM_ENABLE_PROJECTS=“clang;flang;mlir”). [1] “RFC: new Flang driver - next steps” http://lists.llvm.org/pipermail/flang-dev/2020-July/000470.html [2] “RFC: Adding a fortran mode to the clang driver for flang” http://lists.llvm.org/pipermail/cfe-dev/2019-June/062669.html [3] “RFC: refactoring libclangDriver/libclangFrontend to share with Flang” http://lists.llvm.org/pipermail/cfe-dev/2020-July/066393.html [4] https://reviews.llvm.org/rG6bf55804924d5a1d902925ad080b1a2b57c5c75c co-authored-by: Andrzej Warzynski <[email protected]> Reviewed By: richard.barton.arm, sameeranjoshi Differential Revision: https://reviews.llvm.org/D86089
1 parent 002f5ab commit 257b297

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+924
-28
lines changed

clang/include/clang/Driver/Driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class Driver {
301301
StringRef CustomResourceDir = "");
302302

303303
Driver(StringRef ClangExecutable, StringRef TargetTriple,
304-
DiagnosticsEngine &Diags,
304+
DiagnosticsEngine &Diags, std::string Title = "clang LLVM compiler",
305305
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
306306

307307
/// @name Accessors

clang/include/clang/Driver/Options.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ enum ClangFlags {
3434
CC1AsOption = (1 << 11),
3535
NoDriverOption = (1 << 12),
3636
LinkOption = (1 << 13),
37-
Ignored = (1 << 14),
37+
FlangOption = (1 << 14),
38+
FC1Option = (1 << 15),
39+
Ignored = (1 << 16),
3840
};
3941

4042
enum ID {

clang/include/clang/Driver/Options.td

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ def NoDriverOption : OptionFlag;
5656
// be used), add this flag.
5757
def LinkOption : OptionFlag;
5858

59+
// FlangOption - This is considered a "core" Flang option, available in
60+
// flang mode.
61+
def FlangOption : OptionFlag;
62+
63+
// FC1Option - This option should be accepted by flang -fc1.
64+
def FC1Option : OptionFlag;
65+
5966
// A short name to show in documentation. The name will be interpreted as rST.
6067
class DocName<string name> { string DocName = name; }
6168

@@ -2100,7 +2107,7 @@ def gno_embed_source : Flag<["-"], "gno-embed-source">, Group<g_flags_Group>,
21002107
Flags<[DriverOption]>,
21012108
HelpText<"Restore the default behavior of not embedding source text in DWARF debug sections">;
21022109
def headerpad__max__install__names : Joined<["-"], "headerpad_max_install_names">;
2103-
def help : Flag<["-", "--"], "help">, Flags<[CC1Option,CC1AsOption]>,
2110+
def help : Flag<["-", "--"], "help">, Flags<[CC1Option,CC1AsOption, FC1Option, FlangOption]>,
21042111
HelpText<"Display available options">;
21052112
def ibuiltininc : Flag<["-"], "ibuiltininc">,
21062113
HelpText<"Enable builtin #include directories even when -nostdinc is used "
@@ -3049,7 +3056,8 @@ def _rtlib : Separate<["--"], "rtlib">, Alias<rtlib_EQ>;
30493056
def _serialize_diags : Separate<["-", "--"], "serialize-diagnostics">, Flags<[DriverOption]>,
30503057
HelpText<"Serialize compiler diagnostics to a file">;
30513058
// We give --version different semantics from -version.
3052-
def _version : Flag<["--"], "version">, Flags<[CoreOption, CC1Option]>,
3059+
def _version : Flag<["--"], "version">,
3060+
Flags<[CoreOption, CC1Option, FC1Option, FlangOption]>,
30533061
HelpText<"Print version information">;
30543062
def _signed_char : Flag<["--"], "signed-char">, Alias<fsigned_char>;
30553063
def _std : Separate<["--"], "std">, Alias<std_EQ>;

clang/lib/Driver/Driver.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
128128
}
129129

130130
Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
131-
DiagnosticsEngine &Diags,
131+
DiagnosticsEngine &Diags, std::string Title,
132132
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
133133
: Diags(Diags), VFS(std::move(VFS)), Mode(GCCMode),
134134
SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone), LTOMode(LTOK_None),
135135
ClangExecutable(ClangExecutable), SysRoot(DEFAULT_SYSROOT),
136-
DriverTitle("clang LLVM compiler"), CCPrintOptionsFilename(nullptr),
136+
DriverTitle(Title), CCPrintOptionsFilename(nullptr),
137137
CCPrintHeadersFilename(nullptr), CCLogDiagnosticsFilename(nullptr),
138138
CCCPrintBindings(false), CCPrintOptions(false), CCPrintHeaders(false),
139139
CCLogDiagnostics(false), CCGenDiagnostics(false),
@@ -1571,16 +1571,23 @@ void Driver::PrintHelp(bool ShowHidden) const {
15711571
if (!ShowHidden)
15721572
ExcludedFlagsBitmask |= HelpHidden;
15731573

1574+
if (IsFlangMode())
1575+
IncludedFlagsBitmask |= options::FlangOption;
1576+
15741577
std::string Usage = llvm::formatv("{0} [options] file...", Name).str();
15751578
getOpts().PrintHelp(llvm::outs(), Usage.c_str(), DriverTitle.c_str(),
15761579
IncludedFlagsBitmask, ExcludedFlagsBitmask,
15771580
/*ShowAllAliases=*/false);
15781581
}
15791582

15801583
void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
1581-
// FIXME: The following handlers should use a callback mechanism, we don't
1582-
// know what the client would like to do.
1583-
OS << getClangFullVersion() << '\n';
1584+
if (IsFlangMode()) {
1585+
OS << getClangToolFullVersion("flang-new") << '\n';
1586+
} else {
1587+
// FIXME: The following handlers should use a callback mechanism, we don't
1588+
// know what the client would like to do.
1589+
OS << getClangFullVersion() << '\n';
1590+
}
15841591
const ToolChain &TC = C.getDefaultToolChain();
15851592
OS << "Target: " << TC.getTripleString() << '\n';
15861593

@@ -1618,7 +1625,7 @@ void Driver::HandleAutocompletions(StringRef PassedFlags) const {
16181625
std::vector<std::string> SuggestedCompletions;
16191626
std::vector<std::string> Flags;
16201627

1621-
unsigned short DisableFlags =
1628+
unsigned int DisableFlags =
16221629
options::NoDriverOption | options::Unsupported | options::Ignored;
16231630

16241631
// Distinguish "--autocomplete=-someflag" and "--autocomplete=-someflag,"

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
6969
CmdArgs.push_back(Input.getFilename());
7070

7171
const auto& D = C.getDriver();
72-
const char* Exec = Args.MakeArgString(D.GetProgramPath("flang", TC));
72+
// TODO: Replace flang-new with flang once the new driver replaces the
73+
// throwaway driver
74+
const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC));
7375
C.addCommand(std::make_unique<Command>(
7476
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
7577
}
7678

77-
Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {}
79+
Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {}
7880

7981
Flang::~Flang() {}

clang/lib/Frontend/CreateInvocationFromCommandLine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine(
4040
Args.push_back("-fsyntax-only");
4141

4242
// FIXME: We shouldn't have to pass in the path info.
43-
driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(),
44-
*Diags, VFS);
43+
driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(), *Diags,
44+
"clang LLVM compiler", VFS);
4545

4646
// Don't check that inputs exist, they may have been remapped.
4747
TheDriver.setCheckInputsExist(false);

clang/lib/Tooling/Tooling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ newDriver(DiagnosticsEngine *Diagnostics, const char *BinaryName,
7878
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
7979
driver::Driver *CompilerDriver =
8080
new driver::Driver(BinaryName, llvm::sys::getDefaultTargetTriple(),
81-
*Diagnostics, std::move(VFS));
81+
*Diagnostics, "clang LLVM compiler", std::move(VFS));
8282
CompilerDriver->setTitle("clang_based_tool");
8383
return CompilerDriver;
8484
}

clang/test/Driver/flang/flang.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
! * (no type specified, resulting in an object file)
1414

1515
! All invocations should begin with flang -fc1, consume up to here.
16-
! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
16+
! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1"
1717

1818
! Check that f90 files are not treated as "previously preprocessed"
1919
! ... in --driver-mode=flang.

clang/test/Driver/flang/flang_ucase.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
! * (no type specified, resulting in an object file)
1414

1515
! All invocations should begin with flang -fc1, consume up to here.
16-
! ALL-LABEL: "{{[^"]*}}flang" "-fc1"
16+
! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1"
1717

1818
! Check that f90 files are not treated as "previously preprocessed"
1919
! ... in --driver-mode=flang.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
! Check that flang can handle mixed C and fortran inputs.
22

33
! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
4-
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
4+
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new{{[^"/]*}}" "-fc1"
55
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
66
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
77
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
! Check that flang driver can handle multiple inputs at once.
22

33
! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
4-
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
4+
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1"
55
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
6-
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
6+
! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1"
77
! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90"

clang/unittests/Driver/SanitizerArgsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class SanitizerArgsTest : public ::testing::Test {
5757
new DiagnosticIDs, Opts,
5858
new TextDiagnosticPrinter(llvm::errs(), Opts.get()));
5959
DriverInstance.emplace(ClangBinary, "x86_64-unknown-linux-gnu", Diags,
60-
prepareFS(ExtraFiles));
60+
"clang LLVM compiler", prepareFS(ExtraFiles));
6161

6262
std::vector<const char *> Args = {ClangBinary};
6363
for (const auto &A : ExtraArgs)

clang/unittests/Driver/ToolChainTest.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TEST(ToolChainTest, VFSGCCInstallation) {
3535
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
3636
new llvm::vfs::InMemoryFileSystem);
3737
Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags,
38-
InMemoryFileSystem);
38+
"clang LLVM compiler", InMemoryFileSystem);
3939

4040
const char *EmptyFiles[] = {
4141
"foo.cpp",
@@ -89,7 +89,7 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) {
8989
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
9090
new llvm::vfs::InMemoryFileSystem);
9191
Driver TheDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags,
92-
InMemoryFileSystem);
92+
"clang LLVM compiler", InMemoryFileSystem);
9393

9494
const char *EmptyFiles[] = {
9595
"foo.cpp", "/home/test/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o",
@@ -130,13 +130,13 @@ TEST(ToolChainTest, DefaultDriverMode) {
130130
new llvm::vfs::InMemoryFileSystem);
131131

132132
Driver CCDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags,
133-
InMemoryFileSystem);
133+
"clang LLVM compiler", InMemoryFileSystem);
134134
CCDriver.setCheckInputsExist(false);
135135
Driver CXXDriver("/home/test/bin/clang++", "arm-linux-gnueabi", Diags,
136-
InMemoryFileSystem);
136+
"clang LLVM compiler", InMemoryFileSystem);
137137
CXXDriver.setCheckInputsExist(false);
138138
Driver CLDriver("/home/test/bin/clang-cl", "arm-linux-gnueabi", Diags,
139-
InMemoryFileSystem);
139+
"clang LLVM compiler", InMemoryFileSystem);
140140
CLDriver.setCheckInputsExist(false);
141141

142142
std::unique_ptr<Compilation> CC(CCDriver.BuildCompilation(

flang/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ if (POLICY CMP0077)
1717
endif()
1818

1919
option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON)
20+
option(FLANG_BUILD_NEW_DRIVER "Build the flang compiler driver" OFF)
2021

2122
# Flang requires C++17.
2223
set(CMAKE_CXX_STANDARD 17)
@@ -61,6 +62,12 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
6162
get_filename_component(LLVM_DIR_ABSOLUTE ${LLVM_DIR} REALPATH)
6263
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE})
6364

65+
if(FLANG_BUILD_NEW_DRIVER)
66+
# TODO: Remove when libclangDriver is lifted out of Clang
67+
list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR})
68+
find_package(Clang REQUIRED HINTS "${CLANG_DIR}")
69+
endif()
70+
6471
# If LLVM links to zlib we need the imported targets so we can too.
6572
if(LLVM_ENABLE_ZLIB)
6673
find_package(ZLIB REQUIRED)
@@ -200,6 +207,21 @@ else()
200207
endif()
201208
endif()
202209

210+
if(FLANG_BUILD_NEW_DRIVER)
211+
# TODO: Remove when libclangDriver is lifted out of Clang
212+
if(FLANG_STANDALONE_BUILD)
213+
set(CLANG_INCLUDE_DIR ${CLANG_INCLUDE_DIRS} )
214+
# No need to specify TableGen output dir as that's embedded in CLANG_DIR
215+
else()
216+
set(CLANG_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../clang/include )
217+
# Specify TableGen output dir for things like DiagnosticCommonKinds.inc,
218+
# DiagnosticDriverKinds.inc (required for reporting diagnostics)
219+
set(CLANG_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/clang/include)
220+
include_directories(SYSTEM ${CLANG_TABLEGEN_OUTPUT_DIR})
221+
endif()
222+
include_directories(SYSTEM ${CLANG_INCLUDE_DIR})
223+
endif()
224+
203225
if(LINK_WITH_FIR)
204226
# tco tool and FIR lib output directories
205227
if(FLANG_STANDALONE_BUILD)

flang/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ cd ~/flang/build
143143
cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/flang/src
144144
make
145145
```
146+
147+
### Build The New Flang Driver
148+
The new Flang driver, `flang-new`, is currently under active development and
149+
should be considered as an experimental feature. For this reason it is disabled
150+
by default. This will change once the new driver replaces the _throwaway_
151+
driver, `flang`.
152+
153+
In order to build the new driver, add `-DBUILD_FLANG_NEW_DRIVER=ON` to your
154+
CMake invocation line. Additionally, when building out-of-tree, use `CLANG_DIR`
155+
(similarly to `LLVM_DIR` and `MLIR_DIR`) to find the installed Clang
156+
components.
157+
158+
**Note:** `CLANG_DIR` is only required when building the new Flang driver,
159+
which currently depends on Clang.
160+
146161
# How to Run Tests
147162

148163
Flang supports 2 different categories of tests
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
//===-- CompilerInstance.h - Flang Compiler Instance ------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#ifndef LLVM_FLANG_FRONTEND_COMPILERINSTANCE_H
9+
#define LLVM_FLANG_FRONTEND_COMPILERINSTANCE_H
10+
11+
#include "flang/Frontend/CompilerInvocation.h"
12+
13+
#include <cassert>
14+
#include <memory>
15+
16+
namespace Fortran::frontend {
17+
18+
class CompilerInstance {
19+
20+
/// The options used in this compiler instance.
21+
std::shared_ptr<CompilerInvocation> invocation_;
22+
23+
/// The diagnostics engine instance.
24+
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_;
25+
26+
public:
27+
explicit CompilerInstance();
28+
29+
~CompilerInstance();
30+
CompilerInvocation &GetInvocation() {
31+
assert(invocation_ && "Compiler instance has no invocation!");
32+
return *invocation_;
33+
};
34+
35+
/// }
36+
/// @name Forwarding Methods
37+
/// {
38+
39+
clang::DiagnosticOptions &GetDiagnosticOpts() {
40+
return invocation_->GetDiagnosticOpts();
41+
}
42+
const clang::DiagnosticOptions &GetDiagnosticOpts() const {
43+
return invocation_->GetDiagnosticOpts();
44+
}
45+
46+
FrontendOptions &GetFrontendOpts() { return invocation_->GetFrontendOpts(); }
47+
const FrontendOptions &GetFrontendOpts() const {
48+
return invocation_->GetFrontendOpts();
49+
}
50+
51+
/// }
52+
/// @name Diagnostics Engine
53+
/// {
54+
55+
bool HasDiagnostics() const { return diagnostics_ != nullptr; }
56+
57+
/// Get the current diagnostics engine.
58+
clang::DiagnosticsEngine &GetDiagnostics() const {
59+
assert(diagnostics_ && "Compiler instance has no diagnostics!");
60+
return *diagnostics_;
61+
}
62+
63+
/// SetDiagnostics - Replace the current diagnostics engine.
64+
void SetDiagnostics(clang::DiagnosticsEngine *value);
65+
66+
clang::DiagnosticConsumer &GetDiagnosticClient() const {
67+
assert(diagnostics_ && diagnostics_->getClient() &&
68+
"Compiler instance has no diagnostic client!");
69+
return *diagnostics_->getClient();
70+
}
71+
72+
/// Get the current diagnostics engine.
73+
clang::DiagnosticsEngine &getDiagnostics() const {
74+
assert(diagnostics_ && "Compiler instance has no diagnostics!");
75+
return *diagnostics_;
76+
}
77+
78+
/// }
79+
/// @name Construction Utility Methods
80+
/// {
81+
82+
/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
83+
///
84+
/// If no diagnostic client is provided, this creates a
85+
/// DiagnosticConsumer that is owned by the returned diagnostic
86+
/// object, if using directly the caller is responsible for
87+
/// releasing the returned DiagnosticsEngine's client eventually.
88+
///
89+
/// \param opts - The diagnostic options; note that the created text
90+
/// diagnostic object contains a reference to these options.
91+
///
92+
/// \param client If non-NULL, a diagnostic client that will be
93+
/// attached to (and, then, owned by) the returned DiagnosticsEngine
94+
/// object.
95+
///
96+
/// \return The new object on success, or null on failure.
97+
static clang::IntrusiveRefCntPtr<clang::DiagnosticsEngine> CreateDiagnostics(
98+
clang::DiagnosticOptions *opts,
99+
clang::DiagnosticConsumer *client = nullptr, bool shouldOwnClient = true);
100+
void CreateDiagnostics(
101+
clang::DiagnosticConsumer *client = nullptr, bool shouldOwnClient = true);
102+
};
103+
104+
} // end namespace Fortran::frontend
105+
#endif // LLVM_FLANG_FRONTEND_COMPILERINSTANCE_H

0 commit comments

Comments
 (0)