Skip to content

Commit

Permalink
Port driver changes from release/11x
Browse files Browse the repository at this point in the history
Cherry-picked c51f89679135f84675f492d560ec5535c2000cfe by Varun Jayathirtha
from release_90, and resolved merge conflicts.

To avoid conflicts with the new Flang, lib/Driver/ToolChains/Flang.{cpp,h}
have been renamed to ClassicFlang.{cpp,h}, and the ENABLE_CLASSIC_FLANG macro
is introduced to select which incarnation of Flang to build. The macro is set
by running CMake with -DLLVM_ENABLE_CLASSIC_FLANG.

After merge with LLVM 11: Move flang options to the end of the definitions list.
  • Loading branch information
bryanpkc committed Apr 19, 2021
1 parent 59f78e8 commit 45a70a8
Show file tree
Hide file tree
Showing 32 changed files with 1,871 additions and 35 deletions.
10 changes: 10 additions & 0 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,16 @@ endif()

add_definitions( -D_GNU_SOURCE )

option(LLVM_ENABLE_CLASSIC_FLANG "Build support for classic Flang instead of the new built-in Flang" OFF)
if(LLVM_ENABLE_CLASSIC_FLANG)
add_definitions( -DENABLE_CLASSIC_FLANG )
endif()

option(FLANG_LLVM_EXTENSIONS "enable the Flang LLVM extensions" OFF)
if(FLANG_LLVM_EXTENSIONS)
add_definitions( -DFLANG_LLVM_EXTENSIONS )
endif()

option(CLANG_BUILD_TOOLS
"Build the Clang tools. If OFF, just generate build targets." ON)

Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/CodeGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class CodeGenOptions : public CodeGenOptionsBase {
Accelerate, // Use the Accelerate framework.
LIBMVEC, // GLIBC vector math library.
MASSV, // IBM MASS vector library.
#ifdef FLANG_LLVM_EXTENSIONS
PGMATH, // PGI math library.
#endif
SVML // Intel short vector math library.
};

Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def err_drv_invalid_linker_name : Error<
"invalid linker name in argument '%0'">;
def err_drv_invalid_rtlib_name : Error<
"invalid runtime library name in argument '%0'">;
def err_drv_invalid_allocatable_mode : Error<
"invalid semantic mode for assignments to allocatables in argument '%0'">;
def err_drv_unsupported_fixed_line_length : Error<
"unsupported fixed-format line length in argument '%0'">;
def err_drv_unsupported_rtlib_for_platform : Error<
"unsupported runtime library '%0' for platform '%1'">;
def err_drv_invalid_unwindlib_name : Error<
Expand Down Expand Up @@ -273,6 +277,8 @@ def err_drv_unsupported_embed_bitcode
: Error<"%0 is not supported with -fembed-bitcode">;
def err_drv_bitcode_unsupported_on_toolchain : Error<
"-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
def err_drv_clang_unsupported_minfo_arg : Error<
"'%0' option does not support '%1' value">;

