[PATCH] D83837: [LLVM] Fix handling of escaped closing brace `}` in `formatv` (under an option)

Rahul Joshi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 18:03:04 PDT 2020


jurahul created this revision.
Herald added subscribers: llvm-commits, hiraditya, eraman.
Herald added a project: LLVM.

- formatv was not handling closing braces as documented and treating them as unescaped. This also means that cases like "{{}}" would, post-formatting, be "{}}" which is not correct per the documented behavior.
- Fix the string parsing and analysis code to treat closing braces as requiring escape and assert of we find a closing brace not paired with an opening one.
- Unfortunately, many tests and code rely on the existing behavior, so introduce a FormatEscapeMode enum to switch between existing (legacy) and new (strict) mode. Also added a formatv_strict() function corresponding to the standalone formatv() function.
- Update some existing unit tests that to use strict mode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83837

Files:
  llvm/include/llvm/Support/FormatVariadic.h
  llvm/lib/Support/FormatVariadic.cpp
  llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp
  llvm/unittests/Support/FormatVariadicTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83837.278033.patch
Type: text/x-patch
Size: 14150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/7d4a667f/attachment.bin>


More information about the llvm-commits mailing list