[Lldb-commits] [PATCH] D70775: [lldb] Add MockTypeSystem and some basic unit test for CompilerType

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 27 05:30:18 PST 2019


teemperor updated this revision to Diff 231226.
teemperor added a comment.

I tried moving this to gmock, but after an hour of not being able to even declare a simple virtual method due to issues like this <https://github.com/google/googletest/issues/533> I don't think this approach is really practical. gmock is a nightmare to debug with all these completely undocumented macros. If gmock was actually documented and would work, then I think we should use it. But at the current state I can't even get it to compile code it seems without having to diagnostic-disable hacks, so that's a no-go

Also we anyway also want to model things like fake type hierarchies that one can traverse via CompilerType/TypeSystem (e.g. when doing completions like in the Variable completion code), so simple mocking is anyway not really the right fit.

Changes:

- Renamed MockTypeSystem -> FakeTypeSystem to reflect that this is not just mocking.
- Moved TestingSupport library to its own subdirectory and library that links against Symbol.
- Replaced `llvm_unreachable` in the unimplemented functions with macro to make migration easier if someone has a better approach to handling them.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70775/new/

https://reviews.llvm.org/D70775

Files:
  lldb/unittests/Symbol/CMakeLists.txt
  lldb/unittests/Symbol/CompilerTypeTest.cpp
  lldb/unittests/TestingSupport/CMakeLists.txt
  lldb/unittests/TestingSupport/Symbol/CMakeLists.txt
  lldb/unittests/TestingSupport/Symbol/FakeTypeSystem.cpp
  lldb/unittests/TestingSupport/Symbol/FakeTypeSystem.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70775.231226.patch
Type: text/x-patch
Size: 17160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191127/02361c8a/attachment.bin>


More information about the lldb-commits mailing list