Page MenuHomePhabricator

Improve looking up functions with equivalent mangled names.
Needs RevisionPublic

Authored by sivachandra on Feb 25 2016, 10:58 AM.

Details

Reviewers
spyffe
Summary

This, in a way, extends the existing "workaroud" by matching function
argument type names individually [instead of just matching "(args1...)"
with "(args2...)"]. For type name matching, a new method
CPlusPlusLanguage::TypeNamesEqual has been added. For now, this method
can only handle variations like:

<typename> * vs <typename>*
const <typename> vs <typename> const
const <typename> * const vs <typename> const * const

We can extend it to handle more complex name formats as needed.

The immediate benefit of this change is with evaluating std::map's
subscript operator when producer is GCC. Consider the following:

std::map<std::string, std::string> m;
std::string s("1");
m[s] = "one";
... ; // Break here

The command "expr m[s]" fails without this change if the producer is
GCC.

Diff Detail

Event Timeline

sivachandra retitled this revision from to Improve looking up functions with equivalent mangled names..
sivachandra updated this object.
sivachandra added reviewers: spyffe, clayborg.
sivachandra added a subscriber: lldb-commits.

Fix a comment in file, fix formatting in another.

Add more gtest unittests.

clayborg resigned from this revision.Feb 26 2016, 10:03 AM
clayborg removed a reviewer: clayborg.

Sean should be the one to OK this.

spyffe requested changes to this revision.Jul 11 2016, 11:29 AM
spyffe edited edge metadata.

I'm concerned about the performance implications here, because FindBestAlternateMangledName is invoked for every C++ symbol lookup, not just for ones that would fail unless we did this workaround.

We have a ColectFallbackNames function in IRExecutionUnit.cpp to try hackier approaches if the simple approaches don't work. Would it be feasible to make this farily heavyweight search part of the fallback names mechanism?

This revision now requires changes to proceed.Jul 11 2016, 11:29 AM