)]}' { "commit": "49b596fed3763d72b549eb11cf9d9d0a05ce6318", "tree": "ce815a6ef213137a315d4a1bee3fcac463ed1b49", "parents": [ "69ab51cce8a8d2b93abe13b93c97ddbbe256adff" ], "author": { "name": "Nathan Sidwell", "email": "nathan@acm.org", "time": "Mon Feb 28 10:13:44 2022 -0800" }, "committer": { "name": "Copybara-Service", "email": "copybara-worker@google.com", "time": "Tue Apr 26 04:26:04 2022 -0700" }, "message": "[demangler] Simplify OutputBuffer initialization\n\nEvery non-testcase use of OutputBuffer contains code to allocate an\ninitial buffer (using either 128 or 1024 as initial guesses). There\u0027s\nnow no need to do that, given recent changes to the buffer extension\nheuristics -- it allocates a 1k(ish) buffer on first need.\n\nJust pass in a buffer (if any) to the constructor. Thus the\nOutputBuffer\u0027s ownership of the buffer starts at its own lifetime\nstart. We can reduce the lifetime of this object in several cases.\n\nThat new constructor takes a \u0027size_t *\u0027 for the size argument, as all\nuses with a non-null buffer are passing through a malloc\u0027d buffer from\ntheir own caller in this manner.\n\nThe buffer reset member function is never used, and is deleted.\n\nThe original buffer initialization code would return a failure code if\nthat first malloc failed. Existing code either ignored that, called\nstd::terminate with a FIXME, or returned an error code.\n\nBut that\u0027s not foolproof anyway, as a subsequent buffer extension\nfailure ends up calling std::terminate. I am working on addressing\nthat unfortunate failure mode in a manner more consistent with the C++\nABI design.\n\nReviewed By: dblaikie\n\nDifferential Revision: https://reviews.llvm.org/D122604\n\nGitOrigin-RevId: 5b3ca24a35e91bf9c19af856e7f92c69b17f989e\n", "tree_diff": [ { "type": "modify", "old_id": "ddab6d33358a5768973d36e3b3b0c1b6ed9a7436", "old_mode": 33188, "old_path": "src/cxa_demangle.cpp", "new_id": "7baac680074ce3e7fe035ea4c3d586e8de5d082c", "new_mode": 33188, "new_path": "src/cxa_demangle.cpp" }, { "type": "modify", "old_id": "6e0fa38632c89f60933e4c53de347c9ee0481762", "old_mode": 33188, "old_path": "src/demangle/Utility.h", "new_id": "00572880237a0c4c3e0be54d02379dd49e1188ae", "new_mode": 33188, "new_path": "src/demangle/Utility.h" } ] }