[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:

The URL with anchor https://docs.kernel.org/core-api/printk-formats.html#pointer-types may be more precise to use in the comment.

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


More information about the cfe-commits mailing list