[clang][ExprConst] Add "declared here" notes to uninitialized read diagnostics (#192206)
E.g. for
```c++
constexpr int unInitLocal() {
int a;
return a; // both-note {{read of uninitialized object}}
}
static_assert(unInitLocal() == 0, ""); // both-error {{not an integral constant expression}} \
// both-note {{in call to 'unInitLocal()'}}
```
we now diagnose:
```console
array.cpp:896:15: error: static assertion expression is not an integral constant expression
896 | static_assert(unInitLocal() == 0, ""); // both-error {{not an integral constant expression}} \
| ^~~~~~~~~~~~~~~~~~
array.cpp:894:10: note: read of uninitialized object is not allowed in a constant expression
[15 lines not shown]
[lldb][test] Add tests for repeating "memory read" command (#192063)
Tests that show the effect of #192057.
Until now repeating the command options was only tested in memory
tagging tests, which I don't run often. Here I am adding tests that'll
run anywhere.
[LV] Add support for absolute difference partial reductions (#188043)
This adds support for partial reductions where the extended operand is a
signed or unsigned absolute difference.
We match the absolute difference as `abs(sub(ext(X), ext(Y)))`, where
`type(X) == type(Y)` and both extends are the same kind (sext/zext).
This is then handled the same as an operand without a binop
(`ext(...)`), as we will transform the operand to
`ext(absolute-difference(A, B))` when we rewrite the reduction chain to
partial reductions.
This is an alternative to #162296.
[mlir][tosa] Add TOSA RESHAPE_BLOCK_SCALED support (#191149)
Experimental operator support, with no validation.
---------
Signed-off-by: Jeremy Johnson <jeremy.johnson at arm.com>
[TSAN][RISCV] Fix kHiAppMemEnd boundary for riscv64 (#191170)
This resolves TSan execution failures on riscv64 platforms when Address
Space Layout Randomization (ASLR) is disabled. There was an off-by-one
error in `tsan_platform.h` that caused the sanitizer to fail when memory
is mapped at the edge under non-ASLR environments. We fix this by
extending `kHiAppMemEnd` to cover the full allowed memory range:
`MappingRiscv64_39`: `0x3fffffffffull` -> `0x4000000000ull`
`MappingRiscv64_48`: `0x7fffffffffffull` -> `0x800000000000ull`
We also add riscv64 test support to `pie_no_aslr.cpp`
[BOLT] Update LSDA encoding for x86-64 large code model (#190685)
BOLT hardcoded 4-byte LSDA (exception table) encoding for x86-64. This
is insufficient for large code model binaries where functions in .ltext
sections may be placed at addresses above 2GB, exceeding the range of
DW_EH_PE_udata4/DW_EH_PE_sdata4 encodings.
Detect large code model by checking for .ltext sections
(SHF_X86_64_LARGE) and update LSDAEncoding to use 8-byte pointers:
- Non-PIC: DW_EH_PE_absptr (8-byte absolute)
- PIC: DW_EH_PE_pcrel | DW_EH_PE_sdata8 (8-byte PC-relative)
This was pulled out from
https://github.com/llvm/llvm-project/pull/190637
[clang][Parser] Improve error recovery for missing semicolons in class members. (#190744)
This is something I discovered when doing the investigation for
https://github.com/llvm/llvm-project/pull/188123#issuecomment-4162665482.
This patch improves recovery when a semicolon is missing after a class
member declarations.
When the parser expects a semicolon but encounters a token that is at
the start of a line and is a valid declaration specifier, it injects a
`;` instead of skipping tokens, this allows us to preserve the
declaration after the missing ";" instead of discarding it.
[clang] Fix crash in isAtEndOfMacroExpansion at FileID boundary. (#191734)
During error recovery, a synthetic token (whose length is 0) can be
inserted past the end of a FileID, e.g. inserting ")" when a macro-arg
containing a comma should be guarded by parentheses.
When calculating the location after this token, the calculated
`AfterLoc` can point exactly to the start of the next FileID
(`NextLocalOffset`), any source manager operations on the `AfterLoc` are
invalid.
This patch adds a safe guard in `Lexer::isAtEndOfMacroExpansion` to
prevent passing this invalid location to `SourceManager`.
Fixes #115007
Fixes #21755
[clangd] Introduce --skip-preamble-build command line option (#189284)
This option allows to disable preamble optimization in clangd. By
default it's false, but became true for TUs which import modules (and
experimental modules support is enabled).
This PR is a try to address C++20 modules problems described here
https://github.com/llvm/llvm-project/pull/187432
Fixes https://github.com/llvm/llvm-project/issues/181770
[MC] Fix .prefalign oscillation when body contains a .p2align (#192402)
The intervening FT_Align's padding depends on where this prefalign
lands, so body_size can oscillate across relaxOnce iterations. When a
downstream section reacts (e.g. .debug_line DWARF deltas crossing a
special-opcode boundary), the outer loop never terminates -- originally
reported as a hang with -O1 -g on
https://github.com/llvm/llvm-project/pull/184032#issuecomment-4235991852
```
static int a;
void b() {}
int c() { for (;;) { int d; for (; a;) return 0; } }
void e() { for (;;) ; }
```
X86 sets both the preferred function alignment
and the loop-header alignment to 16 (X86ISelLowering
setPrefLoopAlignment),
[3 lines not shown]
[lldb] Add synthetic variable support to Get*VariableList.
This patch adds a new flag to the lldb_private::StackFrame API to get variable lists: `include_synthetic_vars`. This allows ScriptedFrame (and other future synthetic frames) to construct 'fake' variables and return them in the VariableList, so that commands like `fr v` and `SBFrame::GetVariables` can show them to the user as requested.
This patch includes all changes necessary to call the API the new way - I tried to use my best judgement on when to include synthetic variables or not and leave comments explaining the decision.
As a consequence of producing synthetic variables, this patch means that ScriptedFrame can produce Variable objects with ValueType that contains a ValueTypeExtendedMask in a high bit. This necessarily complicates some of the switch/case handling in places where we would expect to find such variables, and this patch makes best effort to address all such cases as well. From experience, they tend to show up whenever we're dealing with checking if a Variable is in a specified scope, which means we basically have to check the high bit against some user input saying "yes/no synthetic variables".
stack-info: PR: https://github.com/llvm/llvm-project/pull/181501, branch: users/bzcheeseman/stack/9
[C++20] [Modules] Write comments in C++20 modules' module file (#192398)
Previously we avoid writing the comments in C++20 modules' module file.
But this prevents LSP tools to read the comments in it. Although we
thought to add a new option for it and ask LSP to use the new option,
the cost of comments seems to be low and new option raises complexity,
so I prefer to write comments in C++20 modules' module file by default
now.
[lldb] Scaffolding for synthetic variable support.
This patch handles most of the scaffolding for synthetic variable support that isn't directly tied to functional changes. This patch will be used by one following patch that actually modifies the lldb_private::StackFrame API to allow us to fetch synthetic variables.
There were a couple important/interesting decisions made in this patch that should be noted:
- Any value type may be synthetic, which is why it's a mask applied over the top of another value type.
- When printing frame variables with `fr v`, default to showing synthetic variables.
This new value type mask makes some of the ValueType handling more interesting, but since nothing generates objects with this mask until the next patch, we can land the concept in this patch in some amount of isolation.
stack-info: PR: https://github.com/llvm/llvm-project/pull/181500, branch: users/bzcheeseman/stack/8
[MacroFusion] Early return when insts already clustered (#191710)
This patch adds an early return to `fuseInstructionPair()` when macro
fused instructions are already clustered, either by an earlier fusion or
another clustering like ld/st clustering, removing the assert.
The assert is generally wrong - there are edge cases where an earlier
ld/st clustering (before macro fusion) reached the assert because it
sets `ParentClusterIdx` and fails. For example, ADRP+LOAD/STORE on
AArch64, thought it seems to be a rare case because the addresses are
ususally unkown at compile time.
It doesn't effectively change how fusions are prioritized - early
fusions still win on fusion-fusion conflicts, like before. But it
changes how we resolve the edge case of ld/st-fusion conflicts:
Previously, fusions would effectively override ld/st clustering in this
case, given that we currently limits instruction membership to at most a
single cluster through `ParentClusterIdx`. Macro fusion runs after ld/st
[10 lines not shown]