[clang] Suppress octal literal diagnostics from system macros (PR #192481)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 09:27:43 PDT 2026


================
@@ -1429,7 +1429,11 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
       DiagId = diag::ext_cpp_octal_literal;
     else
       DiagId = diag::ext_octal_literal;
-    Diags.Report(TokLoc, DiagId);
+    // If the token location is from a macro expansion where the macro was
+    // defined in a system header, suppress the diagnostic.
+    if (!SM.isInSystemMacro(TokLoc))
----------------
AaronBallman wrote:

Sure, I added a test case to demonstrate it.

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


More information about the cfe-commits mailing list