[flang-commits] [clang] [flang] [flang] Fix compiler invocation issue (#232487) (PR #235473)
via flang-commits
flang-commits at lists.llvm.org
Sun Oct 25 08:52:01 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-driver
Author: Harshit (Harshit2906)
<details>
<summary>Changes</summary>
Fixes #<!-- -->232487
---
Patch is 134.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/235473.diff
2 Files Affected:
- (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+51-306)
- (modified) flang/lib/Frontend/CompilerInvocation.cpp (+365-1386)
``````````diff
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 79859e724a8179..f04e199b46fe17 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -20,8 +20,6 @@ def err_drv_unsupported_opt_for_language_mode : Error<
"unsupported option '%0' for language mode '%1'">;
def err_drv_unsupported_option_argument : Error<
"unsupported argument '%1' to option '%0'">;
-def err_drv_unsupported_option_argument_for_target : Error<
- "unsupported argument '%1' to option '%0' for target '%2'">;
def err_drv_unknown_stdin_type : Error<
"-E or -x required when input is from standard input">;
def err_drv_unknown_stdin_type_clang_cl : Error<
@@ -33,13 +31,12 @@ def err_drv_invalid_riscv_arch_name : Error<
"invalid arch name '%0', %1">;
def err_drv_invalid_riscv_cpu_name_for_target : Error<
"cpu '%0' does not support rv%select{32|64}1">;
-def err_drv_invalid_riscv_mtune_string : Error<
- "invalid %select{-mtune|tune feature}0 string '%1': %2">;
def warn_drv_invalid_arch_name_with_suggestion : Warning<
"ignoring invalid /arch: argument '%0'; for %select{64|32}1-bit expected one of %2">,
InGroup<UnusedCommandLineArgument>;
def warn_drv_avr_mcu_not_specified : Warning<
- "no target microcontroller specified, please pass -mmcu=<mcu name>">,
+ "no target microcontroller specified on command line, cannot "
+ "link standard libraries, please pass -mmcu=<mcu name>">,
InGroup<AVRRtlibLinkingQuirks>;
def warn_drv_avr_libc_not_found: Warning<
"no avr-libc installation can be found on the system, "
@@ -58,8 +55,6 @@ def warn_drv_avr_stdlib_not_linked: Warning<
InGroup<AVRRtlibLinkingQuirks>;
def err_drv_cuda_bad_gpu_arch : Error<"unsupported CUDA gpu architecture: %0">;
def err_drv_offload_bad_gpu_arch : Error<"unsupported %0 gpu architecture: %1">;
-def err_drv_offload_missing_gpu_arch : Error<
- "must pass in an explicit %0 gpu architecture to '%1'">;
def err_drv_no_cuda_installation : Error<
"cannot find CUDA installation; provide its path via '--cuda-path', or pass "
"'-nocudainc' to build without CUDA includes">;
@@ -69,51 +64,24 @@ def err_drv_no_cuda_libdevice : Error<
"libdevice">;
def err_drv_no_rocm_device_lib : Error<
- "cannot find ROCm device library%select{| for %1| for ABI version %1"
- "%select{|, which requires ROCm %3 or higher}2}0; provide its path via "
+ "cannot find ROCm device library%select{| for %1|for ABI version %1}0; provide its path via "
"'--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build "
"without ROCm device library">;
def err_drv_no_hip_runtime : Error<
"cannot find HIP runtime; provide its path via '--rocm-path', or pass "
"'-nogpuinc' to build without HIP runtime">;
-def err_drv_no_hipstdpar_lib : Error<
- "cannot find HIP Standard Parallelism Acceleration library; provide it via "
- "'--hipstdpar-path'">;
-def err_drv_no_hipstdpar_thrust_lib : Error<
- "cannot find rocThrust, which is required by the HIP Standard Parallelism "
- "Acceleration library; provide it via "
- "'--hipstdpar-thrust-path'">;
-def err_drv_no_hipstdpar_prim_lib : Error<
- "cannot find rocPrim, which is required by the HIP Standard Parallelism "
- "Acceleration library; provide it via '--hipstdpar-prim-path'">;
def err_drv_no_hipspv_device_lib : Error<
"cannot find HIP device library%select{| for %1}0; provide its path via "
"'--hip-path' or '--hip-device-lib-path', or pass '-nogpulib' to build "
"without HIP device library">;
def err_drv_hipspv_no_hip_path : Error<
- "'--hip-path' must be specified when offloading to SPIR-V unless '-nogpuinc' "
- "is given">;
-
-def err_drv_sycl_no_rdc_multiple_targets : Error<
- "'%0' is not supported with multiple SYCL offloading targets">;
-
-// SYCL Windows-specific diagnostics
-def err_drv_sycl_requires_dynamic_crt : Error<
- "SYCL requires dynamic C++ runtime (/MD or /MDd); "
- "static C++ runtime (/MT or /MTd) is not supported">;
-
-def err_drv_no_spv_tools : Error<"cannot find SPIR-V Tools binary '%0', which "
- "is required for SPIR-V compilation. "
- "It can be obtained from your system package "
- "manager or from KhronosGroup/SPIRV-Tools "
- "on GitHub">;
+ "'--hip-path' must be specified when offloading to "
+ "SPIR-V%select{| unless %1 is given}0.">;
def err_drv_undetermined_gpu_arch : Error<
- "cannot determine %0 architecture: %1; consider passing it via '%2'; "
- "environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool "
- "timeout (integer secs, <=0 is infinite)">;
-
+ "cannot determine %0 architecture: %1; consider passing it via "
+ "'%2'">;
def warn_drv_multi_gpu_arch : Warning<
"multiple %0 architectures are detected: %1; only the first one is used for "
"'%2'">, InGroup<MultiGPU>;
@@ -132,8 +100,6 @@ def err_drv_cuda_host_arch : Error<
"unsupported architecture '%0' for host compilation">;
def err_drv_mix_cuda_hip : Error<
"mixed CUDA and HIP compilation is not supported">;
-def err_drv_mix_offload : Error<
- "mixed %0 and %1 offloading compilation is not supported">;
def err_drv_bad_target_id : Error<
"invalid target ID '%0'; format is a processor name followed by an optional "
"colon-delimited list of features followed by an enable/disable sign (e.g., "
@@ -142,9 +108,6 @@ def err_drv_bad_offload_arch_combo : Error<
"invalid offload arch combinations: '%0' and '%1' (for a specific processor, "
"a feature should either exist in all offload archs, or not exist in any "
"offload archs)">;
-def err_drv_unsupported_option_for_offload_arch_req_feature : Error<
- "'%0' option for offload arch '%1' is not currently supported "
- "there. Use it with an offload arch containing '%2' instead">;
def warn_drv_unsupported_option_for_offload_arch_req_feature : Warning<
"ignoring '%0' option for offload arch '%1' as it is not currently supported "
"there. Use it with an offload arch containing '%2' instead">,
@@ -152,43 +115,16 @@ def warn_drv_unsupported_option_for_offload_arch_req_feature : Warning<
def warn_drv_unsupported_option_for_target : Warning<
"ignoring '%0' option as it is not currently supported for target '%1'">,
InGroup<OptionIgnored>;
-def err_drv_unsupported_option_for_target : Error<
- "'%0' option is not currently supported for target '%1'">;
-def warn_drv_unsupported_option_part_for_target : Warning<
- "ignoring '%0' in '%1' option as it is not currently supported for target '%2'">,
- InGroup<OptionIgnored>;
-def err_drv_unsupported_option_part_for_target : Error<
- "'%0' in '%1' option is not currently supported for target '%2'">;
-def warn_drv_invalid_argument_for_flang : Warning<
- "'%0' is not valid for Fortran">,
- InGroup<OptionIgnored>;
def warn_drv_unsupported_option_for_flang : Warning<
"the argument '%0' is not supported for option '%1'. Mapping to '%1%2'">,
InGroup<OptionIgnored>;
def warn_drv_unsupported_diag_option_for_flang : Warning<
- "the warning option '-%0' is not supported">,
+ "The warning option '-%0' is not supported">,
InGroup<OptionIgnored>;
def warn_drv_unsupported_option_for_processor : Warning<
"ignoring '%0' option as it is not currently supported for processor '%1'">,
InGroup<OptionIgnored>;
-def warn_drv_unsupported_option_for_runtime : Warning<
- "ignoring '%0' option as it is not currently supported for runtime '%1'">,
- InGroup<OptionIgnored>;
-def warn_drv_hexagon_reserved_caller_saved_reg : Warning<
- "reserving the caller-saved register '%0' may lead to incorrect code if it "
- "is not also reserved in all other translation units and libraries; you are "
- "responsible for ensuring the register is managed consistently">,
- InGroup<DiagGroup<"hexagon-reserved-caller-saved">>;
-def warn_drv_unsupported_openmp_library : Warning<
- "the library '%0=%1' is not supported, OpenMP will not be enabled">,
- InGroup<OptionIgnored>;
-def warn_openmp_impl_incomplete : Warning<
- "OpenMP support for version %0 in flang is still incomplete">,
- InGroup<ExperimentalOption>;
-def warn_openmp_spec_incomplete : Warning<
- "the specification for OpenMP version %0 is still under development; "
- "the syntax and semantics of new features may be subject to change">,
- InGroup<ExperimentalOption>;
+
def err_drv_invalid_thread_model_for_target : Error<
"invalid thread model '%0' in '%1' for this target">;
def err_drv_invalid_linker_name : Error<
@@ -199,14 +135,10 @@ def err_drv_unsupported_rtlib_for_platform : Error<
"unsupported runtime library '%0' for platform '%1'">;
def err_drv_invalid_unwindlib_name : Error<
"invalid unwind library name in argument '%0'">;
-def err_drv_unsupported_unwind_for_platform : Error<
- "unsupported unwind library '%0' for platform '%1'">;
def err_drv_incompatible_unwindlib : Error<
"--rtlib=libgcc requires --unwindlib=libgcc">;
def err_drv_incompatible_options : Error<
"the combination of '%0' and '%1' is incompatible">;
-def err_drv_invalid_cstdlib_name : Error<
- "invalid C library name in argument '%0'">;
def err_drv_invalid_stdlib_name : Error<
"invalid library name in argument '%0'">;
def err_drv_invalid_output_with_multiple_archs : Error<
@@ -240,26 +172,16 @@ def err_drv_invalid_Xopenmp_target_with_args : Error<
"invalid -Xopenmp-target argument: '%0', options requiring arguments are unsupported">;
def err_drv_argument_only_allowed_with : Error<
"invalid argument '%0' only allowed with '%1'">;
-def err_drv_opt_unsupported_input_type : Error<
- "'%0' invalid for input of type %1">;
+def err_drv_minws_unsupported_input_type : Error<
+ "'-fminimize-whitespace' invalid for input of type %0">;
def err_drv_amdgpu_ieee_without_no_honor_nans : Error<
"invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling">;
def err_drv_argument_not_allowed_with : Error<
"invalid argument '%0' not allowed with '%1'">;
-def warn_drv_argument_not_allowed_with : Warning<
- "invalid argument '%0' not allowed with '%1'">,
- InGroup<OptionIgnored>;
-def err_drv_sycl_requires_cxx17 : Error<
- "SYCL requires C++17 or later; '%0' is not supported">;
def err_drv_cannot_open_randomize_layout_seed_file : Error<
"cannot read randomize layout seed file '%0'">;
def err_drv_invalid_version_number : Error<
"invalid version number in '%0'">;
-def err_drv_invalid_version_number_inferred
- : Error<"invalid version number '%0' inferred from '%1'">;
-def err_drv_missing_version_number : Error<"missing version number in '%0'">;
-def err_drv_kcfi_arity_unsupported_target : Error<
- "target '%0' is unsupported by -fsanitize-kcfi-arity">;
def err_drv_no_linker_llvm_support : Error<
"'%0': unable to pass LLVM bit-code files to linker">;
def err_drv_no_ast_support : Error<
@@ -328,11 +250,6 @@ def err_cpu_unsupported_isa
def err_arch_unsupported_isa
: Error<"architecture '%0' does not support '%1' execution mode">;
-def err_zos_target_release_discontinued
- : Error<"z/OS target level \"%0\" is discontinued">;
-def err_zos_target_unrecognized_release
- : Error<"z/OS target level \"%0\" is invalid">;
-
def err_drv_I_dash_not_supported : Error<
"'%0' not supported, please use -iquote instead">;
def err_drv_unknown_argument : Error<"unknown argument: '%0'">;
@@ -356,12 +273,8 @@ def warn_drv_yc_multiple_inputs_clang_cl : Warning<
def warn_drv_potentially_misspelled_joined_argument : Warning<
"joined argument treated as '%0'; did you mean '%1'?">, InGroup<UnknownArgument>;
-def err_drv_too_many_actions: Error<
- "only one action option is allowed. Got %0">;
def err_drv_invalid_value : Error<"invalid value '%1' in '%0'">;
def err_drv_invalid_int_value : Error<"invalid integral value '%1' in '%0'">;
-def err_drv_invalid_escaped_command_line
- : Error<"invalid escaped command line: %0">;
def err_drv_invalid_value_with_suggestion : Error<
"invalid value '%1' in '%0', expected one of: %2">;
def err_drv_alignment_not_power_of_two : Error<"alignment is not a power of 2 in '%0'">;
@@ -412,11 +325,9 @@ def err_drv_optimization_remark_format : Error<
def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">;
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">;
-def err_drv_dyndbg_lto : Error<"'-fdynamic-debugging' incompatible with '-flto'">;
-def err_drv_dyndbg_incompatible : Error<"'-fdynamic-debugging' incompatible with '%0'">;
-def err_drv_dyndbg_ir : Error<"'-fdynamic-debugging' incompatible with IR input">;
-def warn_drv_dyndbg_req_debug : Warning<"'-fdynamic-debugging' ignored: requires debug info">,
- InGroup<DynamicDebugging>;
+def err_drv_omp_host_ir_file_not_found : Error<
+ "provided host compiler IR file '%0' is required to generate code for OpenMP "
+ "target regions but cannot be found">;
def err_drv_omp_host_target_not_supported : Error<
"target '%0' is not a supported OpenMP host target">;
def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
@@ -424,7 +335,7 @@ def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
"compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5'">;
def err_drv_failed_to_deduce_target_from_arch : Error<
"failed to deduce triple for target architecture '%0'; specify the triple "
- "using '-fopenmp-targets' and '-Xopenmp-target' instead">;
+ "using '-fopenmp-targets' and '-Xopenmp-target' instead.">;
def err_drv_omp_offload_target_missingbcruntime : Error<
"no library '%0' found in the default clang lib directory or in LIBRARY_PATH"
"; use '--libomptarget-%1-bc-path' to specify %1 bitcode library">;
@@ -444,13 +355,8 @@ def err_drv_negative_columns : Error<
def err_drv_small_columns : Error<
"invalid value '%1' in '%0', value must be '%2' or greater">;
def err_drv_large_columns : Error<
- "invalid value '%1' in '%0', value must be '%2' or smaller">;
-def warn_drv_fraw_string_literals_in_cxx11 : Warning<
- "ignoring '-f%select{no-|}0raw-string-literals', which is only valid for C and C++ standards before C++11">,
- InGroup<UnusedCommandLineArgument>;
-
-def err_drv_libclc_not_found : Error<"no libclc library '%0' found in the clang resource directory">;
-
+ "invalid value '%1' in '%0', value must be '2147483647' or smaller">;
+
def err_drv_invalid_malign_branch_EQ : Error<
"invalid argument '%0' to -malign-branch=; each element must be one of: %1">;
@@ -458,14 +364,8 @@ def err_drv_print_header_env_var : Error<
"environment variable CC_PRINT_HEADERS_%select{FORMAT|FILTERING}0 has invalid value %1">;
def err_drv_print_header_env_var_combination : Error<
"unsupported combination: CC_PRINT_HEADERS_FORMAT=%0 and CC_PRINT_HEADERS_FILTERING=%1">;
-def err_drv_print_header_env_var_invalid_format : Error<
- "environment variable CC_PRINT_HEADERS_FORMAT=%0 requires a compatible value for CC_PRINT_HEADERS_FILTERING">;
-def err_drv_print_header_cc1_invalid_combination : Error<
+def err_drv_print_header_env_var_combination_cc1 : Error<
"unsupported combination: -header-include-format=%0 and -header-include-filtering=%1">;
-def err_drv_print_header_cc1_invalid_filtering : Error<
- "-header-include-filtering=%0 requires a compatible value for -header-include-format">;
-def err_drv_print_header_cc1_invalid_format : Error<
- "-header-include-format=%0 requires a compatible value for -header-include-filtering">;
def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;
def warn_drv_optimization_value : Warning<"optimization level '%0' is not supported; using '%1%2' instead">,
@@ -477,9 +377,6 @@ def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and w
def warn_drv_unsupported_opt_for_target : Warning<
"optimization flag '%0' is not supported for target '%1'">,
InGroup<IgnoredOptimizationArgument>;
-def warn_drv_riscv_be_experimental : Warning<
- "big-endian RISC-V target support is experimental">,
- InGroup<RISCVBEExperimental>;
def warn_drv_unsupported_debug_info_opt_for_target : Warning<
"debug information option '%0' is not supported for target '%1'">,
InGroup<UnsupportedTargetOpt>;
@@ -489,6 +386,9 @@ def warn_drv_dwarf_version_limited_by_target : Warning<
InGroup<UnsupportedTargetOpt>;
def warn_c_kext : Warning<
"ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;
+def warn_ignoring_fdiscard_for_bitcode : Warning<
+ "ignoring -fdiscard-value-names for LLVM Bitcode">,
+ InGroup<UnusedCommandLineArgument>;
def warn_drv_input_file_unused : Warning<
"%0: '%1' input unused%select{ when '%3' is present|}2">,
InGroup<UnusedCommandLineArgument>;
@@ -516,17 +416,7 @@ def warn_drv_diagnostics_misexpect_requires_pgo : Warning<
def warn_drv_clang_unsupported : Warning<
"the clang compiler does not support '%0'">;
def warn_drv_deprecated_arg : Warning<
- "argument '%0' is deprecated%select{|, use '%2' instead}1">, InGroup<Deprecated>;
-def warn_drv_deprecated_arg_ofast : Warning<
- "argument '-Ofast' is deprecated; use '-O3' to enable only conforming optimizations, "
- "or consult the documentation for the same behavior">,
- InGroup<DeprecatedOFast>;
-def warn_drv_deprecated_arg_ofast_for_flang : Warning<
- "argument '-Ofast' is deprecated; use '-O3 -ffast-math -fstack-arrays -fno-protect-parens' for the same behavior,"
- " or '-O3 -fstack-arrays' to enable only conforming optimizations">,
- InGroup<DeprecatedOFast>;
-def warn_drv_deprecated_custom : Warning<
- "argument '%0' is deprecated, %1">, InGroup<Deprecated>;
+ "argument '%0' is deprecated, use '%1' instead">, InGroup<Deprecated>;
def warn_drv_assuming_mfloat_abi_is : Warning<
"unknown platform, assuming -mfloat-abi=%0">;
def warn_drv_unsupported_float_abi_by_lib : Warning<
@@ -537,34 +427,20 @@ def warn_drv_no_floating_point_registers: Warning<
InGroup<UnsupportedABI>;
def warn_ignoring_ftabstop_value : Warning<
"ignoring invalid -ftabstop value '%0', using default value %1">;
-def warn_drv_overriding_option : Warning<
+def warn_drv_overriding_flag_option : Warning<
"overriding '%0' option with '%1'">,
- InGroup<DiagGroup<"overriding-option">>;
-def warn_drv_overriding_deployment_version
- : Warning<"overriding deployment version from '%0' to '%1'">,
- InGroup<DiagGroup<"overriding-deployment-version">>;
-def warn_drv_overriding_complex_range : Warning<
- "'%1' sets complex range to \"%3\" overriding the setting of \"%2\" that was implied by '%0'">,
- InGroup<DiagGroup<"overriding-complex-range">>;
+ InGroup<DiagGroup<"overriding-t-option">>;
def warn_drv_treating_input_as_cxx : Warning<
"treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">,
InGroup<Deprecated>;
def warn_drv_pch_not_first_include : Warning<
"precompiled header '%0' was ignored because '%1' is not first '-include'">;
-def warn_drv_pch_ignoring_gch_file : Warning<
- "precompiled header '%0' was ignored because it is not a clang PCH file">,
- InGroup<IgnoredGCH>;
-def warn_drv_pch_ignoring_gch_dir : Warning<
- "precompiled header directory '%0' was ignored because it contains no clang PCH files">,
- InGroup<IgnoredGCH>;
def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
InGroup<DiagGroup<"missing-sysroot">>;
def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting '%1'">,
InGroup<DiagGroup<"incompatible-sysroot">>;
def warn_debug_compression_unavailable : Warning<"cannot compress debug sections (%0 not enabled)">,
InGroup<DiagGroup<"debug-compression-unavailable">>;
-def err_drv_time_trace_compression_unavailable
- : Error<"cannot compress time trace (%0 not enabled)">;
def warn_drv_disabling_vptr_no_rtti_default : Warning<
"implicitly disabling vptr sanitizer because rtti wasn't enabled">,
InGroup<AutoDisableVptrSanitizer>;
@@ -577,17 +453,8 @@ def warn_ignoring_verify_debuginfo_preserve_export : Warning<
InGroup<UnusedCommandLineArgument>;
def warn_unsupported_branch_protection: Warning <
"invalid branch protection option '%0' in '%1'">, InGroup<BranchProtection>;
-def warn_harden_pac_ret_requires_pac_ret: ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/235473
More information about the flang-commits
mailing list