ExecuteCompilerInvocation.cpp
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//===--- ExecuteCompilerInvocation.cpp ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file holds ExecuteCompilerInvocation(). It is split into its own file to
// minimize the impact of pulling in essentially everything else in Flang.
//
//===----------------------------------------------------------------------===//
#include "flang/Frontend/CompilerInstance.h"
#include "clang/Driver/Options.h"
#include "llvm/Option/OptTable.h"
#include "llvm/Support/CommandLine.h"
namespace Fortran::frontend {
bool ExecuteCompilerInvocation(CompilerInstance *flang) {
// Honor -help.
if (flang->GetFrontendOpts().showHelp_) {
clang::driver::getDriverOptTable().PrintHelp(llvm::outs(),
"flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler",
/*Include=*/clang::driver::options::FC1Option,
/*Exclude=*/0, /*ShowAllAliases=*/false);
return true;
}
// Honor -version.
if (flang->GetFrontendOpts().showVersion_) {
llvm::cl::PrintVersionMessage();
return true;
}
return true;
}
} // namespace Fortran::frontend