[clang] [clang][Sema] Stop format size estimator upon %p to adapt to linux kernel's extension (PR #65969)
Nick Desaulniers via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 12 09:23:28 PDT 2023
================
@@ -851,6 +851,50 @@ class ScanfDiagnosticFormatHandler
}
};
+/// `I` points to the next character of `%p` format.
+/// This functon checks if the subsequent character can be linux kernel's
+/// extnded format specifier
+static inline constexpr bool canBeLinuxFormatExtension(const char *I,
+ const char *E) {
+ assert(I < E && "format string not yet exhausted");
+ // Kernel Document: https://docs.kernel.org/core-api/printk-formats.html
+ switch (*I) {
----------------
nickdesaulniers wrote:
I think it would also be helpful to say something along the lines of:
see the `pointer()` function in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/vsprintf.c.
https://github.com/llvm/llvm-project/pull/65969
More information about the cfe-commits
mailing list