1 //===--- ExecuteCompilerInvocation.cpp ------------------------------------===// 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 // 9 // This file holds ExecuteCompilerInvocation(). It is split into its own file to 10 // minimize the impact of pulling in essentially everything else in Flang. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "flang/Frontend/CompilerInstance.h" 15 #include "clang/Driver/Options.h" 16 #include "llvm/Option/OptTable.h" 17 #include "llvm/Support/CommandLine.h" 18 19 namespace Fortran::frontend { 20 bool ExecuteCompilerInvocation(CompilerInstance *flang) { 21 // Honor -help. 22 if (flang->GetFrontendOpts().showHelp_) { 23 clang::driver::getDriverOptTable().PrintHelp(llvm::outs(), 24 "flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler", 25 /*Include=*/clang::driver::options::FlangOption, 26 /*Exclude=*/0, /*ShowAllAliases=*/false); 27 return true; 28 } 29 30 // Honor -version. 31 if (flang->GetFrontendOpts().showVersion_) { 32 llvm::cl::PrintVersionMessage(); 33 return true; 34 } 35 36 return true; 37 } 38 39 } // namespace Fortran::frontend 40