def err_drv_invalid_malign_branch_EQ : Error<
"invalid argument '%0' to -malign-branch=; each element must be one of: %1">;
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Basic/MacroBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class MacroBuilder {
raw_ostream &Out;
public:
MacroBuilder(raw_ostream &Output) : Out(Output) {}
virtual ~MacroBuilder() {}

/// Append a \#define line for macro of the form "\#define Name Value\n".
void defineMacro(const Twine &Name, const Twine &Value = "1") {
virtual void defineMacro(const Twine &Name, const Twine &Value = "1") {
Out << "#define " << Name << ' ' << Value << '\n';
}

Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/Sanitizers.def
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ SANITIZER("signed-integer-overflow", SignedIntegerOverflow)
SANITIZER("unreachable", Unreachable)
SANITIZER("vla-bound", VLABound)
SANITIZER("vptr", Vptr)
// fortran contiguous pointer checks
SANITIZER("discontiguous", Discontiguous)

// IntegerSanitizer
SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
Expand Down
11 changes: 11 additions & 0 deletions clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Action {
AnalyzeJobClass,
MigrateJobClass,
CompileJobClass,
FortranFrontendJobClass,
BackendJobClass,
AssembleJobClass,
LinkJobClass,
Expand Down Expand Up @@ -455,6 +456,16 @@ class MigrateJobAction : public JobAction {
}
};

class FortranFrontendJobAction : public JobAction {
void anchor() override;
public:
FortranFrontendJobAction(Action *Input, types::ID OutputType);

static bool classof(const Action *A) {
return A->getKind() == FortranFrontendJobClass;
}
};

class CompileJobAction : public JobAction {
void anchor() override;

Expand Down
186 changes: 176 additions & 10 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class InternalDriverOpt : Group<internal_driver_Group>,
Flags<[NoXarchOption, HelpHidden]>;
def driver_mode : Joined<["--"], "driver-mode=">, Group<internal_driver_Group>,
Flags<[CoreOption, NoXarchOption, HelpHidden]>,
HelpText<"Set the driver mode to either 'gcc', 'g++', 'cpp', or 'cl'">;
HelpText<"Set the driver mode to either 'gcc', 'g++', 'cpp', 'cl', or 'fortran'">;
def rsp_quoting : Joined<["--"], "rsp-quoting=">, Group<internal_driver_Group>,
Flags<[CoreOption, NoXarchOption, HelpHidden]>,
HelpText<"Set the rsp quoting to either 'posix', or 'windows'">;
Expand Down Expand Up @@ -1993,12 +1993,21 @@ def fno_global_isel : Flag<["-"], "fno-global-isel">, Group<f_clang_Group>,
HelpText<"Disables the global instruction selector">;
def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
Alias<fno_global_isel>;
#ifdef FLANG_LLVM_EXTENSIONS
def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Use the given vector functions library">,
Values<"Accelerate,libmvec,MASSV,PGMATH,SVML,none">,
NormalizedValuesScope<"CodeGenOptions">,
NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "PGMATH", "SVML", "NoLibrary"]>,
MarshallingInfoString<CodeGenOpts<"VecLib">, "NoLibrary">, AutoNormalizeEnum;
#else
def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Use the given vector functions library">,
Values<"Accelerate,libmvec,MASSV,SVML,none">,
NormalizedValuesScope<"CodeGenOptions">,
NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "NoLibrary"]>,
MarshallingInfoString<CodeGenOpts<"VecLib">, "NoLibrary">, AutoNormalizeEnum;
#endif
def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>;
def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,
Expand Down Expand Up @@ -4075,19 +4084,28 @@ defm devirtualize : BooleanFFlag<"devirtualize">, Group<clang_ignored_gcc_optimi
defm devirtualize_speculatively : BooleanFFlag<"devirtualize-speculatively">,
Group<clang_ignored_gcc_optimization_f_Group>;

// gfortran options that we recognize in the driver and pass along when
// invoking GCC to compile Fortran code.
def flang_rt_Group : OptionGroup<"Flang runtime library Group">;
def pgi_fortran_Group : OptionGroup<"PGI Fortran compatibility Group">,
Flags<[HelpHidden]>;

// Generic gfortran options.
def A_DASH : Joined<["-"], "A-">, Group<gfortran_Group>;
def J : JoinedOrSeparate<["-"], "J">, Flags<[RenderJoined]>, Group<gfortran_Group>;
def cpp : Flag<["-"], "cpp">, Group<gfortran_Group>;
def nocpp : Flag<["-"], "nocpp">, Group<gfortran_Group>;
def cpp : Flag<["-"], "cpp">, Group<gfortran_Group>,
HelpText<"Preprocess Fortran files">;
def nocpp : Flag<["-"], "nocpp">, Group<gfortran_Group>,
HelpText<"Don't preprocess Fortran files">;
def static_libgfortran : Flag<["-"], "static-libgfortran">, Group<gfortran_Group>;

// "f" options with values for gfortran.
def fblas_matmul_limit_EQ : Joined<["-"], "fblas-matmul-limit=">, Group<gfortran_Group>;
def fcheck_EQ : Joined<["-"], "fcheck=">, Group<gfortran_Group>;
def fcoarray_EQ : Joined<["-"], "fcoarray=">, Group<gfortran_Group>;
def fconvert_EQ : Joined<["-"], "fconvert=">, Group<gfortran_Group>;
def ffixed_line_length_VALUE : Joined<["-"], "ffixed-line-length-">, Group<gfortran_Group>;
def ffixed_line_length_VALUE : Joined<["-"], "ffixed-line-length-">, Group<gfortran_Group>,
HelpText<"Set line length in fixed-form format Fortran, current supporting only 72 and 132 characters">;
def ffpe_trap_EQ : Joined<["-"], "ffpe-trap=">, Group<gfortran_Group>;
def ffree_line_length_VALUE : Joined<["-"], "ffree-line-length-">, Group<gfortran_Group>;
def finit_character_EQ : Joined<["-"], "finit-character=">, Group<gfortran_Group>;
Expand All @@ -4100,30 +4118,45 @@ def fmax_stack_var_size_EQ : Joined<["-"], "fmax-stack-var-size=">, Group<gfortr
def fmax_subrecord_length_EQ : Joined<["-"], "fmax-subrecord-length=">, Group<gfortran_Group>;
def frecord_marker_EQ : Joined<["-"], "frecord-marker=">, Group<gfortran_Group>;

// Define a group for Fortran source format
def fortran_format_Group : OptionGroup<"Fortran format Group">, Group<gfortran_Group>;
// "f" flags for gfortran.
defm aggressive_function_elimination : BooleanFFlag<"aggressive-function-elimination">, Group<gfortran_Group>;
defm align_commons : BooleanFFlag<"align-commons">, Group<gfortran_Group>;
defm all_intrinsics : BooleanFFlag<"all-intrinsics">, Group<gfortran_Group>;
defm automatic : BooleanFFlag<"automatic">, Group<gfortran_Group>;
defm backslash : BooleanFFlag<"backslash">, Group<gfortran_Group>;
def fbackslash: Flag<["-"], "fbackslash">, Group<gfortran_Group>,
HelpText<"Treat backslash as C-style escape character">;
def fnobackslash: Flag<["-"], "fno-backslash">, Group<gfortran_Group>,
HelpText<"Treat backslash like any other character in character strings">;
defm backtrace : BooleanFFlag<"backtrace">, Group<gfortran_Group>;
defm bounds_check : BooleanFFlag<"bounds-check">, Group<gfortran_Group>;
defm check_array_temporaries : BooleanFFlag<"check-array-temporaries">, Group<gfortran_Group>;
defm cray_pointer : BooleanFFlag<"cray-pointer">, Group<gfortran_Group>;
defm d_lines_as_code : BooleanFFlag<"d-lines-as-code">, Group<gfortran_Group>;
defm d_lines_as_comments : BooleanFFlag<"d-lines-as-comments">, Group<gfortran_Group>;
defm default_double_8 : BooleanFFlag<"default-double-8">, Group<gfortran_Group>;
defm default_integer_8 : BooleanFFlag<"default-integer-8">, Group<gfortran_Group>;
defm default_real_8 : BooleanFFlag<"default-real-8">, Group<gfortran_Group>;
def default_integer_8_f : Flag<["-"], "fdefault-integer-8">, Group<gfortran_Group>,
HelpText<"Treat INTEGER and LOGICAL as INTEGER*8 and LOGICAL*8">;
def default_integer_8_fno : Flag<["-"], "fno-default-integer-8">, Group<gfortran_Group>;
def default_real_8_f : Flag<["-"], "fdefault-real-8">, Group<gfortran_Group>,
HelpText<"Treat REAL as REAL*8">;
def default_real_8_fno : Flag<["-"], "fno-default-real-8">, Group<gfortran_Group>;
defm dollar_ok : BooleanFFlag<"dollar-ok">, Group<gfortran_Group>;
defm dump_fortran_optimized : BooleanFFlag<"dump-fortran-optimized">, Group<gfortran_Group>;
defm dump_fortran_original : BooleanFFlag<"dump-fortran-original">, Group<gfortran_Group>;
defm dump_parse_tree : BooleanFFlag<"dump-parse-tree">, Group<gfortran_Group>;
defm external_blas : BooleanFFlag<"external-blas">, Group<gfortran_Group>;
defm f2c : BooleanFFlag<"f2c">, Group<gfortran_Group>;
defm fixed_form : BooleanFFlag<"fixed-form">, Group<gfortran_Group>;
defm free_form : BooleanFFlag<"free-form">, Group<gfortran_Group>;
defm frontend_optimize : BooleanFFlag<"frontend-optimize">, Group<gfortran_Group>;
def fixed_form_on : Flag<["-"], "ffixed-form">, Group<fortran_format_Group>,
HelpText<"Enable fixed-form format for Fortran">;
def fixed_form_off : Flag<["-"], "fno-fixed-form">, Group<fortran_format_Group>,
HelpText<"Disable fixed-form format for Fortran">;
def free_form_on : Flag<["-"], "ffree-form">, Group<fortran_format_Group>,
HelpText<"Enable free-form format for Fortran">;
def free_form_off : Flag<["-"], "fno-free-form">, Group<fortran_format_Group>,
HelpText<"Disable free-form format for Fortran">;
defm frontend_optimize : BooleanFFlag<"frontend-optimize">, Group<fortran_format_Group>;
defm implicit_none : BooleanFFlag<"implicit-none">, Group<gfortran_Group>;
defm init_local_zero : BooleanFFlag<"init-local-zero">, Group<gfortran_Group>;
defm integer_4_integer_8 : BooleanFFlag<"integer-4-integer-8">, Group<gfortran_Group>;
Expand Down Expand Up @@ -5847,3 +5880,136 @@ def _SLASH_Ze : CLFlag<"Ze">;
def _SLASH_Zg : CLFlag<"Zg">;
def _SLASH_ZI : CLFlag<"ZI">;
def _SLASH_ZW : CLJoined<"ZW">;

// Flang-specific options
multiclass BooleanKFlag<string name> {
def _on : Flag<["-"], "K"#name>;
def _off : Flag<["-"], "Kno"#name>;
}

multiclass BooleanMFlag<string name> {
def _on : Flag<["-"], "M"#name>;
def _off : Flag<["-"], "Mno"#name>;
}

def Mfixed : Flag<["-"], "Mfixed">, Group<fortran_format_Group>,
HelpText<"Force fixed-form format Fortran">,
Flags<[HelpHidden]>;
def Mfree_on: Flag<["-"], "Mfree">, Group<fortran_format_Group>,
HelpText<"Enable free-form format for Fortran">,
Flags<[HelpHidden]>;
def Mfree_off: Flag<["-"], "Mnofree">, Group<fortran_format_Group>,
HelpText<"Disable free-form format for Fortran">,
Flags<[HelpHidden]>;
def Mfreeform_on: Flag<["-"], "Mfreeform">, Group<fortran_format_Group>,
HelpText<"Enable free-form format for Fortran">,
Flags<[HelpHidden]>;
def Mfreeform_off: Flag<["-"], "Mnofreeform">, Group<fortran_format_Group>,
HelpText<"Disable free-form format for Fortran">,
Flags<[HelpHidden]>;

def Minfo_EQ : CommaJoined<["-"], "Minfo=">,
HelpText<"Diagnostic information about successful optimizations">,
Values<"all,vect,inline">;
def Minfoall : Flag<["-"], "Minfo">,
HelpText<"Diagnostic information about all successful optimizations">;
def Mneginfo_EQ : CommaJoined<["-"], "Mneginfo=">,
HelpText<"Diagnostic information about missed optimizations">,
Values<"all,vect,inline">;
def Mneginfoall : Flag<["-"], "Mneginfo">,
HelpText<"Diagnostic information about all missed optimizations">;

def Mipa: Joined<["-"], "Mipa">, Group<pgi_fortran_Group>;
def Mstackarrays: Joined<["-"], "Mstack_arrays">, Group<pgi_fortran_Group>;
def pc: JoinedOrSeparate<["-"], "pc">, Group<pgi_fortran_Group>;
def Mfprelaxed: Joined<["-"], "Mfprelaxed">, Group<pgi_fortran_Group>;
def Mnofprelaxed: Joined<["-"], "Mnofprelaxed">, Group<pgi_fortran_Group>;
defm Mstride0: BooleanMFlag<"stride0">, Group<pgi_fortran_Group>;
defm Mrecursive: BooleanMFlag<"recursive">, Group<pgi_fortran_Group>;
defm Mreentrant: BooleanMFlag<"reentrant">, Group<pgi_fortran_Group>;
defm Mbounds: BooleanMFlag<"bounds">, Group<pgi_fortran_Group>;
def Mdaz_on: Flag<["-"], "Mdaz">, Group<pgi_fortran_Group>,
HelpText<"Treat denormalized numbers as zero">;
def Mdaz_off: Flag<["-"], "Mnodaz">, Group<pgi_fortran_Group>,
HelpText<"Disable treating denormalized numbers as zero">;
def Kieee_on : Flag<["-"], "Kieee">, Group<pgi_fortran_Group>,
HelpText<"Enable IEEE division">;
def Kieee_off : Flag<["-"], "Knoieee">, Group<pgi_fortran_Group>,
HelpText<"Disable IEEE division">;
def Mextend : Flag<["-"], "Mextend">, Group<pgi_fortran_Group>,
HelpText<"Allow lines up to 132 characters in Fortran sources">;
def Mpreprocess : Flag<["-"], "Mpreprocess">, Group<pgi_fortran_Group>,
HelpText<"Preprocess Fortran files">;
def Mstandard: Flag<["-"], "Mstandard">, Group<pgi_fortran_Group>,
HelpText<"Check Fortran standard conformance">;
def Mchkptr: Flag<["-"], "Mchkptr">, Group<pgi_fortran_Group>;
def Mwritable_constants: Flag<["-"], "Mwritable-constants">, Group<pgi_fortran_Group>,
HelpText<"Store constants in the writable data segment">;
defm Minline: BooleanMFlag<"inline">, Group<pgi_fortran_Group>;
def fma: Flag<["-"], "fma">, Group<pgi_fortran_Group>,
HelpText<"Enable generation of FMA instructions">;
def nofma: Flag<["-"], "nofma">, Group<pgi_fortran_Group>,
HelpText<"Disable generation of FMA instructions">;
defm Mfma: BooleanMFlag<"fma">, Group<pgi_fortran_Group>,
HelpText<"Enable generation of FMA instructions">;
def mp: Flag<["-"], "mp">, Group<pgi_fortran_Group>,
HelpText<"Enable OpenMP">;
def nomp: Flag<["-"], "nomp">, Group<pgi_fortran_Group>,
HelpText<"Do not link with OpenMP library libomp">;
def Mflushz_on: Flag<["-"], "Mflushz">, Group<pgi_fortran_Group>,
HelpText<"Set SSE to flush-to-zero mode">;
def Mflushz_off: Flag<["-"], "Mnoflushz">, Group<pgi_fortran_Group>,
HelpText<"Disabling setting SSE to flush-to-zero mode">;
def Msave_on: Flag<["-"], "Msave">, Group<pgi_fortran_Group>,
HelpText<"Assume all Fortran variables have SAVE attribute">;
def Msave_off: Flag<["-"], "Mnosave">, Group<pgi_fortran_Group>,
HelpText<"Assume no Fortran variables have SAVE attribute">;
def Mcache_align_on: Flag<["-"], "Mcache_align">, Group<pgi_fortran_Group>,
HelpText<"Align large objects on cache-line boundaries">;
def Mcache_align_off: Flag<["-"], "Mnocache_align">, Group<pgi_fortran_Group>,
HelpText<"Disable aligning large objects on cache-line boundaries">;
def ModuleDir : Separate<["-"], "module">, Group<pgi_fortran_Group>,
HelpText<"Fortran module path">;
def Minform_EQ : Joined<["-"], "Minform=">,
HelpText<"Set error level of messages to display">;
def Mallocatable_EQ : Joined<["-"], "Mallocatable=">,
HelpText<"Select semantics for assignments to allocatables (F03 or F95)">;
def Mbyteswapio: Flag<["-"], "Mbyteswapio">, Group<pgi_fortran_Group>,
HelpText<"Swap byte-order for unformatted input/output">;
def byteswapio: Flag<["-"], "byteswapio">, Group<gfortran_Group>,
HelpText<"Swap byte-order for unformatted input/output">;
def Mbackslash: Flag<["-"], "Mbackslash">, Group<pgi_fortran_Group>,
HelpText<"Treat backslash like any other character in character strings">;
def Mnobackslash: Flag<["-"], "Mnobackslash">, Group<pgi_fortran_Group>,
HelpText<"Treat backslash as C-style escape character">;
def staticFlangLibs: Flag<["-"], "static-flang-libs">, Group<flang_rt_Group>,
HelpText<"Link using static Flang libraries">;
def noFlangLibs: Flag<["-"], "no-flang-libs">, Group<flang_rt_Group>,
HelpText<"Do not link against Flang libraries">;
def r8: Flag<["-"], "r8">, Group<pgi_fortran_Group>,
HelpText<"Treat REAL as REAL*8">;
def i8: Flag<["-"], "i8">, Group<pgi_fortran_Group>,
HelpText<"Treat INTEGER and LOGICAL as INTEGER*8 and LOGICAL*8">;
def no_fortran_main: Flag<["-"], "fno-fortran-main">, Group<gfortran_Group>,
HelpText<"Don't link in Fortran main">;
def Mnomain: Flag<["-"], "Mnomain">, Group<pgi_fortran_Group>,
HelpText<"Don't link in Fortran main">;
def frelaxed_math : Flag<["-"], "frelaxed-math">, Group<pgi_fortran_Group>,
HelpText<"Use relaxed Math intrinsic functions">;
def Memit_dwarf_common_blocks_name: Flag<["-"], "Memit-dwarf-common-blocks-name">,
Group<pgi_fortran_Group>, HelpText<"Emit COMMON blocks name in DWARF">;
def Munixlogical: Flag<["-"], "Munixlogical">, Group<pgi_fortran_Group>,
HelpText<"Use unixlogical for all loigical operations">;

// Flang internal debug options
def Mx_EQ : Joined<["-"], "Mx,">, Group<pgi_fortran_Group>;
def My_EQ : Joined<["-"], "My,">, Group<pgi_fortran_Group>;
def Hx_EQ : Joined<["-"], "Hx,">, Group<pgi_fortran_Group>;
def Hy_EQ : Joined<["-"], "Hy,">, Group<pgi_fortran_Group>;
def Wm_EQ : Joined<["-"], "Wm,">, Group<pgi_fortran_Group>;

def Mq_EQ : Joined<["-"], "Mq,">, Group<pgi_fortran_Group>;
def Hq_EQ : Joined<["-"], "Hq,">, Group<pgi_fortran_Group>;
def Mqq_EQ : Joined<["-"], "Mqq,">, Group<pgi_fortran_Group>;
def Hqq_EQ : Joined<["-"], "Hqq,">, Group<pgi_fortran_Group>;
def Wh_EQ : Joined<["-"], "Wh,">, Group<pgi_fortran_Group>;
1 change: 1 addition & 0 deletions clang/include/clang/Driver/Phases.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace phases {
enum ID {
Preprocess,
Precompile,
FortranFrontend,
Compile,
Backend,
Assemble,
Expand Down
15 changes: 15 additions & 0 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class ToolChain {

mutable std::unique_ptr<Tool> Clang;
mutable std::unique_ptr<Tool> Flang;
mutable std::unique_ptr<Tool> FortranFrontend;
mutable std::unique_ptr<Tool> Assemble;
mutable std::unique_ptr<Tool> Link;
mutable std::unique_ptr<Tool> StaticLibTool;
Expand All @@ -147,6 +148,7 @@ class ToolChain {

Tool *getClang() const;
Tool *getFlang() const;
Tool *getFortranFrontend() const;
Tool *getAssemble() const;
Tool *getLink() const;
Tool *getStaticLibTool() const;
Expand Down Expand Up @@ -568,6 +570,14 @@ class ToolChain {
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;

/// \brief Add the flang arguments for system include paths.
///
/// This routine is responsible for adding the -stdinc argument to
/// include headers and module files from standard system header directories.
virtual void
AddFlangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &Flang1Args) const { }

/// Add options that need to be passed to cc1 for this target.
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
Expand Down Expand Up @@ -653,6 +663,11 @@ class ToolChain {
virtual VersionTuple computeMSVCVersion(const Driver *D,
const llvm::opt::ArgList &Args) const;

/// AddFortranStdlibLibArgs - Add the system specific linker arguments to use
/// for the given Fortran runtime library type.
virtual void AddFortranStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;

/// Return sanitizers which are available in this toolchain.
virtual SanitizerMask getSupportedSanitizers() const;

Expand Down
Loading

0 comments on commit 45a70a8

Please sign in to comment.