gfe-relnote: (n/a) Change SetQuicFlag to take the flag variable directly instead of a pointer to it. Refactor for Envoy integration, no behavior change.

This is needed for Envoy integration because the current syntax(SetQuicFlag(&FLAG_foo)) requires FLAG_foo is a valid c++ identifier, which is not the case in Envoy.

PiperOrigin-RevId: 246196929
Change-Id: I7d56b23f0fa51fcdd17acc0837508710316a6826
diff --git a/quic/core/congestion_control/pacing_sender_test.cc b/quic/core/congestion_control/pacing_sender_test.cc
index ea9debf..4e4c401 100644
--- a/quic/core/congestion_control/pacing_sender_test.cc
+++ b/quic/core/congestion_control/pacing_sender_test.cc
@@ -388,8 +388,8 @@
 
 TEST_F(PacingSenderTest, LumpyPacingWithInitialBurstToken) {
   // Set lumpy size to be 3, and cwnd faction to 0.5
-  SetQuicFlag(&FLAGS_quic_lumpy_pacing_size, 3);
-  SetQuicFlag(&FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
+  SetQuicFlag(FLAGS_quic_lumpy_pacing_size, 3);
+  SetQuicFlag(FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
   // Configure pacing rate of 1 packet per 1 ms.
   InitPacingRate(
       10, QuicBandwidth::FromBytesAndTimeDelta(
@@ -442,8 +442,8 @@
 
 TEST_F(PacingSenderTest, NoLumpyPacingForLowBandwidthFlows) {
   // Set lumpy size to be 3, and cwnd faction to 0.5
-  SetQuicFlag(&FLAGS_quic_lumpy_pacing_size, 3);
-  SetQuicFlag(&FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
+  SetQuicFlag(FLAGS_quic_lumpy_pacing_size, 3);
+  SetQuicFlag(FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
   SetQuicReloadableFlag(quic_no_lumpy_pacing_at_low_bw, true);
 
   // Configure pacing rate of 1 packet per 100 ms.
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 194d5ce..7179513 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -135,7 +135,7 @@
   // handshake protocol). So these tests need to ensure that clients are never
   // attempting to do 0-RTT across incompatible versions. Chromium only
   // supports a single version at a time anyway. :)
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, use_tls_handshake);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, use_tls_handshake);
   ParsedQuicVersionVector all_supported_versions =
       FilterSupportedVersions(AllSupportedVersions());
 
@@ -286,7 +286,7 @@
         support_server_push_(false),
         override_connection_id_(nullptr),
         expected_connection_id_length_(kQuicDefaultConnectionIdLength) {
-    SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+    SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
     SetQuicRestartFlag(quic_no_server_conn_ver_negotiation2, true);
     SetQuicReloadableFlag(quic_no_client_conn_ver_negotiation, true);
     client_supported_versions_ = GetParam().client_supported_versions;
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index fe74768..85ec46b 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -868,7 +868,7 @@
 // Constructs various test permutations.
 std::vector<TestParams> GetTestParams() {
   QuicFlagSaver flags;
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   std::vector<TestParams> params;
   ParsedQuicVersionVector all_supported_versions = AllSupportedVersions();
   for (size_t i = 0; i < all_supported_versions.size(); ++i) {
@@ -928,7 +928,7 @@
         packet_number_length_(PACKET_4BYTE_PACKET_NUMBER),
         connection_id_included_(CONNECTION_ID_PRESENT),
         notifier_(&connection_) {
-    SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+    SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
     connection_.set_defer_send_in_response_to_packets(GetParam().ack_response ==
                                                       AckResponse::kDefer);
     QuicFramerPeer::SetLastSerializedConnectionId(
diff --git a/quic/core/quic_crypto_client_stream_test.cc b/quic/core/quic_crypto_client_stream_test.cc
index a321ec2..0cb130e 100644
--- a/quic/core/quic_crypto_client_stream_test.cc
+++ b/quic/core/quic_crypto_client_stream_test.cc
@@ -97,7 +97,7 @@
 }
 
 TEST_F(QuicCryptoClientStreamTest, ConnectedAfterTlsHandshake) {
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   supported_versions_.clear();
   for (QuicTransportVersion transport_version :
        AllSupportedTransportVersions()) {
diff --git a/quic/core/quic_crypto_server_stream_test.cc b/quic/core/quic_crypto_server_stream_test.cc
index 6a4eaf9..e01414b 100644
--- a/quic/core/quic_crypto_server_stream_test.cc
+++ b/quic/core/quic_crypto_server_stream_test.cc
@@ -215,7 +215,7 @@
 }
 
 TEST_P(QuicCryptoServerStreamTest, ConnectedAfterTlsHandshake) {
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   client_options_.only_tls_versions = true;
   supported_versions_.clear();
   for (QuicTransportVersion transport_version :
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index f280717..89befc5 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -195,7 +195,7 @@
       : QuicDispatcherTest(crypto_test_utils::ProofSourceForTesting()) {}
 
   ParsedQuicVersionVector AllSupportedVersionsIncludingTls() {
-    SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+    SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
     return AllSupportedVersions();
   }
 
@@ -380,7 +380,7 @@
     // TLS is only supported in versions 47 and greater.
     return;
   }
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
 
   EXPECT_CALL(*dispatcher_,
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 0437118..a717168 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -430,7 +430,7 @@
 
 ParsedQuicVersionVector AllSupportedVersionsIncludingTls() {
   QuicFlagSaver flags;
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   return AllSupportedVersions();
 }
 
@@ -445,7 +445,7 @@
                 start_,
                 Perspective::IS_SERVER,
                 kQuicDefaultConnectionIdLength) {
-    SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+    SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
     framer_.set_version(version_);
     if (framer_.version().KnowsWhichDecrypterToUse()) {
       framer_.InstallDecrypter(ENCRYPTION_INITIAL,
diff --git a/quic/core/quic_stream_send_buffer_test.cc b/quic/core/quic_stream_send_buffer_test.cc
index 57e2bd1..3a5efb5 100644
--- a/quic/core/quic_stream_send_buffer_test.cc
+++ b/quic/core/quic_stream_send_buffer_test.cc
@@ -48,7 +48,7 @@
               QuicStreamSendBufferPeer::CurrentWriteSlice(&send_buffer_));
 
     // Save all data.
-    SetQuicFlag(&FLAGS_quic_send_buffer_max_data_slice_size, 1024);
+    SetQuicFlag(FLAGS_quic_send_buffer_max_data_slice_size, 1024);
     send_buffer_.SaveStreamData(iov, 2, 0, 2048);
     send_buffer_.SaveMemSlice(std::move(slice1));
     EXPECT_TRUE(slice1.empty());
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc
index b9d97a1..bfe88f7 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -956,7 +956,7 @@
 }
 
 TEST_P(QuicStreamTest, CanWriteNewDataAfterData) {
-  SetQuicFlag(&FLAGS_quic_buffered_data_threshold, 100);
+  SetQuicFlag(FLAGS_quic_buffered_data_threshold, 100);
   Initialize();
   EXPECT_TRUE(stream_->CanWriteNewDataAfterData(99));
   EXPECT_FALSE(stream_->CanWriteNewDataAfterData(100));
@@ -964,7 +964,7 @@
 
 TEST_P(QuicStreamTest, WriteBufferedData) {
   // Set buffered data low water mark to be 100.
-  SetQuicFlag(&FLAGS_quic_buffered_data_threshold, 100);
+  SetQuicFlag(FLAGS_quic_buffered_data_threshold, 100);
   // Do not stream level flow control block this stream.
   set_initial_flow_control_window_bytes(500000);
 
@@ -1098,7 +1098,7 @@
 
 TEST_P(QuicStreamTest, WriteMemSlices) {
   // Set buffered data low water mark to be 100.
-  SetQuicFlag(&FLAGS_quic_buffered_data_threshold, 100);
+  SetQuicFlag(FLAGS_quic_buffered_data_threshold, 100);
   // Do not flow control block this stream.
   set_initial_flow_control_window_bytes(500000);
 
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 8168a6a..62f0218 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -408,14 +408,14 @@
     return;
   }
 
-  SetQuicFlag(&FLAGS_quic_ietf_draft_version, draft_version);
+  SetQuicFlag(FLAGS_quic_ietf_draft_version, draft_version);
 
   if (draft_version == 0) {
     return;
   }
 
   // Enable necessary flags.
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   SetQuicReloadableFlag(quic_deprecate_ack_bundling_mode, true);
   SetQuicReloadableFlag(quic_rpm_decides_when_to_send_acks, true);
   SetQuicReloadableFlag(quic_use_uber_loss_algorithm, true);
@@ -427,7 +427,7 @@
 
 void QuicEnableVersion(ParsedQuicVersion parsed_version) {
   if (parsed_version.handshake_protocol == PROTOCOL_TLS1_3) {
-    SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+    SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   }
   static_assert(QUIC_ARRAYSIZE(kSupportedTransportVersions) == 6u,
                 "Supported versions out of sync");
diff --git a/quic/core/quic_versions_test.cc b/quic/core/quic_versions_test.cc
index 4201e43..e94a3da 100644
--- a/quic/core/quic_versions_test.cc
+++ b/quic/core/quic_versions_test.cc
@@ -116,11 +116,11 @@
   }
 
   // Test a TLS version:
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   QuicTag tls_tag = MakeQuicTag('3', '4', '0', 'T');
   EXPECT_EQ(PROTOCOL_TLS1_3, QuicVersionLabelToHandshakeProtocol(tls_tag));
 
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   if (QUIC_DLOG_INFO_IS_ON()) {
     EXPECT_QUIC_LOG_CALL_CONTAINS(log, INFO,
                                   "Unsupported QuicVersionLabel version: T043")
@@ -142,7 +142,7 @@
             ParseQuicVersionLabel(MakeVersionLabel('Q', '0', '4', '7')));
 
   // Test a TLS version:
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_39),
             ParseQuicVersionLabel(MakeVersionLabel('T', '0', '3', '9')));
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_43),
@@ -154,7 +154,7 @@
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_47),
             ParseQuicVersionLabel(MakeVersionLabel('T', '0', '4', '7')));
 
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   EXPECT_EQ(UnsupportedQuicVersion(),
             ParseQuicVersionLabel(MakeVersionLabel('T', '0', '3', '5')));
   EXPECT_EQ(UnsupportedQuicVersion(),
@@ -188,7 +188,7 @@
   EXPECT_EQ(UnsupportedQuicVersion(), ParseQuicVersionString("Q047 "));
 
   // Test a TLS version:
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_39),
             ParseQuicVersionString("T039"));
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_43),
@@ -200,7 +200,7 @@
   EXPECT_EQ(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_47),
             ParseQuicVersionString("T047"));
 
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   EXPECT_EQ(UnsupportedQuicVersion(), ParseQuicVersionString("T035"));
   EXPECT_EQ(UnsupportedQuicVersion(), ParseQuicVersionString("T039"));
   EXPECT_EQ(UnsupportedQuicVersion(), ParseQuicVersionString("T043"));
@@ -228,7 +228,7 @@
                 ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_47)));
 
   // Test a TLS version:
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   EXPECT_EQ(MakeVersionLabel('T', '0', '3', '9'),
             CreateQuicVersionLabel(
                 ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_39)));
@@ -245,7 +245,7 @@
             CreateQuicVersionLabel(
                 ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_47)));
 
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   EXPECT_EQ(UnsupportedQuicVersion(),
             ParseQuicVersionLabel(MakeVersionLabel('T', '0', '3', '5')));
   EXPECT_EQ(UnsupportedQuicVersion(),
@@ -323,7 +323,7 @@
 
   // Make sure that all supported versions are present in
   // ParsedQuicVersionToString.
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   for (QuicTransportVersion transport_version : kSupportedTransportVersions) {
     for (HandshakeProtocol protocol : kSupportedHandshakeProtocols) {
       EXPECT_NE("0", ParsedQuicVersionToString(
@@ -557,14 +557,14 @@
 }
 
 TEST_F(QuicVersionsTest, AlpnForVersion) {
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   ParsedQuicVersion parsed_version_q047 =
       ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_47);
   ParsedQuicVersion parsed_version_t047 =
       ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_47);
   ParsedQuicVersion parsed_version_t099 =
       ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99);
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
 
   EXPECT_EQ("h3-google-Q047", AlpnForVersion(parsed_version_q047));
   EXPECT_EQ("h3-google-T047", AlpnForVersion(parsed_version_t047));
@@ -572,10 +572,10 @@
 }
 
 TEST_F(QuicVersionsTest, InitializeSupportForIetfDraft) {
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   ParsedQuicVersion parsed_version_t099 =
       ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99);
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   EXPECT_EQ(MakeVersionLabel('T', '0', '9', '9'),
             CreateQuicVersionLabel(parsed_version_t099));
   EXPECT_EQ("h3-google-T099", AlpnForVersion(parsed_version_t099));
@@ -599,14 +599,14 @@
 }
 
 TEST_F(QuicVersionsTest, QuicEnableVersion) {
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   ParsedQuicVersion parsed_version_q047 =
       ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_47);
   ParsedQuicVersion parsed_version_t047 =
       ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_47);
   ParsedQuicVersion parsed_version_t099 =
       ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99);
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, false);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, false);
   SetQuicReloadableFlag(quic_disable_version_39, false);
   SetQuicReloadableFlag(quic_enable_version_43, true);
   SetQuicReloadableFlag(quic_enable_version_44, true);
