Skip to content

Commit 0fad686

Browse files
Georges Berengerfacebook-github-bot
Georges Berenger
authored andcommitted
Don't include FactoryHelper.hpp more than once
Summary: FactoryHelper.hpp is expensive, with generated code for DataLayout. We should not include it more than strictly necessary. This diff removes unwarranted includes and adds fake function to break linking if it's included more than once. Reviewed By: finik Differential Revision: D74044527 fbshipit-source-id: 1f6a7a20a51f0f9ad6a72fda12da77d341030c9a
1 parent 2fd8f8e commit 0fad686

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

csrc/reader/FactoryHelper.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,11 @@ DEFINE_DATA_PIECE(Vector, string)
181181
DEFINE_DATA_PIECE(StringMap, string)
182182

183183
} // namespace
184+
185+
namespace pyvrs {
186+
// To prevent the inclusion of this expensive header in more than one file, this function should
187+
// trigger a linker error if included more than once
188+
int singleIncludeBreakCheck() {
189+
return 0;
190+
}
191+
} // namespace pyvrs

csrc/reader/MultiVRSReader.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "../utils/PyExceptions.h"
4646
#include "../utils/PyRecord.h"
4747
#include "../utils/PyUtils.h"
48-
#include "FactoryHelper.hpp"
4948

5049
using UniqueStreamId = vrs::MultiRecordFileReader::UniqueStreamId;
5150

0 commit comments

Comments
 (0)