aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST
AgeCommit message (Collapse)AuthorFilesLines
20 hours [clang][x86][bytecode] Refactor BMI intrinsic wrappers to use ↵jiang19971-93/+52
interp__builtin_elementwise_int_binop (#160362) Fixes #160281
23 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
26 hours[clang][bytecode] Pointer::isZero - fix MSVC "not all control paths return a ↵Simon Pilgrim1-0/+1
value" warning. NFC. (#161168)
32 hours[Clang][OpenMP][LoopTransformations] Implement "#pragma omp fuse" loop ↵Walter J.T.V4-5/+124
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>
2 days[clang][bytecode] Diagnose volatile writes (#160350)Timm Baeder7-10/+44
3 days[clang] fix transformation of subst constant template parameter nodes (#161029)Matheus Izvekov2-3/+4
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.
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
4 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.
4 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.
4 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.
4 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.
5 days[NFC][Clang][OpenMP] Add helper functions/utils for finding/comparing attach ↵Abhinav Gaba1-0/+72
base-ptrs. (#155625) These have been pulled out of the codegen PR #153683, to reduce the size of that PR.
5 days[clang][bytecode] Use in `Expr::tryEvaluateString` (#160118)Timm Baeder3-1/+57
Fixes #157492
6 days[AST] Fix a warningKazu Hirata1-1/+2
This patch fixes: clang/lib/AST/ByteCode/InterpBuiltin.cpp:2603:15: error: unused variable 'VT1' [-Werror,-Wunused-variable]
6 days[clang][bytecode] Use existing Descriptor local in InitElem op (#160535)Timm Baeder1-4/+4
Instead of going the way through `Pointer::isUnknownSizeArray()`.
6 days[Headers][X86] VectorExprEvaluator::VisitCallExpr - allow SSE/AVX2/AVX512 ↵woruyu2-1/+131
pack intrinsics to be used in constexpr (#156003) Fixes #154283
6 days[clang][bytecode] Don't crash on a null Descriptor (#160506)Timm Baeder1-0/+3
... for dynamic memory allocation. This happens when the requested array size is too large. Fixes #152951
6 days[clang][bytecode] Use stack offsets for This/RVO ptrs (#160285)Timm Baeder4-44/+47
Instead of keeping the `Pointer`s itself in `InterpFrame`, just save them as offsets and use stackRef<>() when we need them.
7 days[z.OS] fix strnlen() usage in Context.cpp available on z/OS (#160339)Zibi Sarbinowski1-0/+1
On z/OS `strnlen()` is not available by default so we use the wrapper header `zOSSupport.h` to make it visible. This will fix the following error: ``` clang/lib/AST/ByteCode/Context.cpp:250:16: error: use of undeclared identifier 'strnlen' 250 | Result = strnlen(reinterpret_cast<const char *>(Ptr.getRawAddress()), N); | ^~~~~~~ 1 error generated. ```
7 days[HLSL] Add support for the HLSL matrix type (#159446)Farzon Lotfi1-4/+33
fixes #109839 This change is really simple. It creates a matrix alias that will let HLSL use the existing clang `matrix_type` infra. The only additional change was to add explict alias for the typed dimensions of 1-4 inclusive matricies available in HLSL. Testing therefore is limited to exercising the alias, sema errors, and basic codegen. future work will add things like constructors and accessors. The main difference in this attempt is the type printer and less of an emphasis on tests where things overlap with existing `matrix_type` testing like cast behavior.
7 days[clang][x86][bytecode] Replace interp__builtin_knot with static bool ↵fennecJ1-11/+2
interp__builtin_elementwise_int_unaryop callback (#160332) Fix #160287
7 days[clang][byte] Add callback mechanism to handle constexpr for unary integer ↵Simon Pilgrim1-28/+26
ops (#160280) Add interp__builtin_elementwise_int_unaryop - similar to what we already have with interp__builtin_elementwise_int_binop to handle binops Update x86 lzcnt/tzcnt intrinsics to use with a suitable callback I'll add vector handling in a future patch when we add x86 vector intrinsics that can use it
7 days[clang][bytecode] Fix unknown size arrays crash in clang bytecode (#160015)Osama Abdelkader1-0/+3
Fixes #153948 Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
7 days[clang][bytecode] Remove bogus Initializing special case (#159933)Timm Baeder1-7/+2
This doesn't seem to be needed anymore and causes problems. Fixes #159787
7 days[Headers][X86] Allow basic AVX512 predicate ops to be used in constexpr ↵fennecJ2-0/+137
(#159998) Fixes #158646
7 days[clang][bytecode] Only block pointers can be partially initialized (#160075)Timm Baeder1-0/+2
So ignore the rest in `checkFullyInitialized()`. Fixes #160071
7 days[clang][bytecode] Load value of non-lvalue ArraySubscriptExpr (#160024)Timm Baeder1-1/+6
As happens in C. Fixes #158482
7 days[clang][bytecode] Print dummy-status of global variables (#160240)Timm Baeder1-0/+2
in Program::dump().
9 days[clang] NFC: small formatting and stray whitespace cleanupMatheus Izvekov1-8/+8
Formats `Expr::HasSideEffects` because incorrect identation of block end token makes clang-format go haywire in patch mode. Also removes stray whitespace from a test file.
9 days[clang] ast-dump: use template pattern for `instantiated_from` (#159952)Matheus Izvekov2-3/+22
This changes the instiantiated_from field to use `getTemplateInstantiationPattern`, which makes this field work for all template specialization kinds, not just member templates. Also adds this field to variables, and adds equivalents for the JSON dumper as well.
10 days[clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to ↵Michael Buch1-1/+42
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
10 days[clang][PAC] Don't try to diagnose use of pointer auth on dependent types ↵Oliver Hunt1-0/+3
#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
11 days[clang] fix expression classification for dependent binary operators (#159819)Matheus Izvekov1-0/+7
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.
11 days[Clang][AST] Fix printing for `atomic_test_and_set` and `atomic_clear` (#159712)Devajith1-5/+1
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.
11 days[clang][bytecode] Typecheck called function pointers more thorougly (#159757)Timm Baeder2-5/+10
Fix two older FIXME items from the `functions.cpp` test.
11 days[Clang] Rename elementwise builtins to `clzg` and `ctzg` (#157128)Joseph Huber2-15/+15
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.
11 days[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.
11 days[Clang][NFC] Remove duplicated specialization of ↵Corentin Jabot1-21/+0
`llvm::DenseMapInfo<llvm::FoldingSetNodeID>` (#159718) In preparation of #141776
11 days[C++20][Modules] Fix merging of anonymous members of class templates. (#155948)Michael Park1-0/+4
12 days[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow ↵Aditya Chaudhari2-0/+105
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
12 days[clang][bytecode] Optimize InterpStack (#159400)Timm Baeder2-33/+43
Replace `StackChunk::End` with `StackChunk::Size`, mark the allocating code paths as unlikely and move `grow()` into the header, which allows us to template this for the `Size` parameter. Since we only push our primitive types on the stack and all the sizes are aligned to pointer size multiples, this only results in a few instantiations.
12 days[clang][bytecode] Pass `SourceInfo` objects by value (#159532)Timm Baeder4-11/+11
They are only pointer-sized and copying them is cheaper than taking the const ref.
12 days[clang] [OpenMP] New OpenMP 6.0 - Parsing and Sema support for groupprivate ↵Ritanya-B-Bharadwaj3-0/+31
(#158134)
12 days[clang] Remove Diag parameter from Expr::EvaluateKnownConstInt (#159512)Timm Baeder1-3/+1
If it's truly a known const int, it won't emit any diagnostics anyway. And if it did, we wouldn't notice because no call site passed something non-null.
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 | } | ^
13 days[AST] Fix an assertion failure in TypeName::getFullyQualifiedName (#159312)Ilya Biryukov1-3/+6
This popped up during our internal integrates of upstream changes. It started happening after ba9d1c41c41d568a798e0a8c38a89d294647c28d, which started using `TemplateSpecializationType` in this place and the code was not prepared to handle it.
13 days[clang][ExprConst] Move getLangOpts() to interp::State subclasses (#159280)Timm Baeder4-6/+4
Instead of having `State::getLangOpts()`, which does a virtual call to `getASTContext()` to call `getLangOpts()` on that, just move `getLangOpts()` to the subclasses so we can do that without the virtual call. We never call `getLangOpts()` in `State.cpp`, so it's not needed in the base class.
13 days[clang][ExprConst] Assert that EvaluateAsInitializer has non-null VD (#159274)Timm Baeder2-8/+6
Both the expression (the initializer) as well as the VarDecl can't be null here. Assert that.
13 days[clang][bytecode] Remove InterpFrame::IsBottom flag (#159279)Timm Baeder2-4/+3
The bottom frame is the one without a parent. No need to save that information separately.