aboutsummaryrefslogtreecommitdiff
path: root/clang
AgeCommit message (Collapse)AuthorFilesLines
5 hours[clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to ↵Michael Buch3-2/+178
std::get free function (#122265) When we generate the debug-info for a `VarDecl` we try to determine whether it was introduced as part of a structure binding (aka a "holding var"). If it was then we don't mark it as `artificial`. The heuristic to determine a holding var uses `IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer until we hit a `DeclRefExpr` that refers to a `Decomposition`. For "tuple-like decompositions", Clang will generate a call to a `template<size_t I> Foo get(Bar)` function that retrieves the `Ith` element from the tuple-like structure. If that function is a member function, we get an AST that looks as follows: ``` VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit `-ExprWithCleanups <col:10> 'int' xvalue `-MaterializeTemporaryExpr <col:10> 'int' xvalue extended by Var 0x11d110cf8 'z1' 'std::tuple_element<0, B>::type &&' `-CXXMemberCallExpr <col:10> 'int' `-MemberExpr <col:10> '<bound member function type>' .get 0x11d104390 `-ImplicitCastExpr <col:10> 'B' xvalue <NoOp> `-DeclRefExpr <col:10> 'B' lvalue Decomposition 0x11d1100a8 '' 'B' ``` `IgnoreUnlessSpelledInSource` happily unwraps this down to the `DeclRefExpr`. However, when the `get` helper is a free function (which it is for `std::pair` in libc++ for example), then the AST is: ``` VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple<int, int>>::type &' cinit `-CallExpr <col:16> 'const typename tuple_element<0UL, tuple<int, int>>::type':'const int' lvalue adl |-ImplicitCastExpr <col:16> 'const typename tuple_element<0UL, tuple<int, int>>::type &(*)(const tuple<int, int> &) noexcept' <FunctionToPointerDecay> | `-DeclRefExpr <col:16> 'const typename tuple_element<0UL, tuple<int, int>>::type &(const tuple<int, int> &) noexcept' lvalue Function 0x1210262d8 'get' 'const typename tuple_element<0UL, tuple<int, int>>::type &(const tuple<int, int> &) noexcept' (FunctionTemplate 0x11d068088 'get') `-DeclRefExpr <col:16> 'const std::tuple<int, int>' lvalue Decomposition 0x121021518 '' 'const std::tuple<int, int> &' ``` `IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we incorrectly mark the binding as `artificial` in debug-info. This patch adjusts `IgnoreUnlessSpelledInSource` so it unwraps implicit `CallExpr`s. It's almost identical to how we treat implicit constructor calls (unfortunately the code can't quite be re-used because a `CXXConstructExpr` is-not a `CallExpr`, and we check `isElidable`, which doesn't exist for regular function calls. So I added a new `IgnoreImplicitCallSingleStep`). Fixes https://github.com/llvm/llvm-project/issues/122028
8 hours[NFC][clang] Refactor no-stable-modtime.m test use split-file (#159924)yicuixi1-17/+28
This PR refactor no-stable-modtime.m to use split-file Signed-off-by: yicuixi <qin_17914@126.com>
12 hours[CIR] Implement Type promotion for VectorType (#158715)Amr Hesham3-6/+85
This change adds support for type promotion for VectorType Issue https://github.com/llvm/llvm-project/issues/136487
13 hours[CIR] Add atomic exchange operation (#158089)Sirui Mu5-4/+200
This patch adds atomic exchange operation which covers the following C/C++ intrinsic functions: - `__c11_atomic_exchange` - `__atomic_exchange` - `__atomic_exchange_n`
13 hours[CIR][NFC] Fix Missing Decl::OMPGroupPrivate warning (#159631)Amr Hesham1-1/+1
Fix the Missing enum element `Decl::OMPGroupPrivate` warning
15 hours[Driver] [C++20] [Modules] Fix --precompile with -fmodule-outputChuanqi Xu2-7/+22
Close https://github.com/llvm/llvm-project/issues/159780
17 hoursRevert "[Clang] Enable lit internal shell by default"Aiden Grossman1-12/+1
This reverts commit 25e218d7562f1f360a8f112de2b771585cd922c3. This is causing errors on the llvm-clang-aarch64-darwin builder related to too many files being open.
17 hoursRevert "[Clang] Make rewrite-includes-bom.c work with internal shell"Aiden Grossman1-2/+3
This reverts commit 8d6470f717cb5c2d200f71dff09ee76a12f908a7. This was causing a failure on the llvm-clang-aarch64-darwin builder when using the external shell.
17 hours[clang-format][NFC] Add is_sorted() assertion for binary_search()Owen Pan2-0/+2
18 hours[Clang] Enable lit internal shell by defaultAiden Grossman1-1/+12
Now that all of the clang tests have been verified (and adjusted when necessary) to work with lit's internal shell, we can enable it by default, which this patch does. This should make check-clang 10-15% faster in addition to providing richer feedback on test failures. Reviewers: AaronBallman, petrhosek, rnk, ilovepi, shafik, cmtice Reviewed By: petrhosek, ilovepi, rnk, cmtice Pull Request: https://github.com/llvm/llvm-project/pull/158465
18 hours[Clang] Make rewrite-includes-bom.c work with internal shellAiden Grossman1-3/+2
This test was using $'<content with escapes' to have bash interpret shell escapes and then passing them to grep. The lexer/parser for lit's internal shell does not support such sequences. Given this is the only test in-tree that uses this functionality, it makes much more sense to use a POSIX compliant utility like od to transform the file into hex and then grep over that rather than modify the internal shell. This test should remain portable as od should be widely available and we are only using options specified in POSIX. Reviewers: cmtice, petrhosek, ilovepi Reviewed By: petrhosek, ilovepi Pull Request: https://github.com/llvm/llvm-project/pull/158463
18 hours[lit] Make builtin cat work with stdinAiden Grossman1-1/+0
cat with no files passed to it is supposed to read from STDIN according to POSIX. The builtin cat lacking this behavior led to the clang test in dev-fd-fs.c to fail because it expected this behavior. This is a simple modification and I do not think it is possible to rewrite the test without this easily while preserving the semantics around named pipes. Reviewers: petrhosek, arichardson, ilovepi, cmtice, jh7370 Reviewed By: jh7370, arichardson, ilovepi, cmtice Pull Request: https://github.com/llvm/llvm-project/pull/158447
21 hours[clang][PAC] Don't try to diagnose use of pointer auth on dependent types ↵Oliver Hunt2-1/+40
#159505 (#159859) We can't give a correct answer for dependent types, so for now just report no ptrauth involves if the type being queried is dependent. In future we may want to distinguigh the `None` vs `Dependent` cases but that does not seem warranted for now. Fixes #159505
22 hours[modules] Fix assert on Clang module import from the global module fragment. ↵Naveen Seth Hanig2-1/+30
(#159771) Fixes #159768. When building a named module interface with `-fmodules` enabled, importing a Clang module from inside the global module fragment causes Clang to crash only on assertion builds. This fixes the assert and extends the test coverage.
23 hours[Clang] Rewrite tests using subshells to set env variablesAiden Grossman5-19/+20
Now that we have the %readfile substitution, we can rewrite these tests that were using env variable subshells to write the output of the command into a file and then load it where it is needed using readfile. This does involve one invocation of bash so that we are using the system env binary, which does support redirection into a tool like grep. We already do this in one LLVM test. I'm not happy about needing that, but the more principled way to solve it involves reworking how in-process builtins work within lit. That is something we want to do eventually, but not something that I think should block this patch. Reviewers: cmtice, petrhosek, ilovepi Reviewed By: cmtice, ilovepi Pull Request: https://github.com/llvm/llvm-project/pull/158446
25 hours[CIR] Fix structors for multidimensional arrrays (#159820)Morris Hafner5-10/+171
This patchs implements array constructors and destructors for multidimensional arrays. This works by bitcasting the pointer to the first element to a one-dimensional array type of the same extent before lowering to a loop.
27 hours[clang][analyzer] Load config through the proper VFS (#159164)Jan Svoboda3-3/+28
This PR ensures that the Clang static analyzer loads the config file through the properly-configured VFS rather than through the bare real file system. This enables correctly going through VFS overlays, unifying the behavior with the rest of the compiler.
27 hours[clang] diagnose invalid std::tuple_size sizes (#159677)Matheus Izvekov4-10/+44
This makes sure the tuple sizes remain within implementation limits, and this doesn't cause the compiler to crash later, as the tuple size is assumed to fit within an UnsignedOrNone. Fixes #159563
28 hours[CIR] Implement Logical AND for VectorType (#158696)Amr Hesham3-2/+94
This change adds support for local AND op for VectorType Issue https://github.com/llvm/llvm-project/issues/136487
28 hours[clang][Driver] Clean up UEFI linker argument handling (#159639)Roland McGrath2-16/+31
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.
28 hours[clang] fix expression classification for dependent binary operators (#159819)Matheus Izvekov2-0/+13
This fixes a regression reported here: https://github.com/llvm/llvm-project/pull/159463#issuecomment-3312157416 Since this regression was never released, there are no release notes.
29 hours[HLSL] Add deprecation warnings to compatability overloads (#159208)Sarah Spall5-17/+299
Add deprecation warnings to compatability overloads and add tests to show the warnings. Closes #133452
29 hours[CIR] Upstream TypeInfo attribute (#159426)Amr Hesham5-4/+117
This change adds support for TypeInfoAttr which is needed later for RTTI in exceptions Issue https://github.com/llvm/llvm-project/issues/154992
30 hours[LifetimeSafety] Avoid adding already present items in sets/maps (#159582)Utkarsh Saxena2-9/+14
Optimize lifetime safety analysis performance - Added early return optimization in `join` function for ImmutableSet when sets are identical - Improved ImmutableMap join logic to avoid unnecessary operations when values are equal I was under the impression that ImmutableSets/Maps would not modify the underlying if already existing elements are added to the container (and was hoping for structural equality in this aspect). It looks like the current implementation of `ImmutableSet` would perform addition nevertheless thereby creating (presumably `O(log(N))` tree nodes. This change considerably brings down compile times for some edge cases which happened to be present in the LLVM codebase. Now it is actually possible to compile LLVM in under 20 min with the lifetime analysis. The compile time hit is still significant but not as bad as before this change where it was not possible to compile LLVM without severely limiting analysis' scope (giving up on CFG with > 3000 blocks). Fixes https://github.com/llvm/llvm-project/issues/157420 <details> <summary>Report (Before)</summary> </details> <details> <summary>Report (After)</summary> # Lifetime Analysis Performance Report > Generated on: 2025-09-18 14:28:00 --- ## Test Case: Pointer Cycle in Loop **Timing Results:** | N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) | Loan Propagation (%) | Expired Loans (%) | |:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:| | 25 | 53.76 ms | 85.58% | 0.00% | 85.46% | 0.00% | | 50 | 605.35 ms | 98.39% | 0.00% | 98.37% | 0.00% | | 75 | 2.89 s | 99.62% | 0.00% | 99.61% | 0.00% | | 100 | 8.62 s | 99.80% | 0.00% | 99.80% | 0.00% | **Complexity Analysis:** | Analysis Phase | Complexity O(n<sup>k</sup>) | |:------------------|:--------------------------| | Total Analysis | O(n<sup>3.82</sup> &pm; 0.01) | | FactGenerator | (Negligible) | | LoanPropagation | O(n<sup>3.82</sup> &pm; 0.01) | | ExpiredLoans | (Negligible) | --- ## Test Case: CFG Merges **Timing Results:** | N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) | Loan Propagation (%) | Expired Loans (%) | |:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:| | 400 | 66.02 ms | 58.61% | 1.04% | 56.53% | 1.02% | | 1000 | 319.24 ms | 81.31% | 0.63% | 80.04% | 0.64% | | 2000 | 1.43 s | 92.00% | 0.40% | 91.32% | 0.28% | | 5000 | 9.35 s | 97.01% | 0.25% | 96.63% | 0.12% | **Complexity Analysis:** | Analysis Phase | Complexity O(n<sup>k</sup>) | |:------------------|:--------------------------| | Total Analysis | O(n<sup>2.12</sup> &pm; 0.02) | | FactGenerator | O(n<sup>1.54</sup> &pm; 0.02) | | LoanPropagation | O(n<sup>2.12</sup> &pm; 0.03) | | ExpiredLoans | O(n<sup>1.13</sup> &pm; 0.03) | --- ## Test Case: Deeply Nested Loops **Timing Results:** | N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) | Loan Propagation (%) | Expired Loans (%) | |:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:| | 50 | 137.30 ms | 90.72% | 0.00% | 90.42% | 0.00% | | 100 | 1.09 s | 98.13% | 0.00% | 98.02% | 0.09% | | 150 | 4.06 s | 99.24% | 0.00% | 99.18% | 0.05% | | 200 | 10.44 s | 99.66% | 0.00% | 99.63% | 0.03% | **Complexity Analysis:** | Analysis Phase | Complexity O(n<sup>k</sup>) | |:------------------|:--------------------------| | Total Analysis | O(n<sup>3.29</sup> &pm; 0.01) | | FactGenerator | (Negligible) | | LoanPropagation | O(n<sup>3.29</sup> &pm; 0.01) | | ExpiredLoans | O(n<sup>1.42</sup> &pm; 0.19) | --- </details>
32 hoursFix perf-helper.py (#159745)Konrad Kleine1-0/+1
When build with assertions, there will be an output like the following that needs to be filtered out, similar to the other ones. `'Build config: +assertions'`
33 hours[Clang][AST] Fix printing for `atomic_test_and_set` and `atomic_clear` (#159712)Devajith4-5/+117
https://github.com/llvm/llvm-project/pull/121943 rewrote `__atomic_test_and_set` and `__atomic_clear` to be lowered through AtomicExpr StmtPrinter::VisitAtomicExpr still treated them like other atomic builtins with a Val1 operand. This led to incorrect pretty-printing when dumping the AST. Skip Val1 for these two builtins like atomic loads.
34 hours[clang][bytecode] Typecheck called function pointers more thorougly (#159757)Timm Baeder3-15/+18
Fix two older FIXME items from the `functions.cpp` test.
35 hours[Clang] Rename elementwise builtins to `clzg` and `ctzg` (#157128)Joseph Huber12-103/+103
Summary: The added bit counting builtins for vectors used `cttz` and `ctlz`, which is consistent with the LLVM naming convention. However, these are clang builtins and implement exactly the `__builtin_ctzg` and `__builtin_clzg` behavior. It is confusing to people familiar with other other builtins that these are the only bit counting intrinsics named differently. This includes the additional operation for the undefined zero case, which was added as a `clzg` extension.
35 hours[WebKit checkers] fix a typo in a message in one of the checkers (#159593)Claudio Saavedra2-2/+2
36 hours[clang][bytecode] Move generic lambda handling to Compiler (#159733)Timm Baeder2-18/+18
So the static invoker's Function still points to the static invoker instead of the call operator of the lambda record. This is important for a later commit.
37 hoursRISC-V: builtins support for MIPS RV64 P8700 execution control .UmeshKalappa5-0/+98
the following changes are made a)Typo Fix (with previous PRhttps://github.com/llvm/llvm-project/pull/155747) b)builtins support for MIPS P8700 execution control instructions . c)Testcase
37 hours[Clang][NFC] Remove duplicated specialization of ↵Corentin Jabot3-48/+21
`llvm::DenseMapInfo<llvm::FoldingSetNodeID>` (#159718) In preparation of #141776
39 hours[RISCV] Implement MC support for Zvfofp8min extension (#157014)Jim Lin2-0/+10
This patch adds MC support for Zvfofp8min https://github.com/aswaterman/riscv-misc/blob/main/isa/zvfofp8min.adoc.
39 hours[clang][docs] mark v21 as released (#158629)h-vetinari2-13/+13
Update for the status pages now that v21.1 is out. Also specify WG14 N3006 "Underspecified object definitions" as available since Clang 19.
41 hours[Clang][CIR] fix enumeration value 'OMPGroupPrivate' not handled in switch ↵Maksim Levental1-1/+2
(#159694)
42 hours[WebKit checkers] Add the support for OSObjectPtr (#159484)Ryosuke Niwa24-128/+630
Add the support for OSObjectPtr, which behaves like RetainPtr.
44 hours[C++20][Modules] Fix merging of anonymous members of class templates. (#155948)Michael Park5-1/+126
46 hours[webkit.UncountedLambdaCapturesChecker] Treat arguments of ↵Ryosuke Niwa2-30/+69
std::ranges::all_of as [[clang::noescape]] (#158419) The checker already had std::ranges hard-coded to treat its arguments as [[clang::oescape]] but the fact std::ranges::all_of is implemented as a struct instead of a function confused the checker and resuled in a superflous warning being emitted for std::ranges::all_of. This PR adds the support for recognizing DeclRefExpr which appears as a callee in VisitCallExpr and generalizes the check in shouldTreatAllArgAsNoEscape to walk up the decl contexts to find the target namespaces such as std::ranges:: or a namespace and a function like WTF::switchOn.
48 hours[clang][Dependency Scanning] Canonicalize Defines of a Compiler Invocation ↵Qiongsi Wu2-2/+9
As Early As Possible (#159620) Before this patch, we only perform `-D` canonicalization on the deep copy of the `CompilerInvocation` instance, since the canonicalization should have no impact on scanning. However, in the presence of CAS, the content of the `builtin` macros are included in the context hash. This patch makes sure that we canonicalize the scanning `CompilerInvocation`'s `-D`s. Part of work for rdar://136303612. --------- Co-authored-by: Jan Svoboda <jan@svoboda.ai>
2 days[PowerPC] fix float ABI selection on ppcle (#154773)DanilaZhebryakov2-1/+5
soft float ABI selection was not taking effect on little-endian powerPC with embedded vectors (e.g. e500v2) leading to errors. (embedded vectors use "extended" GPRs to store floating-point values, and this caused issues with variadic arguments assuming dedicated floating-point registers with hard-float ABI)
2 days[llvm][clang] Pass VFS to `llvm::cl` command line handling (#159174)Jan Svoboda4-16/+26
This PR passes the VFS down to `llvm::cl` functions so that they don't assume the real file system.
2 days[HLSL] Make sure global resources and resource arrays cannot be assigned to ↵Helena Kotas6-3/+70
(#157772) Global resources are read-only. The compiler needs to report an error when somebody attempts to assign a value to a global resource, a global resource array element or the whole array. Test update in `static-local-ctor.hlsl` includes the use of the llvm-cxxfilt tool which takes care of demangling of function names for a more readable test baseline. Closes #154390
2 days[clang] check constant template parameters in dependent contexts (#159463)Matheus Izvekov3-13/+19
This patch makes sure constant template parameters are checked even in dependent contexts. This can for example diagnose narrowings earlier, but this is permitted as these templates would have no valid instantiations.
2 days[CIR] Implement Logical OR for VectorType (#158668)Amr Hesham3-3/+95
This change adds support for local OR op for VectorType Issue #136487
2 days[clang] Pass VFS into `ASTUnit::LoadFromASTFile()` (#159166)Jan Svoboda9-22/+27
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.
2 days[clang] Only set non-empty bypass to scan VFS (#159605)Jan Svoboda1-5/+6
Normalizing an empty modules cache path results in an incorrect non-empty path (the working directory). This PR conditionalizes more code to avoid this. Tested downstream by swift/llvm-project and the `DependencyScanningCAPITests.DependencyScanningFSCacheOutOfDate` unit test.
2 days[CIR] Support type promotion for Scalar unary plus & minus ops (#158486)Amr Hesham2-13/+98
Support type promotion for Scalar unary plus & minus ops
2 days[CIR] Support type promotion for Scalar unary real & imag ops (#158473)Amr Hesham3-28/+115
This change adds support for type promotion in Scalar unary real & imag ops Issue: https://github.com/llvm/llvm-project/issues/141365
2 days[CIR] Implement OpaqueValueExpr for Complex in C (#158423)Amr Hesham3-5/+81
This change adds support for the OpaqueValueExpr for Complex in C Issue: https://github.com/llvm/llvm-project/issues/141365
2 days[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow ↵Aditya Chaudhari9-9/+158
AVX/AVX512 subvector insertion intrinsics to be used in constexpr #157709 (#158778) AVX/AVX512 vector insert intrinsics now support constexpr evaluation in both the AST evaluator and bytecode interpreter paths. FIXES: #157709