From 720d13f5d2e0b9c198514dec76a645ecb40bf5d4 Mon Sep 17 00:00:00 2001 From: Vladimir Still Date: Wed, 22 Nov 2023 01:35:16 -0800 Subject: [PATCH] Avoid extra copies --- test/gtest/helpers.cpp | 2 +- test/gtest/helpers.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/gtest/helpers.cpp b/test/gtest/helpers.cpp index 199e3a374a..5270d04e02 100644 --- a/test/gtest/helpers.cpp +++ b/test/gtest/helpers.cpp @@ -154,7 +154,7 @@ namespace Test { const std::string &source, CompilerOptions::FrontendVersion langVersion /* = CompilerOptions::FrontendVersion::P4_16 */, - P4::ParseAnnotations parseAnnotations + const P4::ParseAnnotations &parseAnnotations /* = P4::ParseAnnotations() */) { auto *program = P4::parseP4String(source, langVersion); if (program == nullptr) { diff --git a/test/gtest/helpers.h b/test/gtest/helpers.h index debf219393..a3efa4b0a0 100644 --- a/test/gtest/helpers.h +++ b/test/gtest/helpers.h @@ -116,10 +116,10 @@ struct FrontendTestCase { /// Create a test case that only requires the frontend to run. static std::optional create( const std::string &source, CompilerOptions::FrontendVersion langVersion = defaultVersion, - P4::ParseAnnotations parseAnnotations = P4::ParseAnnotations()); + const P4::ParseAnnotations &parseAnnotations = P4::ParseAnnotations()); static std::optional create(const std::string &source, - P4::ParseAnnotations parseAnnotations) { + const P4::ParseAnnotations &parseAnnotations) { return create(source, defaultVersion, parseAnnotations); }