[clang-tools-extra] [clang-tidy] modernize-use-std-print, format: Fix checks with Abseil functions (PR #142312)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 9 01:55:40 PDT 2025
================
@@ -207,13 +207,9 @@ FormatStringConverter::FormatStringConverter(
ArgsOffset(FormatArgOffset + 1), LangOpts(LO) {
assert(ArgsOffset <= NumArgs);
FormatExpr = llvm::dyn_cast<StringLiteral>(
- Args[FormatArgOffset]->IgnoreImplicitAsWritten());
+ Args[FormatArgOffset]->IgnoreUnlessSpelledInSource());
- if (!FormatExpr || !FormatExpr->isOrdinary()) {
- // Function must have a narrow string literal as its first argument.
- conversionNotPossible("first argument is not a narrow string literal");
- return;
- }
+ assert(FormatExpr && FormatExpr->isOrdinary());
----------------
vbvictor wrote:
Why do we assert that `FormatExpr->isOrdinary()`?
AFAIK when we have `large_strprintf(L"");` this `assert` should fire because string is wide.
https://github.com/llvm/llvm-project/pull/142312
More information about the cfe-commits
mailing list