)]}'
{
  "commit": "83f7766d7ad7636a945387082d1d8a581e0e0c61",
  "tree": "6668bd292be6b01b9c3390a0a2ef0d04a0c826a0",
  "parents": [
    "88554d6ebdf575ca6c04264903f1fa322cde3bfa"
  ],
  "author": {
    "name": "QUICHE team",
    "email": "quiche-dev@google.com",
    "time": "Tue May 26 05:14:52 2020 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Tue May 26 05:15:20 2020 -0700"
  },
  "message": "Fix errors found by Clang warning -Wdangling-gsl\n\nThis warning detects when pointers are owned by an object, but that object is deleted at the end of a statement.  Since the pointer is to freed memory, accessing the pointer may produce unexpected results.\n\nFor more information on this cleanup: go/cleanup-wdangling-gsl\n\nExamples:\n\nstd::unique_ptr\u003cint\u003e getPtr();\nvoid foo() {\nint* ptr \u003d getPtr().get();\n// The unique_ptr owns the pointer, but the unique_ptr’s lifetime ends\n// at the end of the statement.\n\nstd::unique_ptr\u003cint\u003e owned \u003d getPtr();\nint* ptr \u003d owned.get();\n// Capturing the unique_ptr will keep the pointer valid as long as\n// the unique_ptr is in scope.\n}\n\nstd::string getString();\nvoid foo() {\nabsl::string_view str \u003d getString();\n// string_view does not own the backing data, so it is only valid until\n// the end of the statement, where the std::string is destroyed.\n\nstd::string str \u003d getString();\n// Capture the string to a local variable.\n\n// Alternatively, make getString() return a string reference, if the\n// string’s lifetime extends beyond the function getString.\n}\n\nconst std::string\u0026 getString();\nvoid foo(bool b) {\nabsl::string_view str \u003d b ? getString() : “default”;\n// Initializing a string_view with either a const string reference\n// or a string literal would be valid.  However, the conditional\n// operator forces the two operands to have the same type first.\n// Explicitly writing this out would be:\n//     absl::string_view str \u003d b ? getString()\n//                               : std::string(“default”);\n// The string constructed from the string literal gets destroyed\n// at the end of the statement.\n\nabsl::string_view str b ? absl::string_view(getString())\n: absl::string_view(“default”);\n// Use string_view constructors instead.\n}\n\nstd::vector\u003cstd::string\u003e getVector();\nvoid foo() {\nconst std::string\u0026 str \u003d getVector()[0];\n// Container access will return a reference to elements.  When\n// the returned container is deleted, the references to its\n// elements are invalid.\n\nconst std::string str \u003d getVector()[0];\n// Make a copy of the container element.\n\nstd::vector\u003cstd::string\u003e vector \u003d getVector();\nconst std::string\u0026 str \u003d vector[0];\n// Save the returned container.\n\n// Alternatively, make getVector return a reference to the container\n// if the returned container outlives the function call.\n}\n\nFor more information on this cleanup: go/cleanup-wdangling-gsl\n\nTested:\nTAP --sample ran all affected tests and none failed\nhttp://test/OCL:312589380:BASE:312637687:1590054022610:cb8287b\nPiperOrigin-RevId: 313171633\nChange-Id: I6cd6f0e8a7acab0bbdc4383f5a9b04feea6876f4\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "52278f7c911534e8eb047b1de8a737fcf1abdbb9",
      "old_mode": 33188,
      "old_path": "quic/core/quic_versions_test.cc",
      "new_id": "1ca9fae1ccac27dd4521e4ae246606db51c305b8",
      "new_mode": 33188,
      "new_path": "quic/core/quic_versions_test.cc"
    },
    {
      "type": "modify",
      "old_id": "ba57ad02bb9ce0b5eb455b24aea9083308dae9cd",
      "old_mode": 33188,
      "old_path": "quic/core/tls_chlo_extractor_test.cc",
      "new_id": "955e58c0ee62438ce0982fdb89ede3e3351315ce",
      "new_mode": 33188,
      "new_path": "quic/core/tls_chlo_extractor_test.cc"
    },
    {
      "type": "modify",
      "old_id": "94bf1add1e7f560bacfa12abfa4dd31aa8d970ca",
      "old_mode": 33188,
      "old_path": "quic/quartc/quartc_fakes.h",
      "new_id": "774cd090ca7192380a7cc325cc20fbe03d95de6f",
      "new_mode": 33188,
      "new_path": "quic/quartc/quartc_fakes.h"
    }
  ]
}
