[clang] [clang][dataflow] Change `diagnoseFunction` to take type of diagnostic list instead of diagnostic itself. (PR #66014)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 00:14:54 PDT 2023


martinboehme wrote:

I'm not convinced of the value of this change. Wouldn't it be simpler to keep the template arguments of `diagnoseFunction()` unchanged and instead change the return type to be `llvm::Expected<llvm::SmallVector<Diagnostic>>`? In other words, always return an `llvm::SmallVector` instead of a `std::vector`?

I think `llvm::SmallVector` makes sense for both callsites that currently exist (and ones that we might add in the future). This patch currently lets `UncheckedOptionalAccessCheck::check()` continue to use `std::vector`, but I think `llvm::SmallVector` makes sense there as well, as in the common case, we expect only a small number of diagnostics or none at all. This seems like it would be true for any function that wants to call `diagnoseFunction()` in the future as well.

https://github.com/llvm/llvm-project/pull/66014


More information about the cfe-commits mailing list