Refactor the Facts code to avoid the use of templates all over.
commit5f00a684bbe19dfe54f9d19ddf53acbdfe2a4d16
authorBrett Chik <bchik@fb.com>
Thu, 9 Sep 2021 22:22:18 +0000 (9 15:22 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 9 Sep 2021 22:24:05 +0000 (9 15:24 -0700)
tree77c4c29b212f98f9757d70079e8a885753997e98
parentbf664575d24813a6c4229ef462e8f961acff9efd
Refactor the Facts code to avoid the use of templates all over.

Summary:
Facts code used templating to allow unit tests to swap in std::string for StringData, but this meant a lot of classes were templated that didn't really need to be and caused a ton of code to be in headers that could otherwise not be.

This change does several things:
- Removes all string related templating.
- Forward-declares StringData and doesn't require that it be linked in, similarly to how //runtime/base:runtime_core doesn't require some of it's prerequisites to be compiled in immediately.
- For production, links the StringData version of string pointer in and for unit tests does not link in an implementation of StringPtr.
- Creates an alternate implementation of StringData inside the symbol-map-test unit test that wraps a std::string, as well as appropriate methods of StringPtr for accessing this.

Reviewed By: jthemphill

Differential Revision: D30741297

fbshipit-source-id: f2dd905086eee7bf5abcd249632ecd25898f46e3
18 files changed:
hphp/runtime/ext/facts/attribute-argument-map.h
hphp/runtime/ext/facts/attribute-map.h
hphp/runtime/ext/facts/config.cmake
hphp/runtime/ext/facts/fact-extractor.cpp
hphp/runtime/ext/facts/facts-store.cpp
hphp/runtime/ext/facts/inheritance-info.h
hphp/runtime/ext/facts/path-methods-map.h
hphp/runtime/ext/facts/path-symbols-map.h
hphp/runtime/ext/facts/std-string-ptr.cpp [deleted file]
hphp/runtime/ext/facts/string-data-ptr.cpp
hphp/runtime/ext/facts/string-ptr.h
hphp/runtime/ext/facts/symbol-map-prod.cpp [deleted file]
hphp/runtime/ext/facts/symbol-map-unit.cpp [deleted file]
hphp/runtime/ext/facts/symbol-map.cpp [moved from hphp/runtime/ext/facts/symbol-map-defs.h with 69% similarity]
hphp/runtime/ext/facts/symbol-map.h
hphp/runtime/ext/facts/symbol-types.h
hphp/runtime/ext/facts/test/logging-test.cpp
hphp/runtime/ext/facts/test/symbol-map-test.cpp