aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2024-02-16 16:26:14 -0800
committerGitHub <noreply@github.com>2024-02-16 16:26:14 -0800
commit4bb0ca655bb65aae0a1d251ba5053aadff678101 (patch)
tree41c63dd505c494cd7b99d5ece74b637e9192c5bd /clang/lib/CodeGen/CodeGenModule.cpp
parent3d67cf681a728e4cf0ab9947c0dd07539dda8b74 (diff)
downloadllvm-4bb0ca655bb65aae0a1d251ba5053aadff678101.zip
llvm-4bb0ca655bb65aae0a1d251ba5053aadff678101.tar.gz
llvm-4bb0ca655bb65aae0a1d251ba5053aadff678101.tar.bz2
[Support] Introduce formatv variant of createStringError (#80493)
Many times I have found myself wanting to create a StringError with the ability to interpolate a StringRef into the error string. This can be achieved with: StringRef Foo("..."); auto Err = createStringError(..., "Something went wrong: %s", Foo.str().c_str()); However, this requires us to construct a temporary std::string (which may perform a memory allocation if large enough). I propose a new variant of `createStringError` called `createStringErrorV` which uses `formatv` under the hood. This allows the above example to become: StringRef Foo("..."); auto Err = createStringErrorV(..., "Something went wrong: {0}", Foo);
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions