aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver
AgeCommit message (Collapse)AuthorFilesLines
26 hours[clang][modules] Ensure -nostdlib causes no manifest to be reported (#161110)Naveen Seth Hanig1-0/+3
When -nostdlib is specified, Clang should not report any library‑provided module manifest, even if a manifest for the default standard library is present.
2 days[Driver] Make -fvectorize and -fslp-vectorize override -O group options ↵Fangrui Song1-8/+4
(#161032) `clang -fno-slp-vectorize -O2` incorrectly enabled CC1 -vectorize-slp. Make -fvectorize and -fslp-vectorize properly override -O, following the convention. Fix #160633
4 days[flang][Driver] Support -gsplit-dwarf. (#160540)Abid Qadeer5-44/+86
This flags enables the compiler to generate most of the debug information in a separate file which can be useful for executable size and link times. Clang already supports this flag. I have tried to follow the logic of the clang implementation where possible. Some functions were moved where they could be used by both clang and flang. The `addOtherOptions` was renamed to `addDebugOptions` to better reflect its purpose. Clang also set the `splitDebugFilename` field of the `DICompileUnit` in the IR when this option is present. That part is currently missing from this patch and will come in a follow-up PR.
5 days[Clang][NFC] Move GPU include directory to proper place (#160608)Joseph Huber5-20/+35
Summary: This should be handled in the toolchain, not in the middle of clang.
8 days[Driver][Hurd] Add AArch64 and RISCV64 support (#157212)Brad Smith3-0/+23
10 days[Driver] [C++20] [Modules] Fix --precompile with -fmodule-outputChuanqi Xu1-6/+15
Close https://github.com/llvm/llvm-project/issues/159780
11 days[clang][Driver] Clean up UEFI linker argument handling (#159639)Roland McGrath1-11/+26
This makes the UEFI driver's handling of linking more canonical in a few ways: * Use /option:value syntax with lld-link as in the MSVC driver. * Handle -nostdlib, -nodefaultlibs, -r and call common subroutines when they aren't set. This covers sanitizer and profile runtimes and their associated switches; compiler-rt builds do not yet provide these libraries, but the driver behavior is opt-in and supports all the opt-in/out plumbing like other targets do. This lets command lines immediately use the opt-out switches even when they are superfluous for opt-in features, as build system plumbing often needs to do. It also updates some TODO comments for how the driver behavior will look when more runtime support is ready.
12 days[flang][Driver] Enables lto-partitions and fat-lto-object. (#158125)Anchu Rajendran S2-12/+28
12 days[Driver][AMDGPU][HIP][SPIRV] Disable optimizations for AMDGCN SPIR-V (#154765)Alex Voicu2-0/+20
SPIR-V specific optimizations can inadvertently remove information that is important for the AMDGPU BE / break certain code patterns we rely on. Therefore, for AMDGCN flavoured SPIR-V we disable optimizations over IR, to ensure that we operate directly on the output of Clang CodeGen when we finalise.
13 days[clang] Add unreachable after fully covered switches, avoid GCC warnings. ↵Martin Storsjö1-0/+1
NFC. (#159330) This avoids the following warnings: ../../clang/lib/AST/ExprConstant.cpp: In member function ‘bool {anonymous}::IntExprEvaluator::VisitBuiltinCallExpr(const clang::CallExpr*, unsigned int)’: ../../clang/lib/AST/ExprConstant.cpp:14104:3: warning: this statement may fall through [-Wimplicit-fallthrough=] 14104 | } | ^ ../../clang/lib/AST/ExprConstant.cpp:14105:3: note: here 14105 | case Builtin::BIstrlen: | ^~~~ ../../clang/lib/Driver/ToolChains/CommonArgs.cpp: In function ‘std::string clang::driver::tools::complexRangeKindToStr(clang::LangOptionsBase::ComplexRangeKind ’: ../../clang/lib/Driver/ToolChains/CommonArgs.cpp:3523:1: warning: control reaches end of non-void function [-Wreturn-type] 3523 | } | ^
14 days[Driver] Enable outline atomics for FreeBSD/aarch64 (#156089)Brad Smith1-0/+5
2025-09-16Reapply "Introduce -fexperimental-loop-fusion to clang and flang (#158844)Madhur Amilkanthwar2-0/+5
This PR is a reapplication of https://github.com/llvm/llvm-project/pull/142686
2025-09-16[PS5] Enable support for DTLTO in the PS5 Clang driver (#158041)bd1976bris1-0/+12
DTLTO support was added for most targets via the shared `addLTOOptions` helper. The PS5 driver does not call that helper, so it did not inherit the feature. Implement the equivalent DTLTO handling in the PS5 driver. Unlike other drivers, we add LTO-related options unconditionally. This makes sense because the linker decides whether to perform LTO based on input file types, not the presence of `-flto` on the compiler command line. Other drivers only add these options when `-flto` is specified. Internal-Ref: TOOLCHAIN-19896
2025-09-16[PAC][clang] Add new features to pauthtest ABI (#113150)Daniil Kovalev1-0/+14
Enable init/fini address discrimination, type info vtable pointer discrimination and AArch64 jump table hardening as part of pauthtest ABI.
2025-09-16Revert "Introduce -fexperimental-loop-fuse to clang and flang (#142686)" ↵Vitaly Buka2-5/+0
(#158764) This reverts commit 895cda70a95529fd22aac05eee7c34f7624996af. And fix attempt: 06f671e57a574ba1c5127038eff8e8773273790e. Performance regressions and broken sanitizers, see #142686.
2025-09-15[AIX] Disable -gsplit-dwarf as it is unsupported at the moment on AIX (#158199)Aditya Chaudhary1-0/+7
**-gsplit-dwarf** flag causes an internal compiler error on AIX. This PR aims to disable the -gsplit-dwarf flag on the AIX platform, as it is unsupported at the moment. Co-authored-by: Aditya Chaudhary <aditya.chaudhary1@ibm.com>
2025-09-15[flang][driver] Support -gdwarf-N option. (#158314)Abid Qadeer1-1/+6
This PR adds the support for -gdwarf-N option where allows user to choose the version of the dwarf. Currently N can be 2, 3, 4, or 5. This is only the driver part of the change. Later PRs will propogate it to the IR. Fixes https://github.com/llvm/llvm-project/issues/112910.
2025-09-15Introduce -fexperimental-loop-fuse to clang and flang (#142686)Sebastian Pop2-0/+5
This patch adds the flag -fexperimental-loop-fuse to the clang and flang drivers. This is primarily useful for experiments as we envision to enable the pass one day. The options are based on the same principles and reason on which we have `floop-interchange`. --------- Co-authored-by: Madhur Amilkanthwar <madhura@nvidia.com>
2025-09-11[clang][driver] Improve warning message for complex range overrides (#154899)Shunsuke Watanabe2-103/+68
This patch improves the warnings to show which user options override the complex range. When a complex range is overridden, explicitly display both the option name and the implied complex range value for both the overriding and the overridden options. See also the discussion in the following discourse post: https://discourse.llvm.org/t/the-priority-of-fno-fast-math-regarding-complex-number-calculations/84679
2025-09-10Driver: Fix two comments for accuracy.Peter Collingbourne1-2/+3
Reviewers: carlocab, AaronBallman Reviewed By: carlocab Pull Request: https://github.com/llvm/llvm-project/pull/157769
2025-09-09[PowerPC] Support `-fpatchable-function-entry` on PPC64LE (#151569)Maryam Moghadas1-1/+2
This patch enables `-fpatchable-function-entry` on PPC64 little-endian Linux. It is mutually exclusive with existing XRay instrumentation on this target.
2025-09-09[clang][driver][arm][macho] Default to -mframe-pointer=non-leaf. (#154216)Francesco Petrogalli1-0/+3
The commit in [1] changes the behavior of the Arm backend for the attribute frame-pointer=all. Before [1], leaf functions marked with frame-pointer=all were not emitting the frame-pointer. After [1], frame-pointer=all started generating frame pointer for all functions, including leaf functions. However, the default behavior for the driver in clang is to emit the command line option `-mframe-pointer=all` on Arm, if no options for handling the frame pointer is specified at command line. This causes observable regressions. This patch addresses these regressions by configuring the driver so to emit `-mframe-pointer=non-leaf` when targeting Arm. Codegen tests dealing with frame pointer generation have been extended to handle functions with a tail call, since this configuration was missing. [1] 4a2bd78f5b0d0661c23dff9c4b93a393a49dbf9a
2025-09-09[HLSL] Add the `Frs` `DXC` driver option (#157690)Finn Plummer1-2/+8
This pr adds `Frs` as a `DXC` driver option. It is done by invoking `llvm-objcopy` with the `extract-section=RTS0` argument specified to output the separate `DXContainer`. Option behaviour as a reference is found [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#option-frs). This resolves: https://github.com/llvm/llvm-project/issues/150277.
2025-09-09[HLSL][DirectX] Add support for `rootsig` as a target environment (#156373)Finn Plummer1-4/+35
This pr implements support for a root signature as a target, as specified [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#target-root-signature-version). This is implemented in the following steps: 1. Add `rootsignature` as a shader model environment type and define `rootsig` as a `target_profile`. Only valid as versions 1.0 and 1.1 2. Updates `HLSLFrontendAction` to invoke a special handling of constructing the `ASTContext` if we are considering an `hlsl` file and with a `rootsignature` target 3. Defines the special handling to minimally instantiate the `Parser` and `Sema` to insert the `RootSignatureDecl` 4. Updates `CGHLSLRuntime` to emit the constructed root signature decl as part of `dx.rootsignatures` with a `null` entry function 5. Updates `DXILRootSignature` to handle emitting a root signature without an entry function 6. Updates `ToolChains/HLSL` to invoke `only-section=RTS0` to strip any other generated information Resolves: https://github.com/llvm/llvm-project/issues/150286. ##### Implementation Considerations Ideally we could invoke this as part of `clang-dxc` without the need of a source file. However, the initialization of the `Parser` and `Lexer` becomes quite complicated to handle this. Technically, we could avoid generating any of the extra information that is removed in step 6. However, it seems better to re-use the logic in `llvm-objcopy` without any need for additional custom logic in `DXILRootSignature`.
2025-09-09[clang][DebugInfo] Emit unified (Itanium) mangled name to structor ↵Michael Buch1-0/+4
declarations (#154142) Depends on https://github.com/llvm/llvm-project/pull/154137 This patch is motivated by https://github.com/llvm/llvm-project/pull/149827, where we plan on using mangled names on structor declarations to find the exact structor definition that LLDB's expression evaluator should call. Given a `DW_TAG_subprogram` for a function declaration, the most convenient way for a debugger to find the corresponding definition is to use the `DW_AT_linkage_name` (i.e., the mangled name). However, we currently can't do that for constructors/destructors because Clang doesn't attach linkage names to them. This is because, depending on ABI, there can be multiple definitions for a single constructor/destructor declaration. The way GCC works around this is by producing a `C4`/`D4` "unified" mangling for structor declarations (see [godbolt](https://godbolt.org/z/Wds6cja9K)). GDB uses this to locate the relevant definitions. This patch aligns Clang with GCC's DWARF output and allows us to implement the same lookup scheme in LLDB.
2025-09-09MC: Use Triple form of lookupTarget in more places (#157591)Matt Arsenault1-1/+3
2025-09-05[Driver] Enable outline atomics for Haiku and Managarm aarch64 (#156299)Brad Smith2-0/+11
2025-09-05[DirectX] Add isinf f16 emulation for SM6.8 and lower (#156932)Farzon Lotfi1-0/+3
fixes #156068 - We needed to add a new sub arch to the target tripple so we can test that emulation does not happen when targeting SM6.9 - The HLSL toolchain needed to be updated to handle the conversion of strings to enums for the new sub arch. - The emulation is done in DXILIntrinsicExpansion.cpp and needs to be able to convert both llvm.is.fpclass and lvm.dx.isinf to the proper emulation - test updates in TargetParser/TripleTest.cpp, isinf.ll, is_fpclass.ll, and DXCModeTest.cpp
2025-09-05[X86][AVX10] Remove EVEX512 and AVX10-256 implementations (#157034)Phoebe Wang1-41/+0
The 256-bit maximum vector register size control was removed from AVX10 whitepaper, ref: https://cdrdv2.intel.com/v1/dl/getContent/784343 We have warned these options in LLVM21 through #132542. This patch removes underlying implementations in LLVM22.
2025-09-05[Driver][LoongArch] Enable linker relaxation by default for loongarch64 ↵ZhaoQi1-16/+13
(#156315)
2025-08-31[ADT] Refactor StringMap iterators (NFC) (#156137)Kazu Hirata1-2/+1
StringMap has four iterator classes: - StringMapIterBase - StringMapIterator - StringMapConstIterator - StringMapKeyIterator This patch consolidates the first three into one class, namely StringMapIterBase, adds a boolean template parameter to indicate desired constness, and then use "using" directives to specialize the common class: using const_iterator = StringMapIterBase<ValueTy, true>; using iterator = StringMapIterBase<ValueTy, false>; just like how we simplified DenseMapIterator. Remarks: - This patch drops CRTP and iterator_facade_base for simplicity. For fairly simple forward iterators, iterator_facade_base doesn't buy us much. We just have to write a few "using" directives and operator!= manually. - StringMapIterBase has a SFINAE-based constructor to construct a const iterator from a non-const one just like DenseMapIterator. - We now rely on compiler-generated copy and assignment operators.
2025-08-29[HLSL][SPIRV] Add -fspv-use-unknown-image-format option (#155664)Steven Perron1-1/+2
This option allows users to control the image format used for HLSL resources when targeting SPIR-V. When the option is enabled, the unknown image format is used. Otherwise, the image format is guessed based on the input type. Fixes https://github.com/llvm/llvm-project/issues/148270
2025-08-28[Driver] Enable outline atomics for OpenBSD/aarch64 (#155713)Brad Smith1-0/+5
2025-08-27[UBSan][BoundsSafety] Implement support for more expressive "trap reasons" ↵Dan Liew1-5/+1
(#154618) In 29992cfd628ed5b968ccb73b17ed0521382ba317 (#145967) support was added for "trap reasons" on traps emitted in UBSan in trapping mode (e.g. `-fsanitize-trap=undefined`). This improved the debugging experience by attaching the reason for trapping as a string on the debug info on trap instructions. Consumers such as LLDB can display this trap reason string when the trap is reached. A limitation of that patch is that the trap reason string is hard-coded for each `SanitizerKind` even though the compiler actually has much more information about the trap available at compile time that could be shown to the user. This patch is an incremental step in fixing that. It consists of two main steps. **1. Introduce infrastructure for building trap reason strings** To make it convenient to construct trap reason strings this patch re-uses Clang's powerful diagnostic infrastructure to provide a convenient API for constructing trap reason strings. This is achieved by: * Introducing a new `Trap` diagnostic kind to represent trap diagnostics in TableGen files. * Adding a new `Trap` diagnostic component. While this part probably isn't technically necessary it seemed like I should follow the existing convention used by the diagnostic system. * Adding `DiagnosticTrapKinds.td` to describe the different trap reasons. * Add the `TrapReasonBuilder` and `TrapReason` classes to provide an interface for constructing trap reason strings and the trap category. Note this API while similar to `DiagnosticBuilder` has different semantics which are described in the code comments. In particular the behavior when the destructor is called is very different. * Adding `CodeGenModule::BuildTrapReason()` as a convenient constructor for the `TrapReasonBuilder`. This use of the diagnostic system is a little unusual in that the emitted trap diagnostics aren't actually consumed by normal diagnostic consumers (e.g. the console). Instead the `TrapReasonBuilder` is just used to format a string, so in effect the builder is somewhat analagous to "printf". However, re-using the diagnostics system in this way brings a several benefits: * The powerful diagnostic templating languge (e.g. `%select`) can be used. * Formatting Clang data types (e.g. `Type`, `Expr`, etc.) just work out-of-the-box. * Describing trap reasons in tablegen files opens the door for translation to different languages in the future. * The `TrapReasonBuilder` API is very similar to `DiagnosticBuilder` which makes it easy to use by anyone already familiar with Clang's diagnostic system. While UBSan is the first consumer of this new infrastructure the intent is to use this to overhaul how trap reasons are implemented in the `-fbounds-safety` implementation (currently exists downstream). **2. Apply the new infrastructure to UBSan checks for arithmetic overflow** To demonstrate using `TrapReasonBuilder` this patch applies it to UBSan traps for arithmetic overflow. The intention is that we would iteratively switch to using the `TrapReasonBuilder` for all UBSan traps where it makes sense in future patches. Previously for code like ``` int test(int a, int b) { return a + b; } ``` The trap reason string looked like ``` Undefined Behavior Sanitizer: Integer addition overflowed ``` now the trap message looks like: ``` Undefined Behavior Sanitizer: signed integer addition overflow in 'a + b' ``` This string is much more specific because * It explains if signed or unsigned overflow occurred * It actually shows the expression that overflowed One possible downside of this approach is it may blow up Debug info size because now there can be many more distinct trap reason strings. To allow users to avoid this a new driver/cc1 flag `-fsanitize-debug-trap-reasons=` has been added which can either be `none` (disable trap reasons entirely), `basic` (use the per `SanitizerKind` hard coded strings), and `detailed` (use the new expressive trap reasons implemented in this patch). The default is `detailed` to give the best out-of-the-box debugging experience. The existing `-fsanitize-debug-trap-reasons` and `-fno-sanitize-debug-trap-reasons` have been kept for compatibility and are aliases of the new flag with `detailed` and `none` arguments passed respectively. rdar://158612755
2025-08-27[KeyInstr] Enable -gkey-instructions by default if optimisations are enabled ↵Orlando Cazalet-Hyams1-5/+17
(#149509) That's enabling Clang's -gkey-instructions, cc1's -gkey-instructions remains off by default. Key Instructions improves the optimized-code debug-stepping experience in debuggers that use DWARF's `is_stmt` line table register to determine stepping behaviour. The feature can be disabled with -gno-key-instructions (note that the positive and negative flag both imply -g). RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-08-26[HLSL][DirectX] Add the Qdx-rootsignature-strip driver option (#154454)Finn Plummer5-14/+93
This pr adds the `Qstrip-rootsignature` as a `DXC` driver option. To do so, this pr introduces the `BinaryModifyJobClass` as an `Action` to modify a produced object file before its final output. Further, it registers `llvm-objcopy` as the tool to modify a produced `DXContainer` on the `HLSL` toolchain. This allows us to specify the `Qstrip-rootsignature` option to `clang-dxc` which will invoke `llvm-objcopy` with a `--remove-section=RTS0` argument to implement its functionality. Resolves: https://github.com/llvm/llvm-project/issues/150275.
2025-08-26[flang] Disable loop interchange by default (#155279)Nikita Popov1-8/+2
Disable loop interchange by default, while keeping the ability to explicitly enable using `-floop-interchange`. This matches Clang. See discussion on https://github.com/llvm/llvm-project/pull/140182.
2025-08-25[HLSL][RootSignature] Introduce `HLSLFrontendAction` to implement ↵Finn Plummer2-0/+8
`rootsig-define` (#154639) This pr implements the functionality of `rootsig-define` as described [here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#option--rootsig-define). This is accomplished by: - Defining the `fdx-rootsignature-define`, and `rootsig-define` alias, driver options. It simply specifies the name of a macro that will expand to a `LiteralString` to be interpreted as a root signature. - Introduces a new general frontend action wrapper, `HLSLFrontendAction`. This class allows us to introduce `HLSL` specific behaviour on the underlying action (primarily `ASTFrontendAction`). Which will be further extended, or modularly wrapped, when considering future DXC options. - Using `HLSLFrontendAction` we can add a new `PPCallback` that will eagerly parse the root signature specified with `rootsig-define` and push it as a `TopLevelDecl` to `Sema`. This occurs when the macro has been lexed. - Since the root signature is parsed early, before any function declarations, we can then simply attach it to the entry function once it is encountered. Overwriting any applicable root signature attrs. Resolves https://github.com/llvm/llvm-project/issues/150274 ##### Implementation considerations To implement this feature, note that: 1. We need access to all defined macros. These are created as part of the first `Lex` in `Parser::Initialize` after `PP->EnterMainSourceFile` 2. `RootSignatureDecl` must be added to `Sema` before `Consumer->HandleTranslationUnit` is invoked in `ParseAST` Therefore, we can't handle the root signature in `HLSLFrontendAction::ExecuteAction` before (from 1.) or after (from 2.) invoking the underlying `ASTFrontendAction`. This means we could alternatively: - Manually handle this case [here](https://github.com/llvm/llvm-project/blob/ac8f0bb070c9071742b6f6ce03bebc9d87217830/clang/lib/Parse/ParseAST.cpp#L168) before parsing the first top level decl. - Hook into when we [return the entry function decl](https://github.com/llvm/llvm-project/blob/ac8f0bb070c9071742b6f6ce03bebc9d87217830/clang/lib/Parse/Parser.cpp#L1190) and then parse the root signature and override its `RootSignatureAttr`. The proposed solution handles this in the most modular way which should work on any `FrontendAction` that might use the `Parser` without invoking `ParseAST`, and, is not subject to needing to call the hook in multiple different places of function declarators.
2025-08-23[clang] Remove redundant control flow statements (NFC) (#155138)Kazu Hirata2-2/+0
2025-08-22[Driver] Fix out of place comment (#155001)Marco Elver1-3/+4
The unrelated code was added in between the comment and what it is meant to document. Move the comment. NFC.
2025-08-22[Driver][HIP][HIPSTDPAR][Windows] Link the HIP RT even when `-nostdlib` ↵Alex Voicu1-1/+2
(#154630) In Windows, on a MSVC environment (e.g. when linking against the UCRT), `-nostdlib` is used (for example, by CMake) to prevent linking in non-existent `glibc`. However, an unintended side-effect is that we end up never linking in the HIP RT in these circumstances, even when `--hip-link` is explicitly specified. This breaks `hipstdpar`, where we implicitly link in the HIP RT when `--hipstdpar` is passed as a link flag. To fix this, we relax the restriction on linking the HIP RT, for known MSVC environments.
2025-08-22Reapply "[Clang] Take libstdc++ into account during GCC detection" #145056 ↵Frederik Harwath6-103/+267
(#154487) The Generic_GCC::GCCInstallationDetector class picks the GCC installation directory with the largest version number. Since the location of the libstdc++ include directories is tied to the GCC version, this can break C++ compilation if the libstdc++ headers for this particular GCC version are not available. Linux distributions tend to package the libstdc++ headers separately from GCC. This frequently leads to situations in which a newer version of GCC gets installed as a dependency of another package without installing the corresponding libstdc++ package. Clang then fails to compile C++ code because it cannot find the libstdc++ headers. Since libstdc++ headers are in fact installed on the system, the GCC installation continues to work, the user may not be aware of the details of the GCC detection, and the compiler does not recognize the situation and emit a warning, this behavior can be hard to understand - as witnessed by many related bug reports over the years. The goal of this work is to change the GCC detection to prefer GCC installations that contain libstdc++ include directories over those which do not. This should happen regardless of the input language since picking different GCC installations for a build that mixes C and C++ might lead to incompatibilities. Any change to the GCC installation detection will probably have a negative impact on some users. For instance, for a C user who relies on using the GCC installation with the largest version number, it might become necessary to use the --gcc-install-dir option to ensure that this GCC version is selected. This seems like an acceptable trade-off given that the situation for users who do not have any special demands on the particular GCC installation directory would be improved significantly. This patch does not yet change the automatic GCC installation directory choice. Instead, it does introduce a warning that informs the user about the future change if the chosen GCC installation directory differs from the one that would be chosen if the libstdc++ headers are taken into account. See also this related Discourse discussion: https://discourse.llvm.org/t/rfc-take-libstdc-into-account-during-gcc-detection/86992. This patch reapplies #145056. The test in the original PR did not specify a target in the clang RUN line and used a wrong way of piping to FileCheck.
2025-08-21[Flang][Flang-Driver]Fix to add atomic control options in non-fc1 mode (#154638)Anchu Rajendran S1-1/+8
2025-08-21[SPIRV][HLSL] Add DXC compatibility option for extension (#151554)Steven Perron1-10/+58
The default behaviour in DXC is to allow all extesions the compiler knows about. We did the same in clang: all extensions that clang knows about. However, this causes the shader to use different extensions because the two compilers have different sets of extensions. To avoid using a new extension when moving from DXC to Clang, we add the special DXC suboptions to `-fspv-extension`. If `-fspv-extension=DXC` is used, then the available extensions will be those available in DXC. --------- Co-authored-by: Chris B <beanz@abolishcrlf.org>
2025-08-20[lanai] Add back the ability to set the memory model with --mcmodel. (#150575)petergrind31-0/+2
This ability got removed at some point but is still needed to select specific modes for Lanai backend. Add back with simple frontend smoke test.
2025-08-19[clang][PAC][darwin] Set correct default ptrauth features for arm64e-darwin ↵Oliver Hunt1-10/+28
(#153722) This PR makes sure that when targeting arm64e on darwin platforms the correct flags are set for the userspace platform ABI.
2025-08-19Revert "[Clang] Take libstdc++ into account during GCC detection" (#154368)Frederik Harwath6-267/+103
Reverts llvm/llvm-project#145056
2025-08-19[Clang] Take libstdc++ into account during GCC detection (#145056)Frederik Harwath6-105/+268
The Generic_GCC::GCCInstallationDetector class picks the GCC installation directory with the largest version number. Since the location of the libstdc++ include directories is tied to the GCC version, this can break C++ compilation if the libstdc++ headers for this particular GCC version are not available. Linux distributions tend to package the libstdc++ headers separately from GCC. This frequently leads to situations in which a newer version of GCC gets installed as a dependency of another package without installing the corresponding libstdc++ package. Clang then fails to compile C++ code because it cannot find the libstdc++ headers. Since libstdc++ headers are in fact installed on the system, the GCC installation continues to work, the user may not be aware of the details of the GCC detection, and the compiler does not recognize the situation and emit a warning, this behavior can be hard to understand - as witnessed by many related bug reports over the years. The goal of this work is to change the GCC detection to prefer GCC installations that contain libstdc++ include directories over those which do not. This should happen regardless of the input language since picking different GCC installations for a build that mixes C and C++ might lead to incompatibilities. Any change to the GCC installation detection will probably have a negative impact on some users. For instance, for a C user who relies on using the GCC installation with the largest version number, it might become necessary to use the --gcc-install-dir option to ensure that this GCC version is selected. This seems like an acceptable trade-off given that the situation for users who do not have any special demands on the particular GCC installation directory would be improved significantly. This patch does not yet change the automatic GCC installation directory choice. Instead, it does introduce a warning that informs the user about the future change if the chosen GCC installation directory differs from the one that would be chosen if the libstdc++ headers are taken into account. See also this related Discourse discussion: https://discourse.llvm.org/t/rfc-take-libstdc-into-account-during-gcc-detection/86992.
2025-08-18Reland [clang][modules-driver] Add scanner to detect C++20 module presence ↵Naveen Seth Hanig2-0/+68
(#153497) This patch is part of a series to support driver managed module builds for C++ named modules and Clang modules. This introduces a scanner that detects C++ named module usage early in the driver with only negligible overhead. For now, it is enabled only with the `-fmodules-driver` flag and serves solely diagnostic purposes. In the future, the scanner will be enabled for any (modules-driver compatible) compilation with two or more inputs, and will help the driver determine whether to implicitly enable the modules driver. Since the scanner adds very little overhead, we are also exploring enabling it for compilations with only a single input. This approach could allow us to detect `import std` usage in a single-file compilation, which would then activate the modules driver. For performance measurements on this, see https://github.com/naveen-seth/llvm-dev-cxx-modules-check-benchmark. RFC for driver managed module builds: https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system This patch relands the reland (2d31fc8) for commit ded1426. The earlier reland failed due to a missing link dependency on `clangLex`. This reland fixes the issue by adding the link dependency after discussing it in the following RFC: https://discourse.llvm.org/t/rfc-driver-link-the-driver-against-clangdependencyscanning-clangast-clangfrontend-clangserialization-and-clanglex
2025-08-15[flang] Adding support of -fcoarray flang and init PRIF (#151675)Jean-Didier PAILLEUX1-0/+2
In relation to the approval and merge of the [PRIF](https://github.com/llvm/llvm-project/pull/76088) specification about multi-image features in Flang, here is a first PR to add support for the `-fcoarray` compilation flag and the initialization of the PRIF environment. Other PRs will follow for adding support of lowering to PRIF.