llvm-project/lldb
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
..
bindings Create basic SBEnvironment class 2020-03-23 19:23:33 -07:00
cmake [lldb][cmake] Move remove_module_flags macro to AddLLDB.cmake 2020-03-06 17:21:24 -08:00
docs Revert "Revert "[lldb/Docs] Mark both Python 3.6 and 3.8 as supported on Windows"" 2020-03-03 20:43:16 +01:00
examples [lldb] Make gdbremote.py utility py2and3 compatible 2020-02-13 09:18:55 +01:00
include/lldb Fix unused variable, format, and format string warnings. 2020-04-03 17:58:59 -07:00
packages/Python/lldbsuite [lldb] Allow expect_expr without a running target 2020-04-01 09:39:24 +02:00
resources
scripts [lldb/Scripts] Remove swig_bot_lib/__init__.py 2020-01-16 09:15:41 -08:00
source [lldb] Also apply Fix-Its in "note:" diagnostics that belong to an error diagnostic 2020-04-06 10:37:33 +02:00
test [lldb] Also apply Fix-Its in "note:" diagnostics that belong to an error diagnostic 2020-04-06 10:37:33 +02:00
third_party/Python/module Increase timeout in pexpect to lower chances of tests failing under ASAN. 2019-10-10 16:16:49 +00:00
tools [intel-mpx] Delete an unnecessary license header 2020-04-03 17:27:37 -07:00
unittests [lldb/Support] Treat empty FileSpec as an invalid file. 2020-04-03 09:29:22 -07:00
utils [lldb]/Tablegen] Use ElementType instead of DefaultValueUnsinged 2020-03-20 18:35:13 -07:00
.clang-format
.clang-tidy [lldb] Add .clang-tidy with customization to disable readability-identifier-naming 2020-03-09 12:50:28 -07:00
.gitignore Add .noindex to the gitignore 2019-04-05 17:57:42 +00:00
CMakeLists.txt [lldb/CMake] Only CMAKE_CFG_INTDIR if it's not '.' 2020-03-27 17:49:00 -07:00
CODE_OWNERS.txt [lldb][NFC] Cleanup mentions and code related to lldb-mi 2019-07-19 15:55:23 +00:00
LICENSE.TXT
use_lldb_suite_root.py