diff options
| author | Balazs Benics <balazs.benics@sigmatechnology.se> | 2021-09-30 11:53:08 +0200 |
|---|---|---|
| committer | Balazs Benics <balazs.benics@sigmatechnology.se> | 2021-09-30 11:53:08 +0200 |
| commit | e5e0e00831ba093639edbd443b6e05b3118f8930 (patch) | |
| tree | 8d36fcaf874aa43366dafa970ddcedcd8a3a44a8 /lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h | |
| parent | 230a6edb49c31e2c96613f5b7deefd4f4faf9a6d (diff) | |
| download | llvm-e5e0e00831ba093639edbd443b6e05b3118f8930.zip llvm-e5e0e00831ba093639edbd443b6e05b3118f8930.tar.gz llvm-e5e0e00831ba093639edbd443b6e05b3118f8930.tar.bz2 | |
[NFC] Cleanup the overload of ASTImporter::import()
This patch aims to address the comment of a previous review:
https://reviews.llvm.org/D109237#inline-1040678
The original problem was the following:
`T` is substituted by `clang::Type`
Expected<T *> import(T *From) {
auto ToOrErr = Importer.Import(From);
// ^^^^^^^^^^^^^^^^^^^^^
if (!ToOrErr)
return ToOrErr.takeError();
return cast_or_null<T>(*ToOrErr);
// ^^^^^^^^^^^^^^^^^^^^^^^^^
}
`Importer.Import()` operates on `const Type *`, thus returns `const Type *`.
Later, at the return statement, we will try to construct an `Expected<Type*>`
from a `const Type *`, which failed with a miserable error message.
In all other cases `importer.Import()` results in a non-const version,
so everything works out just fine, but for `clang::type`s, we should
really return a const version.
So, in case of `T` is a subclass of `clang::Type`, it will return a
`Exprected<const T*>` instead.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D109269
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h')
0 files changed, 0 insertions, 0 deletions