diff --git a/quic/core/tls_handshaker_test.cc b/quic/core/tls_handshaker_test.cc
index a7b2aa8..f0b8e84 100644
--- a/quic/core/tls_handshaker_test.cc
+++ b/quic/core/tls_handshaker_test.cc
@@ -265,7 +265,7 @@
 
 ParsedQuicVersionVector AllTlsSupportedVersions() {
   SetQuicReloadableFlag(quic_enable_version_99, true);
-  SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+  SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   ParsedQuicVersionVector supported_versions;
   for (QuicTransportVersion version : kSupportedTransportVersions) {
     if (!QuicVersionUsesCryptoFrames(version)) {
diff --git a/quic/quartc/quartc_factory.cc b/quic/quartc/quartc_factory.cc
index 436212f..f01aa48 100644
--- a/quic/quartc/quartc_factory.cc
+++ b/quic/quartc/quartc_factory.cc
@@ -68,7 +68,7 @@
 
   // Ensure that we don't drop data because QUIC streams refuse to buffer it.
   // TODO(b/120099046):  Replace this with correct handling of WriteMemSlices().
-  SetQuicFlag(&FLAGS_quic_buffered_data_threshold,
+  SetQuicFlag(FLAGS_quic_buffered_data_threshold,
               std::numeric_limits<int>::max());
 
   // TODO(b/117157454): Perform version negotiation for Quartc outside of
diff --git a/quic/tools/quic_client_bin.cc b/quic/tools/quic_client_bin.cc
index ee8262f..27fe8e7 100644
--- a/quic/tools/quic_client_bin.cc
+++ b/quic/tools/quic_client_bin.cc
@@ -250,7 +250,7 @@
   if (quic_version_string.length() > 0) {
     if (quic_version_string[0] == 'T') {
       // ParseQuicVersionString checks quic_supports_tls_handshake.
-      SetQuicFlag(&FLAGS_quic_supports_tls_handshake, true);
+      SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
     }
     quic::ParsedQuicVersion parsed_quic_version =
         quic::ParseQuicVersionString(quic_version_string);