Revert "[Clang] Enable -Wunused-template under -Wall" (#207848)
Reverts llvm/llvm-project#206123
See the Flang Runtime unit test failures, we probably should fix those
before merging this to keep buildbots green.
[Clang][HIP] Add LLVM vendored device headers for `*-llvm` triple (#203980)
Summary:
We already have the `*-llvm` vendor triple to imply a hermetic LLVM
toolchain for HIP. This adds the device portion of the headers that can
be used without a ROCm installation. These are vendored just like the
CUDA ones. Despite being HIP, these are actually generic because it onyl
uses clang builtins and the `gpuintrin` shims.
Reapply "DebugInfo: Shrink-to-fit some containers to reduce peak memory usage" (#199145) (#201160)
Starting with posting this as a draft PR to run presubmit checks to
understand what failed.
This reverts commit #199145,
effectively reapplying #198935.
[clang] Cap MS RTTI TypeDescriptor name strings like MSVC does (#206317)
On the Microsoft ABI, an RTTI TypeDescriptor stores the type's decorated
name as an inline string. Unlike symbol names, this string was never run
through the MD5 shortening that MSVC applies to over-long decorated
names. Deeply nested template types therefore produced unbounded
writable .data COMDATs: for example a type whose template arguments
contain a local lambda, whose mangled name re-spells the enclosing
template context at every level of nesting, grows exponentially with
depth. A five-level repro emitted an 82 MB object file.
Wrap the TypeDescriptor name string in the same msvc_hashing_ostream
already used for the RTTI symbol. When the name reaches the length limit
it is replaced by ??@<md5>@, mimicking MSVC. MSVC counts the leading .
of the name string toward the 4096-character limit but excludes it from
the hashed input, so the threshold here is one lower than for symbols.
Fixes #206313
[clang] Reland: fix getTemplateInstantiationArgs (#207825)
Relands https://github.com/llvm/llvm-project/pull/199528
Previous: https://github.com/llvm/llvm-project/pull/202088
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
[5 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.
[llvm][DebugInfo] Add DW_LNAME_ support to DWARFDie::getLanguage (#207151)
Currently `DWARFDie::getLanguage` only looks at `DW_AT_language`.
However, with DWARFv6 we may not have such attribute, and instead have a
`DW_AT_language_name` (and optional `DW_AT_language_version`).
This patch adjusts the implementation to also consider the DWARFv6
language name/version codes. In this patch I just convert it back to
`DW_LANG_` (similar to what we do for the `AsmPrinter`'s
`DwarfUnit::getSourceLanguage`). Added a FIXME to investigate whether we
want to return a variant-like type that can be either an DW_LANG vs.
DW_LNAME code.
The way I initially observed this was looking at a DWARFv6 dwarfdump for
a `const char[]` type. It displayed as follows:
```
DW_AT_type (0x... "const char[[?, ? + 3)]")
```
which is our representation for when we [can't derive the default lower
[12 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.
[Support] Fix undefined shift in decodeULEB128/decodeSLEB128 for overlong encodings (#205907)
When a (signed or unsigned) LEB128 value is encoded with extra trailing
bytes that only carry zero- or sign-extension, the decode loop could
keep
running with the shift amount at 64 or beyond and then evaluate
`Slice << Shift`, which is undefined behavior for a 64-bit type.
The DWARF expression parser feeds attacker-controlled LEB128 operands
(such as `DW_OP_bregN` / `DW_OP_constu`) through
`DataExtractor::getULEB128` / `getSLEB128`, so the
`lldb-dwarf-expression-fuzzer` reaches this under UBSan. The unsigned
case:
```
LEB128.h:152:20: runtime error: shift exponent 70 is too large for
64-bit type 'uint64_t' (aka 'unsigned long long')
#0 llvm::decodeULEB128(...) LEB128.h:152
#1 getLEB128<unsigned long long>(...) DataExtractor.cpp:227
[27 lines not shown]
[flang] keep runtime allocator for pinned allocations (#207822)
If an allocatable is pinned, use the flang runtime instead of lowering
to normal memcpy/free.
---------
Co-authored-by: Yebin Chon <ychon at nvidia.com>
[Clang][counted_by] Use the expr's RecordDecl that transitively contains the counter field (#205903)
The counted field could be in nested structs. This can happen when the
Expr is pointing to a field that has a struct type. The original code
didn't do a good job at finding the best RecordDecl to build the GEP off
of. It made too many assumptions about how structs' layouts.
This rewrite finds the RecordDecl that transitively contains the
__counted_by__'s counter field.
Fixes: #205652
[AArch64] Support 4-byte stack protector with large code model. (#205956)
This is a simple extension to existing code. We might need this in the
future.