This is an archive of the discontinued LLVM Phabricator instance.

[gdb] Decay type before passing into printer
Needs ReviewPublic

Authored by LeszekSwirski on May 14 2020, 1:03 AM.

Details

Summary

The existing gdb printer logic didn't work for const types, references, or typedefs. Now we strip const, references, and typedefs, before doing any of the matching checks or printer lookup.

Diff Detail

Repository
rCXX libc++

Event Timeline

LeszekSwirski created this revision.May 14 2020, 1:03 AM

Is there a more correct reviewer to send this to?

This is puzzling to me, as we use this internally at Google all over the place, and it seems to work just fine. So I'm surprised we haven't noticed anything.

Could you provide a test that fails before this change, and works afterward? Should be easy to add.

I'll add a test -- the failure I had (on the V8 codebase) was with a std::vector<Foo> that was typedefed to FooVector, and then passed around by const ref. Since the typedef wasn't stripped, afair it didn't even make it past the "^std::" check.