FailedChanges

Summary

  1. [lldb] Print better diagnostics for user expressions and modules Summary: Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions. For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong: ``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: invalid operands to binary expression ('int' and 'double') ``` This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this: ``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float') printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) ~~~~~~^~~~ ``` To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to our internal wrapper code we inject. Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function) will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible. We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message without any context (and the original diagnostic in the user expression should be enough to explain the issue). Fixes rdar://24306342 Reviewers: JDevlieghere, aprantl, shafik, #lldb Reviewed By: JDevlieghere, #lldb Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65646
  2. Revert "r372201: [Support] Replace function with function_ref in writeFileAtomically. NFC" function_ref causes calls to the function to be ambiguous, breaking compilation. Reverting for now.
Revision 372203 by Raphael Isemann:
[lldb] Print better diagnostics for user expressions and modules

Summary:
Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions.

For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong:
```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: invalid operands to binary expression ('int' and 'double')
```

This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this:

```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float')
printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
                                               ~~~~~~^~~~
```

To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to
our internal wrapper code we inject.

Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function)
will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible.
We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message
without any context (and the original diagnostic in the user expression should be enough to explain the issue).

Fixes rdar://24306342

Reviewers: JDevlieghere, aprantl, shafik, #lldb

Reviewed By: JDevlieghere, #lldb

Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D65646
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticOptions.def (diff)clang.src/include/clang/Basic/DiagnosticOptions.def
The file was modified/cfe/trunk/lib/Frontend/TextDiagnostic.cpp (diff)clang.src/lib/Frontend/TextDiagnostic.cpp
The file was added/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/diagnosticsN/A
The file was added/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/diagnostics/MakefileN/A
The file was added/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/diagnostics/TestExprDiagnostics.pyN/A
The file was added/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/diagnostics/main.cppN/A
The file was modified/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp (diff)N/A
The file was modified/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h (diff)N/A
Revision 372202 by ibiryukov:
Revert "r372201: [Support] Replace function with function_ref in writeFileAtomically. NFC"

function_ref causes calls to the function to be ambiguous, breaking
compilation.

Reverting for now.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/Support/FileUtilities.h (diff)llvm.src/include/llvm/Support/FileUtilities.h
The file was modified/llvm/trunk/lib/Support/FileUtilities.cpp (diff)llvm.src/lib/Support/FileUtilities.cpp