aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
AgeCommit message (Collapse)AuthorFilesLines
6 hours[Modules] Make -module-file-info print macro names in deterministic order ↵Hans Wennborg1-8/+11
(#161332) Developers reported non-deterministic output from `-module-file-info`, thinking this reflected non-determinism in the .pcm files themselves. However, it turned out it was the printing that was non-deterministic: ``` $ cat /tmp/a.h #define FOO 1 #define BAR 2 $ build/bin/clang -cc1 -std=c++20 -x c++ -emit-header-unit /tmp/a.h -o /tmp/a.pcm $ build/bin/clang -cc1 -module-file-info /tmp/a.pcm | grep -A2 Definitions Macro Definitions: FOO BAR $ build/bin/clang -cc1 -module-file-info /tmp/a.pcm | grep -A2 Definitions Macro Definitions: BAR FOO ``` Making the output deterministic also simplifies the test. This is a follow-up to 360c5fe54c0758c73bf85453fd2913f371adc7d5
22 hours[clang] Use the VFS in `ModuleDependencyCollector` (#160944)Jan Svoboda1-5/+6
This PR starts using the correct VFS in `ModuleDependencyCollector` instead of using the real FS directly. This matches compiler's behavior for other input files.
32 hours[C++20] [Modules] Set the feature testing macro to 1 (#161034)Chuanqi Xu1-1/+4
See https://github.com/llvm/llvm-project/issues/71364 for details.
4 days[llvm][clang] Use the VFS in `FileCollector` (#160788)Jan Svoboda1-1/+1
This PR changes `llvm::FileCollector` to use the `llvm::vfs::FileSystem` API for making file paths absolute instead of using `llvm::sys::fs::make_absolute()` directly. This matches the behavior of the compiler on most other input files.
6 days[Clang] Support includes translated to module imports in ↵Sina Mahdavi1-15/+61
-header-include-filtering=direct-per-file (#156756) This PR is a follow-up to https://github.com/llvm/llvm-project/pull/137087 that extends the output format generated by -header-include-filtering=direct-per-file to include information about the source location where those include/imports happended, as well as include information about the imported module when an include is translated to a module import.
12 days[clang] Pass VFS into `ASTUnit::LoadFromASTFile()` (#159166)Jan Svoboda3-7/+10
This PR makes the `VFS` parameter to `ASTUnit::LoadFromASTFile()` required and explicit, rather than silently defaulting to the real file system. This makes it easy to correctly propagate the fully-configured VFS and load any input files like the rest of the compiler does.
13 days[win][clang] Align scalar deleting destructors with MSABI (#139566)Mariya Podchishchaeva1-0/+7
While working on vector deleting destructors support ([GH19772](https://github.com/llvm/llvm-project/issues/19772)), I noticed that MSVC produces different code in scalar deleting destructor body depending on whether class defined its own operator delete. In MSABI deleting destructors accept an additional implicit flag parameter allowing some sort of flexibility. The mismatch I noticed is that whenever a global operator delete is called, i.e. `::delete`, in the code produced by MSVC the implicit flag argument has a value that makes the 3rd bit set, i.e. "5" for scalar deleting destructors "7" for vector deleting destructors. Prior to this patch, clang handled `::delete` via calling global operator delete direct after the destructor call and not calling class operator delete in scalar deleting destructor body by passing "0" as implicit flag argument value. This is fine until there is an attempt to link binaries compiled with clang with binaries compiled with MSVC. The problem is that in binaries produced by MSVC the callsite of the destructor won't call global operator delete because it is assumed that the destructor will do that and a destructor body generated by clang will never do. This patch removes call to global operator delete from the callsite and add additional check of the 3rd bit of the implicit parameter inside of scalar deleting destructor body. --------- Co-authored-by: Tom Honermann <tom@honermann.net>
14 days[clang] Initialize the file system explicitly (#158381)Jan Svoboda5-37/+42
This PR is a part of the effort to make the VFS used in the compiler more explicit and consistent. Instead of creating the VFS deep within the compiler (in `CompilerInstance::createFileManager()`), clients are now required to explicitly call `CompilerInstance::createVirtualFileSystem()` and provide the base VFS from the outside. This PR also helps in breaking up the dependency cycle where creating a properly configured `DiagnosticsEngine` requires a properly configured VFS, but creating properly configuring a VFS requires the `DiagnosticsEngine`. Both `CompilerInstance::create{FileManager,Diagnostics}()` now just use the VFS already in `CompilerInstance` instead of taking one as a parameter, making the VFS consistent across the instance sub-object.
2025-09-16Reapply "Introduce -fexperimental-loop-fusion to clang and flang (#158844)Madhur Amilkanthwar1-0/+5
This PR is a reapplication of https://github.com/llvm/llvm-project/pull/142686
2025-09-16Revert "Introduce -fexperimental-loop-fuse to clang and flang (#142686)" ↵Vitaly Buka1-5/+0
(#158764) This reverts commit 895cda70a95529fd22aac05eee7c34f7624996af. And fix attempt: 06f671e57a574ba1c5127038eff8e8773273790e. Performance regressions and broken sanitizers, see #142686.
2025-09-15[clang] Avoid reparsing VFS overlay files for module dep collector (#158372)Jan Svoboda1-11/+4
This PR uses the new-ish `llvm::vfs::FileSystem::visit()` interface to collect VFS overlay entries from an existing `FileSystem` instance rather than parsing the VFS YAML file anew. This prevents duplicate diagnostics as observed by `clang/test/VFS/broken-vfs-module-dep.c`.
2025-09-15Introduce -fexperimental-loop-fuse to clang and flang (#142686)Sebastian Pop1-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-12[RISCV] Enabled debug entry support by default (#157703)Georgiy Samoylov1-3/+4
This patch enables support for debug entry values. This improves quality of debug info for RISC-V
2025-09-12[Clang] Set the FTM for trivial relocation (#142936)Corentin Jabot1-1/+1
The language of side seems fairly stable. Setting the feature test macro will ease implementation in standard libraries.
2025-09-10Reland "[clang] Delay normalization of `-fmodules-cache-path` (#150123)"Jan Svoboda2-20/+11
This reverts commit 613caa909c78f707e88960723c6a98364656a926, essentially reapplying 4a4bddec3571d78c8073fa45b57bbabc8796d13d after moving `normalizeModuleCachePath` from clangFrontend to clangLex. This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays normalization of the module cache path until `CompilerInstance` is asked for the cache path in the current compilation context.
2025-09-10Revert "[clang] Delay normalization of `-fmodules-cache-path` (#150123)"Jan Svoboda2-19/+20
This reverts commit 4a4bddec3571d78c8073fa45b57bbabc8796d13d. The Serialization library doesn't link Frontend, where CompilerInstance lives, causing link failures on some build bots.
2025-09-10[clang] Delay normalization of `-fmodules-cache-path` (#150123)Jan Svoboda2-20/+19
This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays normalization of the module cache path until `CompilerInstance` is asked for the cache path in the current compilation context.
2025-09-09[HLSL][DirectX] Add support for `rootsig` as a target environment (#156373)Finn Plummer1-3/+14
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-08Frontend: Adopt llvm::vfs::OutputBackend in CompilerInstance (#113364)Steven Wu1-118/+61
Adopt new virtual output backend in CompilerInstance.
2025-09-08[clang] Rename overloaded virtual member function to prevent shadowing, NFCI ↵Cyndy Ishida1-3/+4
(#157501) Resolves warnings triggered by `Woverloaded-virtual`
2025-09-08[Frontend] Define __SANITIZE__ macros for kernel address variants (#156543)Nathan Chancellor1-2/+4
GCC defines these macros for both userspace and kernel address sanitizers: $ gcc -E -dM -fsanitize=address -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_ADDRESS__ 1 $ gcc -E -dM -fsanitize=kernel-address -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_ADDRESS__ 1 $ gcc -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_HWADDRESS__ 1 $ gcc -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_HWADDRESS__ 1 PR #153888 added these same defines for clang but only for the userspace address sanitizers: $ clang -E -dM -fsanitize=address -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_ADDRESS__ 1 $ clang -E -dM -fsanitize=kernel-address -x c /dev/null &| string match -er SANITIZE $ clang -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er SANITIZE #define __SANITIZE_HWADDRESS__ 1 $ clang -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string match -er SANITIZE Match GCC's behavior so that the Linux kernel can eventually drop its own internal defines.
2025-09-02[clang] Delay checking of `-fopenmp-host-ir-file-path` (#150124)Jan Svoboda1-12/+0
This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays opening the OpenMP host IR file until codegen.
2025-09-02[clang][analyzer] Delay checking the ctu-dir (#150139)Jan Svoboda1-4/+0
This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays checking that `ctu-dir` is an existing directory.
2025-09-02[clang][analyzer] Delay checking the model-path (#150133)Jan Svoboda1-5/+0
This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays checking that `model-path` is an existing directory.
2025-09-02[Clang] [C2y] Implement N3355 ‘Named Loops’ (#152870)Sirraide1-0/+3
This implements support for [named loops](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3355.htm) for C2y. When parsing a `LabelStmt`, we create the `LabeDecl` early before we parse the substatement; this label is then passed down to `ParseWhileStatement()` and friends, which then store it in the loop’s (or switch statement’s) `Scope`; when we encounter a `break/continue` statement, we perform a lookup for the label (and error if it doesn’t exist), and then walk the scope stack and check if there is a scope whose preceding label is the target label, which identifies the jump target. The feature is only supported in C2y mode, though a cc1-only option exists for testing (`-fnamed-loops`), which is mostly intended to try and make sure that we don’t have to refactor this entire implementation when/if we start supporting it in C++. --------- Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
2025-09-02[clang] load umbrella dir headers in sorted order (#156108)Richard Howell1-19/+21
Clang modules sort the umbrella dir headers by name before adding to the module's includes to ensure deterministic output across different file systems. This is insufficient however, as the header search table is also serialized. This includes all the loaded headers by file reference, which are allocated incrementally. To ensure stable output we have to also create the file references in sorted order.
2025-08-29[clang] Frontend: Destroy compiling compiler instance before read (#154455)Anthony Latsis1-10/+12
Upstreams https://github.com/swiftlang/llvm-project/pull/10943. https://github.com/llvm/llvm-project/pull/134887 added a clone for the compiler instance in `compileModuleAndReadASTImpl`, which would then be destroyed *after* the corresponding read in the importing instance. Swift has a `SwiftNameLookupExtension` module extension which updates (effectively) global state - populating the lookup table for a module on read and removing it when the module is destroyed. With newly cloned instance, we would then see: - Module compiled with cloned instance - Module read with importing instance - Lookup table for that module added - Cloned instance destroyed - Module from that cloned instance destroyed - Lookup table for that module name removed Depending on the original semantics is incredibly fragile, but for now it's good enough to ensure that the read in the importing instance is after the cloned instanced is destroyed. Ideally we'd only ever add to the lookup tables in the original importing instance, never its clones. Co-authored-by: Ben Barham <ben_barham@apple.com>
2025-08-27[clang] NFC: reintroduce clang/include/clang/AST/Type.h (#155050)Matheus Izvekov2-1/+2
This reintroduces `Type.h`, having earlier been renamed to `TypeBase.h`, as a redirection to `TypeBase.h`, and redirects most users to include the former instead. This is a preparatory patch for being able to provide inline definitions for `Type` methods which would otherwise cause a circular dependency with `Decl{,CXX}.h`. Doing these operations into their own NFC patch helps the git rename detection logic work, preserving the history. This patch makes clang just a little slower to build (~0.17%), just because it makes more code indirectly include `DeclCXX.h`.
2025-08-27[clang] NFC: rename clang/include/clang/AST/Type.h to TypeBase.h (#155049)Matheus Izvekov1-1/+1
This is a preparatory patch, to be able to provide inline definitions for `Type` functions which depend on `Decl{,CXX}.h`. As the latter also depends on `Type.h`, this would not be possible without some reorganizing. Splitting this rename into its own patch allows git to track this as a rename, and preserve all git history, and not force any code reformatting. A later NFC patch will reintroduce `Type.h` as redirection to `TypeBase.h`, rewriting most places back to directly including `Type.h` instead of `TypeBase.h`, leaving only a handful of places where this is necessary. Then yet a later patch will exploit this by making more stuff inline.
2025-08-27[clang] AST: fix getAs canonicalization of leaf types (#155028)Matheus Izvekov1-2/+3
2025-08-26[clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all ↵Matheus Izvekov2-30/+21
TagDecls (#155463) And make use of those. These changes are split from prior PR #155028, in order to decrease the size of that PR and facilitate review.
2025-08-25[clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313)Matheus Izvekov1-9/+1
This changes a bunch of places which use getAs<TagType>, including derived types, just to obtain the tag definition. This is preparation for #155028, offloading all the changes that PR used to introduce which don't depend on any new helpers.
2025-08-25[HLSL][RootSignature] Introduce `HLSLFrontendAction` to implement ↵Finn Plummer2-0/+87
`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-20[Clang][NFC] Clarify some SourceManager related code (#153527)Shafik Yaghmour1-0/+2
Static analysis flagged the columns - 1 code, it was correct but the assumption was not obvious. I document the assumption w/ assertions. While digging through related code I found getColumnNumber that looks wrong at first inspection and adding parentheses makes it clearer.
2025-08-18[clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be ↵Oliver Hunt1-0/+3
available on Darwin (#153912) For backwards compatibility reasons the `ptrauth_qualifier` and `ptrauth_intrinsic` features need to be testable with `__has_feature()` on Apple platforms, but for other platforms this backwards compatibility issue does not exist. This PR resolves these issues by making the `ptrauth_qualifier` and `ptrauth_intrinsic` tests conditional upon a darwin target. This also allows us to revert the ptrauth_qualifier check from an extension to a feature test again, as is required on these platforms. At the same time we introduce a new predefined macro `__PTRAUTH__` that answers the same question as `__has_feature(ptrauth_qualifier)` and `__has_feature(ptrauth_intrinsic)` as those tests are synonymous and only exist separately for compatibility reasons. The requirement to test for the `__PTRAUTH__` macro also resolves the hazard presented by mixing the `ptrauth_qualifier` flag (that impacts ABI and security policies) with `-pedantics-errors`, which makes `__has_extension` return false for all extensions. --------- Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2025-08-15Frontend: Define __SANITIZE_*__ macros for certain sanitizers.Peter Collingbourne1-0/+7
Per discussion with @ojhunt and @AaronBallman we are moving towards predefined macros and away from __has_feature and __has_extension for detecting sanitizers and other similar features. The rationale is that __has_feature is only really meant for standardized features (see the comment at the top of clang/include/clang/Basic/Features.def), and __has_extension has the issues discovered as part of #153104. Let's start by defining macros for ASan, HWASan and TSan, consistently with gcc. Reviewers: vitalybuka, ojhunt, AaronBallman, fmayer Reviewed By: fmayer, vitalybuka Pull Request: https://github.com/llvm/llvm-project/pull/153888
2025-08-14[clang][Obj-C][PAC] Make block descriptor pointer signing configurable (#153700)Oliver Hunt1-3/+8
Pointer auth protection of the block descriptor pointer is only supported in some constrained environments so we do actually need it to be configurable. We had made it non configurable in the first PR to protect block metadata because we believed that was an option but subsequently realised it does need to remain configurable. This PR revives the flags that permit this.
2025-08-13[clang][Obj-C][PAC] Add support for authenticating block metadata (#152978)Oliver Hunt1-1/+10
Introduces the use of pointer authentication to protect the invocation, copy and dispose, reference, and descriptor pointers in Objective-C block objects. Resolves #141176
2025-08-10Fix MSVC warning in CompilerInvocation.cpp (#152809)Daniel Paoliello1-2/+2
Building Clang using MSVC was resulting in the following warning: ``` tuple(791): warning C4018: '<': signed/unsigned mismatch ``` I traced this to CompilerInvocation.cpp where it was creating a `std::tuple` to compare version numbers. This change adds an explicit type for the `tuple` created from the version macros to match the type of the variables, and uses the `tuple` constructor instead of `tie` since the integers are smaller than a reference to the integers.
2025-08-09[clang] missing changes to the Rewriter (#152845)Matheus Izvekov2-23/+37
This completes https://github.com/llvm/llvm-project/pull/147835 by adapting the changes in the API to the rewriter. Fixes build failures such as reported here: https://github.com/llvm/llvm-project/pull/147835#issuecomment-3170483197 We previously missed this because it was not tested in pre-commit CI.
2025-08-09[clang] Improve nested name specifier AST representation (#147835)Matheus Izvekov2-3/+6
This is a major change on how we represent nested name qualifications in the AST. * The nested name specifier itself and how it's stored is changed. The prefixes for types are handled within the type hierarchy, which makes canonicalization for them super cheap, no memory allocation required. Also translating a type into nested name specifier form becomes a no-op. An identifier is stored as a DependentNameType. The nested name specifier gains a lightweight handle class, to be used instead of passing around pointers, which is similar to what is implemented for TemplateName. There is still one free bit available, and this handle can be used within a PointerUnion and PointerIntPair, which should keep bit-packing aficionados happy. * The ElaboratedType node is removed, all type nodes in which it could previously apply to can now store the elaborated keyword and name qualifier, tail allocating when present. * TagTypes can now point to the exact declaration found when producing these, as opposed to the previous situation of there only existing one TagType per entity. This increases the amount of type sugar retained, and can have several applications, for example in tracking module ownership, and other tools which care about source file origins, such as IWYU. These TagTypes are lazily allocated, in order to limit the increase in AST size. This patch offers a great performance benefit. It greatly improves compilation time for [stdexec](https://github.com/NVIDIA/stdexec). For one datapoint, for `test_on2.cpp` in that project, which is the slowest compiling test, this patch improves `-c` compilation time by about 7.2%, with the `-fsyntax-only` improvement being at ~12%. This has great results on compile-time-tracker as well: ![image](https://github.com/user-attachments/assets/700dce98-2cab-4aa8-97d1-b038c0bee831) This patch also further enables other optimziations in the future, and will reduce the performance impact of template specialization resugaring when that lands. It has some other miscelaneous drive-by fixes. About the review: Yes the patch is huge, sorry about that. Part of the reason is that I started by the nested name specifier part, before the ElaboratedType part, but that had a huge performance downside, as ElaboratedType is a big performance hog. I didn't have the steam to go back and change the patch after the fact. There is also a lot of internal API changes, and it made sense to remove ElaboratedType in one go, versus removing it from one type at a time, as that would present much more churn to the users. Also, the nested name specifier having a different API avoids missing changes related to how prefixes work now, which could make existing code compile but not work. How to review: The important changes are all in `clang/include/clang/AST` and `clang/lib/AST`, with also important changes in `clang/lib/Sema/TreeTransform.h`. The rest and bulk of the changes are mostly consequences of the changes in API. PS: TagType::getDecl is renamed to `getOriginalDecl` in this patch, just for easier to rebasing. I plan to rename it back after this lands. Fixes #136624 Fixes https://github.com/llvm/llvm-project/issues/43179 Fixes https://github.com/llvm/llvm-project/issues/68670 Fixes https://github.com/llvm/llvm-project/issues/92757
2025-08-07[Clang][NFC] Enumerate Clang ABI versions in a separate header file (#151995)Yanzuo Liu1-64/+21
Make it easier for us to add ABI versions. Close #144332
2025-08-06[clang][Dependency Scanning] Move Module Timestamp Update After Compilation ↵Qiongsi Wu1-0/+8
Finishes (#151774) When two threads are accessing the same `pcm`, it is possible that the reading thread sees the timestamp update, while the file on disk is not updated. This PR moves timestamp update from `writeAST` to `compileModuleAndReadASTImpl`, so we only update the timestamp after the file has been committed to disk. rdar://152097193
2025-08-04[Clang] Handle C++20 export declarations in -dump-minimization-hints (#151666)Ilya Biryukov1-27/+56
Thanks to Justin Stitt for bringing this up, providing test cases and a direction for the fix!
2025-08-01NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151782)James Y Knight5-89/+101
This commit handles the following types: - clang::ExternalASTSource - clang::TargetInfo - clang::ASTContext - clang::SourceManager - clang::FileManager Part of cleanup #151026
2025-08-01[Clang] Dump minimization hints for namespaces (#151534)Ilya Biryukov1-15/+71
Unlike other declarations, these cover two ranges: - from `namespace/inline namespace` to the opening `{`, - the closing `}`. This allows to mark the declarations inside the namespace itself independently.
2025-08-01[Clang] Flush minimization hints after writing (#151522)Ilya Biryukov1-0/+2
This helps to get well-formed output if Clang crashes after that point.
2025-07-31NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151545)James Y Knight8-34/+33
Handles clang::DiagnosticsEngine and clang::DiagnosticIDs. For DiagnosticIDs, this mostly migrates from `new DiagnosticIDs` to convenience method `DiagnosticIDs::create()`. Part of cleanup https://github.com/llvm/llvm-project/issues/151026
2025-07-31NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for ↵James Y Knight3-10/+14
llvm::vfs::FileSystem. (#151407) This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>` instead of `FileSystem*` or `FileSystem&`, when dealing with existing objects. Part of cleanup #151026.
2025-07-29[Clang][Cygwin] Enable few conditions that are shared with MinGW (#149637)jeremyd20191-2/+2
The Cygwin target is generally very similar to the MinGW target. The default auto-import behavior, the default calling convention, the `.dll.a` import library extension, the `__GXX_TYPEINFO_EQUALITY_INLINE` pre-define by `g++`, and the long double configuration. Co-authored-by: Mateusz Mikuła <oss@mateuszmikula.dev>