llvm-project/lldb/source
Raphael Isemann 3c2dc28d81 [lldb] Also apply Fix-Its in "note:" diagnostics that belong to an error diagnostic
Summary:
LLDB currently applies Fix-Its if they are attached to a Clang diagnostic that has the
severity "error". Fix-Its connected to warnings and other severities are supposed to
be ignored as LLDB doesn't seem to trust Clang Fix-Its in these situations.

However, LLDB also ignores all Fix-Its coming from "note:" diagnostics. These diagnostics
are usually emitted alongside other diagnostics (both warnings and errors), either to keep
a single diagnostic message shorter or because the Fix-It is in a different source line. As they
are technically their own (non-error) diagnostics, we currently are ignoring all Fix-Its associated with them.

For example, this is a possible Clang diagnostic with a Fix-It that is currently ignored:
```
error: <user expression 1>:2:10: too many arguments provided to function-like macro invocation
ToStr(0, {,})
         ^
<user expression 1>:1:9: macro 'ToStr' defined here
#define ToStr(x) #x
        ^
<user expression 1>:2:1: cannot use initializer list at the beginning of a macro argument
ToStr(0, {,})
^        ~~~~
```

We also don't store "note:" diagnostics at all, as LLDB's abstraction around the whole diagnostic
concept doesn't have such a concept. The text of "note:" diagnostics is instead
appended to the last non-note diagnostic (which is causing that there is no "note:" text in the
diagnostic above, as all the "note:" diagnostics have been appended to the first "error: ..." text).

This patch fixes the ignored Fix-Its in note-diagnostics by appending them to the last non-note
diagnostic, similar to the way we handle the text in these diagnostics.

Reviewers: JDevlieghere, jingham

Reviewed By: JDevlieghere

Subscribers: abidh

Differential Revision: https://reviews.llvm.org/D77055
2020-04-06 10:37:33 +02:00
..
API [lldb] Change Communication::SetConnection to take a unique_ptr 2020-04-02 14:42:25 +02:00
Breakpoint [lldb][nfc] early exit/continue 2020-04-03 14:50:08 +02:00
Commands Fix unused variable, format, and format string warnings. 2020-04-03 17:58:59 -07:00
Core [lldb] Change Communication::SetConnection to take a unique_ptr 2020-04-02 14:42:25 +02:00
DataFormatters [lldb][NFC] Always update m_cache_{hits/misses} in FormatCache 2020-03-24 20:16:43 +01:00
Expression [lldb/DWARF] Fix evaluator crash when accessing empty stack. 2020-03-31 17:44:57 +02:00
Host [lldb/Support] Treat empty FileSpec as an invalid file. 2020-04-03 09:29:22 -07:00
Initialization [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Interpreter [source maps] Fix remove, insert-after and replace 2020-04-03 19:15:56 -07:00
Plugins [lldb] Also apply Fix-Its in "note:" diagnostics that belong to an error diagnostic 2020-04-06 10:37:33 +02:00
Symbol [lldb/Symbol] Reimplement Symbols::FindSymbolFileInBundle to use the VFS 2020-04-03 09:29:22 -07:00
Target Fix LLDB debug builds 2020-04-03 19:49:38 -07:00
Utility Re-land "[lldb/Reproducers] Always collect the whole dSYM in the reproducer" 2020-03-31 12:47:12 -07:00
CMakeLists.txt Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well. 2020-01-16 19:04:08 -05:00
lldb.cpp [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY 2020-02-20 10:07:50 -08:00