mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 13:50:10 +01:00
NOLINT and document use of StringLiteral::data() which subclasses StringRef (#7757)
StringRef::data() is problematic to call, but StringLiteral is always NUL-terminated, so data() gives a valid C string.
This commit is contained in:
@@ -487,6 +487,9 @@ auto Emitter<LocT>::Builder::FormatFn(const Message& message,
|
||||
"Argument count mismatch on {0}: {1} != {2}", message.kind,
|
||||
message.format_args.size(), sizeof...(Args));
|
||||
return llvm::formatv(
|
||||
// `format` is a StringLiteral which is always NUL terminated, so data()
|
||||
// is okay here. Too bad there's no c_str() method available.
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
|
||||
message.format.data(),
|
||||
llvm::any_cast<
|
||||
typename Internal::DiagnosticTypeForArg<Args>::StorageType>(
|
||||
|
||||
Reference in New Issue
Block a user