MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / CreateConstantFoldingOptimizer

Function CreateConstantFoldingOptimizer

eval/compiler/constant_folding.cc:254–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252} // namespace
253
254ProgramOptimizerFactory CreateConstantFoldingOptimizer(
255 absl_nullable std::shared_ptr<google::protobuf::Arena> arena,
256 absl_nullable std::shared_ptr<google::protobuf::MessageFactory> message_factory) {
257 return
258 [shared_arena = std::move(arena),
259 shared_message_factory = std::move(message_factory)](
260 PlannerContext& context,
261 const Ast&) -> absl::StatusOr<std::unique_ptr<ProgramOptimizer>> {
262 // If one was explicitly provided during planning or none was explicitly
263 // provided during configuration, request one from the planning context.
264 // Otherwise use the one provided during configuration.
265 google::protobuf::Arena* absl_nonnull arena =
266 context.HasExplicitArena() || shared_arena == nullptr
267 ? context.MutableArena()
268 : shared_arena.get();
269 google::protobuf::MessageFactory* absl_nonnull message_factory =
270 context.HasExplicitMessageFactory() ||
271 shared_message_factory == nullptr
272 ? context.MutableMessageFactory()
273 : shared_message_factory.get();
274 return std::make_unique<ConstantFoldingExtension>(
275 context.descriptor_pool(), shared_arena, arena,
276 shared_message_factory, message_factory, context.type_reflector());
277 };
278}
279
280} // namespace cel::runtime_internal

Callers 7

TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_PFunction · 0.85
TESTFunction · 0.85

Calls 6

HasExplicitArenaMethod · 0.80
MutableArenaMethod · 0.80
getMethod · 0.45
MutableMessageFactoryMethod · 0.45
descriptor_poolMethod · 0.45

Tested by 5

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68