This is an archive of the discontinued LLVM Phabricator instance.

[lldb][TypeSystemClang] Honor DW_AT_rvalue_reference when creating C++ FunctionPrototypes
ClosedPublic

Authored by Michael137 on Sep 26 2022, 11:48 AM.

Details

Summary

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 FunctionPrototypes
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

Diff Detail

Event Timeline

Michael137 created this revision.Sep 26 2022, 11:48 AM
Herald added a project: Restricted Project. · View Herald Transcript
Michael137 requested review of this revision.Sep 26 2022, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 11:48 AM
labath accepted this revision.Sep 27 2022, 8:40 AM
labath added a subscriber: zequanwu.

Looks straight forward enough. Tagging @zequanwu, as he might want to do something similar for PDB.

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
41

I guess the clang/AST/Type.h include should be grouped with the other clang includes. I'd recommend deleting this empty line and letting clang-format sort the includes for you.

This revision is now accepted and ready to land.Sep 27 2022, 8:40 AM
  • Fix includes
Michael137 marked an inline comment as done.Sep 27 2022, 10:02 AM
Michael137 added inline comments.
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
41

Thanks, done

This revision was landed with ongoing or failed builds.Sep 27 2022, 10:04 AM
This revision was automatically updated to reflect the committed changes.
Michael137 marked an inline comment as done.