[lldb][TypeSystemClang] Honor DW_AT_rvalue_reference when creating C++ FunctionPrototypes
authorMichael Buch <michaelbuch12@gmail.com>
Mon, 26 Sep 2022 16:38:37 +0000 (18:38 +0200)
committerMichael Buch <michaelbuch12@gmail.com>
Tue, 27 Sep 2022 17:03:23 +0000 (18:03 +0100)
commit60eb06be6d23e3c5fd80113143784aac0d962965
tree10d80a1c75129b12a5f18152e1872336ac1504c5
parenta6383bb51cce781fc8236c89966a09879dc4bb25
[lldb][TypeSystemClang] Honor DW_AT_rvalue_reference when creating C++ FunctionPrototypes

Currently funciton lookup in the expression evaluator
fails to disambiguate member functions the are overloaded
on lvalue/rvalue reference-qualifiers. This happens because
we unconditionally set a `FunctionPrototype`s
`ExtProtoInfo::RefQualifier` to `RQ_None`. We lose
the ref-qualifiers in the synthesized AST and `clang::Sema`
fails to pick a correct overload candidate.

DWARF emits information about a function's ref-qualifiers
in the form of a boolean `DW_AT_rvalue_reference` (for rvalues)
and `DW_AT_reference` (for lvalues).

This patch sets the `FunctionPrototype::ExtProtoInfo::RefQualifier`
based on the DWARF attributes above.

**Testing**

* Added API test

llvm/llvm-project issue #57866

Differential Revision: https://reviews.llvm.org/D134661
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/test/API/lang/cpp/function-ref-qualifiers/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/function-ref-qualifiers/TestCppFunctionQualifiers.py [new file with mode: 0644]
lldb/test/API/lang/cpp/function-ref-qualifiers/main.cpp [new file with mode: 0644]