[clang-doc] Clean up implementation with better casting
Having access to RTTI style casting lets us use slightly nicer
structures to clean up the overly complicated dispatch logic in merging
and other places.
[clang-doc] Move Generator classes into the anonymous namespace
Clang-Tidy suggest moving these classes into the anonymous namespace,
to enforce internal linkage.
Updating test clang/test/Driver/driverkit-path.c for usage with CLANG_RESOURCE_DIR (#197154)
When the CMake option CLANG_RESOURCE_DIR is specified, it changes
the path to various tools and thus breaks some tests that look for things
in the "standard" location. This change updates one of the tests to take
into account the CLANG_RESOURCE_DIR value if specified by querying
compiler using `-print-resource-dir` to more accurately find the expected
directory in tests.
[flang][CUDA] Allocate converted kernel descriptors in device-accessible storage (#201950)
Fix CUDA descriptor lowering when an `fir.embox` result reaches a
`gpu.launch_func` through an intermediate `fir.convert`.
CodeGen previously failed to recognize this use chain and could place
the descriptor in host stack storage. Since CUDA kernels may dereference
assumed-shape descriptors on the device, such descriptors must be
allocated through the CUDA descriptor allocation path. Teach the
GPU-launch-use check to look through `fir.convert` so these descriptors
are lowered with `_FortranACUFAllocDescriptor`.
Also adds a regression test for the `fir.embox -> fir.convert ->
gpu.launch_func` case.
CI: move libclang python byindings tests to main CI
This removes the separate python bindings CI, which run on the GitHub free
runners and take more than one hour to build libclang.
The tests are executed instead in the monolithic pipelines,
whenever clang would be tested.
This is fine in terms of resources because all the dependencies are
built anyway, and the tests themselves take less than one second to
run on the free runners.
[clang] Reland: fix getTemplateInstantiationArgs (#202088)
Relands https://github.com/llvm/llvm-project/pull/199528
Previous: #201373
This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template
context of out-of-line definitions.
This greatly simplifies the signature of that function, by removing a
bunch
of workarounds, and simpliffying a couple that weren't removed yet.
Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.
Also makes the explicit specialization AST nodes stop abusing the
[2 lines not shown]
CI: move libclang python byindings tests to main CI
This removes the separate python bindings CI, which run on the GitHub free
runners and take more than one hour to build libclang.
The tests are executed instead in the monolithic pipelines,
whenever clang would be tested.
This is fine in terms of resources because all the dependencies are
built anyway, and the tests themselves take less than one second to
run on the free runners.
[ADT] Remove unused DenseMapInfo::getEmptyKey (#201998)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[libc][math] Fix arm-linux-gnueabihf target when building with gcc/g++. (#202090)
- `arm-linux-gnueabihf-gcc` defines fixed point macros (like
`__FRACT_FBIT__`) but does not support `_Fract` and `_Accum` types by
default. We just limit the fixed point support to clang for now.
- Specify the types for the sqrt instructions we use for ARM target.
Tested with:
```
$ cmake ../runtimes -GNinja -DLLVM_ENABLE_RUNTIMES=libc -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc-12 \
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++-12 \
-DLIBC_TARGET_TRIPLE=arm-linux-gnueabihf
$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
$ ninja libc-shared-tests
```
https://github.com/llvm/llvm-project/issues/201678.
[clang] fix getTemplateInstantiationArgs
This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the template
context of out-of-line definitions.
This greatly simplifies the signature of that function, by removing a bunch
of workarounds, and simpliffying a couple that weren't removed yet.
Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.
Also makes the explicit specialization AST nodes stop abusing the template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.
[clang-doc] Use llvm RTTI over handrolled casting (#202059)
Clang-Doc has a limited amount of polymorphism over Info types.
Historically, these have just been cast directly in a few places, but we
can use the existing llvm RTTI implementation to more rigorously
dispatch and query the types involved with only limited extra code.
This should make future changes a bit harder to get wrong.
[CodeGen][Transforms] Remove unused DenseMapInfo::getEmptyKey (#201994)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[SLP]Keep reuse mask in sync when reordering split node operand
When reorderBottomToTop uses an operand order for a split vectorize
node and the operand has both reordered and reused scalars, only the
reorder indices were cleared while the reuse mask was left stale. This
diverged the split node scalars from the operand effective order.
Fixes #202003
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/202084
[clang][clang-tools-extra] Remove unused DenseMapInfo::getEmptyKey (#201987)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[M68k] Disassemble index suppress in the full extension word correctly (#202080)
When the IS (Index Suppress) bit in the full extension word is set, we
need to use NoReg for the index register in the decoded MCInst. This was
not properly supported in the disassembler before.
This patch fixes this issue by using a pseudo 5-bit "register" binary
encoding for index register, where the first 4 bits carry the actual
register number and the last bit (at MSB) indicates whether we suppress
index register or not.
[DirectX][ObjectYAML] Fix SRCI Names parsing on Big Endian (#202020)
```
Names.Parameters = HeaderOnDisk;
```
converts SRCI Names section header from little endian to platform native
byte order (in converting constructor).
Therefore, extra
```
if (sys::IsBigEndianHost)
Names.Parameters.swapBytes();
```
can swap bytes of the header fields again, causing an error on SPARC:
```
SRCI Names section content ends beyond the section boundary
```
Fix that.
[IR][Analysis] Remove unused DenseMapInfo::getEmptyKey (#201997)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[VPlan] Prevent dangling references to trip count after expansion. (#201924)
Set trip count to Poison after expanding SCEVs to VPInstructions. getTripCount should not be used after that other than printing; setting to poison avoids accessing dangling references.
[lldb] Remove unused DenseMapInfo::getEmptyKey (#201990)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[llvm] Remove unused DenseMapInfo::getEmptyKey (#201996)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[mlir] Remove unused DenseMapInfo::getEmptyKey (#201991)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[clang-tidy] Fix `altera-id-dependent-backward-branch` false positives (#200660)
The check unconditionally marked the LHS of any assignment from a
variable or field as ID-dependent. As a result, ordinary assignments
like `x = y` or `i += chunk_size` could trigger false positives in later
loop conditions.
Only propagate ID-dependency when the RHS variable or field is already
known ID-dependent.
Based on the fix by @yeputons, with helper renaming and extra tests for
ordinary assignments, fields, macros, aliases, cv/ref cases, lambdas,
templates, concepts, and the #53777 range-for case.
Fix #52790
Fix #53777
Assisted by Codex.