aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
AgeCommit message (Collapse)AuthorFilesLines
5 hours[CIR] Add initial support for operator delete (#160574)Andy Kaylor3-0/+224
This adds basic operator delete handling in CIR. This does not yet handle destroying delete or array delete, which will be added later. It also does not insert non-null checks when not optimizing for size.
5 hours[CIR] Set the module name to the input filename (#160934)Andy Kaylor1-0/+13
This sets the MLIR module name to the main filename (according to the SourceManager), if one is available. The module name gets used when creating global init functions, so we will need it to be set.
5 hours [clang][x86][bytecode] Refactor BMI intrinsic wrappers to use ↵jiang19971-93/+52
interp__builtin_elementwise_int_binop (#160362) Fixes #160281
5 hours[clang][OpenMP] Support for reduction clause with array elements as modifier ↵SunilKuravinakop1-1/+2
(#160846) Changes to support for array elements in reduction clause e.g. "reduction (+:a[1])" --------- Co-authored-by: Sunil Kuravinakop <kuravina@pe31.hpc.amslabs.hpecorp.net>
5 hours[Headers][X86] Allow AVX1 fixed extraction intrinsics to be used in ↵Chaitanya Koparkar1-13/+10
constexpr (#161218) Fixes #161204.
6 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.
7 hours[clang][NFC] Remove const_casts from diagnostic emissions (#161211)Timm Baeder3-10/+6
This is apparently not necessary anymore. Not sure when exactly it changed though.
7 hours[AMDGPU] Add a new builtin type for image descriptor rsrc (#160258)Rana Pratap Reddy1-0/+4
Adding a new builtin type for AMDGPU's image descriptor rsrc data type This requires for https://github.com/llvm/llvm-project/pull/140210
8 hours[Clang] Fixes __builtin_is_implicit_lifetime for types with deleted ctrs ↵Corentin Jabot1-7/+10
(#161163) We failed to check that the trivial constructor where eligible (this implies non deleted). Fixes #160610
9 hours[analyzer] CStringChecker: Fix crash in `CheckOverlap` when arguments are ↵guillem-bartrina-sonarsource1-0/+4
not pointers (#160511) https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp#L675-L678 mistakenly assumes that target expressions are of pointer type. `CheckOverlap` has multiple call sites, most of which do not verify this assumption. Therefore, the simplest solution is to verify it just before that point.
9 hoursReland "[clang][DebugInfo][NFC] Simplify CollectRecordLambdaFields"Michael Buch2-24/+41
This reverts commit 99a29f640809f32d1271ed5cac9764b839daeed1. Original change was reverted because following assertion started firing: ``` clang++: clang/include/clang/AST/LambdaCapture.h:105: ValueDecl *clang::LambdaCapture::getCapturedVar() const: Assertion `capturesVariable() && "No variable available for capture"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0.Program arguments: ../../prebuilt/third_party/clang/custom/bin/clang++ -MD -MF host_x64/obj/third_party/android/platform/system/libbase/libbase.logging.cpp.o.d -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I../.. -Ihost_x64/gen -I../../third_party/android/platform/system/libbase/include -I../../third_party/fmtlib/src/include -I../../third_party/android/platfo...com 1.<eof> parser at end of file 2.Per-file LLVM IR generation clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation) Fuchsia clang version 22.0.0git (https://llvm.googlesource.com/llvm-project 8553bd2b29ad2b17a9a884f14da6c43b606ec776) ******************** ``` The relanded patch just adds a `Capture.capturesVariable()` check before calling `getCapturedVar`. That's what the code did before the refactor.
10 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.
11 hours[clang][bytecode] Pointer::isZero - fix MSVC "not all control paths return a ↵Simon Pilgrim1-0/+1
value" warning. NFC. (#161168)
15 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.
16 hours[clang] fix code synthesis context depth limit logic (#161103)Matheus Izvekov1-45/+43
This makes the instantation depth limit be checked whenever the code synthesis context is pushed, not only when creating a InstantiatingTemplate RAII object. Also fix the note suggesting the user increases `-ftemplate-depth` so it is printed even in a SFINAE context.
16 hours[clang] treat deduced-as-dependent as undeduced for constant template ↵Matheus Izvekov1-1/+1
parameters (#161099) The AutoType's deduced-as-dependent mechanism is not really used for constant template parameters, but this is currently harmless to ignore because when dealing which such types, they will have been transformed, turning them back to plain undeduced AutoTypes. This should be NFC for current main users, but https://github.com/llvm/llvm-project/pull/141776 will depend on this.
17 hours[Clang][OpenMP][LoopTransformations] Implement "#pragma omp fuse" loop ↵Walter J.T.V17-38/+1108
transformation directive and "looprange" clause (#139293) This change implements the fuse directive, `#pragma omp fuse`, as specified in the OpenMP 6.0, along with the `looprange` clause in clang. This change also adds minimal stubs so flang keeps compiling (a full implementation in flang of this directive is still pending). --------- Co-authored-by: Roger Ferrer Ibanez <roger.ferrer@bsc.es>
29 hours[Support] Deprecate one form of support::endian::byte_swap (NFC) (#161045)Kazu Hirata1-2/+2
This is a follow-up to #156140 and #160979, which deprecated one form of write and read, respectively. We have two forms of byte_swap: template <typename value_type> [[nodiscard]] inline value_type byte_swap(value_type value, endianness endian) template <typename value_type, endianness endian> [[nodiscard]] inline value_type byte_swap(value_type value) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter because the latter is just forwarded to the former.
38 hours[NFC][clang] Move simplifyConstraint to TargetInfo.cpp (#154905)Iris Shi2-54/+53
Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
41 hours[clang][bytecode] Diagnose volatile writes (#160350)Timm Baeder7-10/+44
42 hours[clang-format] Fix bugs in annotating arrows and square brackets (#160973)owenca2-17/+13
Fixes #160518
43 hours[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
43 hours[clang-format] Fix qualifier ordering for lines after PP directives (#160731)Ruoyu Zhong1-1/+1
Lines appearing after preprocessor conditional blocks (like `#endif`) were not having their qualifiers reordered by `QualifierOrder`, while lines inside the conditional blocks were processed correctly. The issue was that tokens on lines following preprocessor directives have `MustBreakBefore` = `true`. The qualifier alignment logic was breaking immediately upon encountering any token with `MustBreakBefore` = `true`, preventing analysis of the entire line. The fix allows processing to continue when `MustBreakBefore` = `true` on the first token of a line, since this is expected behavior (the token legitimately starts a new line). Only tokens with `MustBreakBefore` = `true` that appear mid-line will cause the analysis loop to break. Fixes https://github.com/llvm/llvm-project/issues/160487.
45 hours[clang] fix transformation of subst constant template parameter nodes (#161029)Matheus Izvekov6-212/+127
This simplifies those transforms a lot, removing a bunch of workarounds which were introducing problems. The transforms become independent of the template instantiator, so they are moved to TreeTransform instead. Fixes #131342 This PR was already reviewed and approved at https://github.com/llvm/llvm-project/pull/160777, but I accidentally merged that into another PR, instead of main.
45 hours[clang] simplify placeholder type deduction for constant template parameters ↵Matheus Izvekov2-55/+44
(#160439) This makes the deduction for dependent types operate in more similar ways to the non-dependent one, such as when matching template template parameters, making errors in those generate similar diagnostics to the non-dependent ones. This also removes some superfluous implicit casts, simplifying the resulting AST a little bit.
3 days[CIR] Implement logical not for VectorType (#160762)Amr Hesham1-4/+8
This change implements logical not for VectorType
3 days[CIR] Implement UO real on result from real with type promotion (#160951)Amr Hesham1-3/+4
Implement UO real on the result from real with type promotion Issue: https://github.com/llvm/llvm-project/issues/141365
3 days[clang] Fix a use-after free in ASTContext::getSubstBuiltinTemplatePack ↵Alexander Kornienko1-1/+7
(#160970) ASTContext::getSubstBuiltinTemplatePack finds InsertPos and then calls itself recursively, which may lead to rehashing and invalidation of all pointers to buckets. The function then proceeds with using the potentially invalid InsertPos, leading to use-after-free. The issue goes back to https://github.com/llvm/llvm-project/pull/157662. I didn't manage to produce a reasonably-sized test case yet.
3 days[clang][bytecode][NFC] Simplify a few builtin implementations (#160910)Timm Baeder1-56/+31
3 days[clang] Use the VFS to get the OpenMP entry info (#160935)Jan Svoboda1-3/+1
This PR uses the VFS to get the OpenMP entry info instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
3 days[clang] Use the VFS to get the unique file ID (#160936)Jan Svoboda1-4/+9
This PR uses the VFS to get the unique file ID when printing externalized decls in CUDA instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
3 days[clang][analyzer] Use the VFS to check model files (#160950)Jan Svoboda1-1/+1
This PR uses the VFS to check `.model` files in the Clang static analyzer to match the compiler's behavior for other input files.
3 days[clang] Use the VFS to check the system framework marker (#160946)Jan Svoboda1-2/+1
This PR uses the VFS/`FileManager` to check the system framework marker instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
3 daysRevert "[clang][DebugInfo][NFC] Simplify CollectRecordLambdaFields" (#160932)Petr Hosek2-39/+24
Reverts llvm/llvm-project#160690
3 days[clang] Use the VFS to create the OpenMP region entry ID (#160918)Jan Svoboda1-1/+2
This PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
3 days[OpenMP][clang] Set num_threads 'strict' to unsupported on GPUs (#160659)Robert Imschweiler5-17/+71
Setting the prescriptiveness of the num_threads clause to 'strict' and having a corresponding check (with message and severity clauses) does not align well with how OpenMP should be handled for GPUs. The num_threads expression may be an arbitrary integer expression which is evaluated on the target, in correspondance to the OpenMP spec. This prevents the check from being done before launching the kernel, especially considering that the num_threads clause is associated with the parallel directive and that there may be multiple parallel directives with different num_threads clauses in a single target region. Acting on the result of the 'strict' check on the GPU would require doing I/O on the GPU, which can introduce performance regressions. Delaying any actions resulting from the 'strict' check and doing them on the host after executing the target region involves additional data copies and is not really semantically correct. For now, the 'strict' modifier for the num_threads clause and its associated message and severity clause are set to be unsupported on GPUs. Targets other than GPUs still support the aforementioned features in the context of an OpenMP target region.
3 days[clang] Load `-fembed-offload-object=` through the VFS (#160906)Jan Svoboda3-4/+5
This PR loads the path from `-fembed-offload-object=<path>` through the VFS rather than going straight to the real file system. This matches the behavior of other input files of the compiler. This technically changes behavior in that `-fembed-offload-object=-` no longer loads the file from stdin, but I don't think that was the intention of the original code anyways.
3 days[clang][Dependency Scanning][NFC] Move `DependencyScanningAction` to its own ↵Qiongsi Wu4-557/+609
header and source files (#160795) This is the first of three PRs to land https://github.com/llvm/llvm-project/pull/160207 in smaller pieces. This PR is an NFC. It moves `DependencyScanningAction` to its own source file, so we can later implement a `CompilerInstanceWithContext` in the new file. Part of work for rdar://136303612.
3 days[Clang] Fix Codegen UO real/imag crash on scalar with type promotion (#160609)Amr Hesham1-13/+18
Fixing codegen crash when compiling real/imag unary operators on scalar with type promotion Ref: #160583
3 days[clang][CodeGen] Fix sub-optimal clang CodeGen for __atomic_test_and_set ↵Sirui Mu1-1/+2
(#160098) Clang CodeGen for `__atomic_test_and_set` would emit a `store` instruction that stores an `i1` value: ```cpp bool f(void *ptr) { return __atomic_test_and_set(ptr, __ATOMIC_RELAXED); } ``` ```llvm %1 = atomicrmw xchg ptr %0, i8 1 monotonic, align 1 %tobool = icmp ne i8 %1, 0 store i1 %tobool, ptr %atomic-temp, align 1 ``` which could lead to suboptimal binary code, for example on x86_64: ```asm f: mov al, 1 xchg byte ptr [rdi], al test al, al setne al setne byte ptr [rsp - 1] ret ``` The last `setne` instruction is obviously redundant. This patch fixes this issue by first zero-extending `%tobool` to an `i8` before the store. This effectively eliminates the last `setne` instruction in the binary code sequence. The `test` and `setne` on `al` is kept still, though. ----- I'm quite conservative about the codegen in this patch. Vanilla gcc actually emits simpler code for `__atomic_test_and_set`: ```cpp bool f(void *ptr) { return __atomic_test_and_set(ptr, __ATOMIC_RELAXED); } ``` ```asm f: mov eax, 1 xchg al, BYTE PTR [rdi] ret ``` It seems like gcc assumes `ptr` would always point to a valid `bool` value as required by the ABI. I'm not sure if we should also make this assumption. Related to #121943 .
3 days[clang][bytecode][NFC] Simplify align_up/down implementation (#160880)Timm Baeder1-7/+5
Fix a double assignment to a local variable and use the new popToAPSInt() overload.
3 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.
3 days[clang][bytecode][NFC] Use switches for pointer type distinction (#160879)Timm Baeder2-26/+36
In the important places. They are all fully covered switch statements so we know where to add code when adding a new pointer type.
3 days[Clang][RVV][SVE] Cache getScalableVectorType lookups (#160108)Shaoce SUN1-7/+11
Currently, RVV/SVE intrinsics are cached, but the corresponding type construction is not. As a result, `ASTContext::getScalableVectorType` can become a performance hotspot, since every query must run through a long sequence of type checks and macro expansions.
3 days[NFC][OpenACC][CIR] Extract 'base' class for Recipe generation (#160603)Erich Keane3-293/+357
It was brought up on a previous review that the CIRGenOpenACCRecipe.h file was getting too large. I noticed that the 'dependent on template argument' parts were actually quite small, so I extract a base class in this patch that allows me to implement it in the .cpp file, plus minimize the amount of code that needs instantiating.
3 days[clang][bytecode] Remove Program include from InterpFrame.h (#160843)Timm Baeder3-4/+7
Program itself is unused in that file, so just include the needed headers.
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.
4 days[clang][SPARC] Pass 16-aligned structs with the correct alignment in CC ↵Koakuma1-69/+57
(#155829) Pad argument registers to preserve overaligned structs in LLVM IR. Additionally, since i128 values will be lowered as split i64 pairs in the backend, correctly set the alignment of such arguments as 16 bytes. This should make clang compliant with the ABI specification and fix https://github.com/llvm/llvm-project/issues/144709.
4 days[Clang][FIX] Fix type qualifiers on vector builtins (#160185)Joseph Huber2-20/+77
Summary: These were not stripping qualifiers when using them to infer the types, leading to errors when mixiing const and non-const.
4 days[clang][DebugInfo][NFC] Simplify CollectRecordLambdaFields (#160690)Michael Buch2-24/+39
This patch creates a helper to retrieve the name from a lambda capture and only calls `createFieldType` once. This will simplify reviewing some upcoming changes in this function.