[clang] [clang][AST] fix ast-print of `extern <lang>` with >=2 declarators (PR #93131)

Artem Yurchenko via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 13:16:55 PDT 2024


================
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -ast-print %s -o - | FileCheck %s
+
+// CHECK: extern "C" int printf(const char *, ...);
+extern "C" int printf(const char *...);
+
+// CHECK: extern "C++" {
----------------
temyurchenko wrote:

> ideally, we want to reproduce exactly what was in the user's source to avoid accidentally changing the meaning of code

Do you know why we split declarators from the same declaration into several declarations, whenever possible? Judging by the comments in `DeclPrinter::visitDeclContext` it seems intentional and desired.

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


More information about the cfe-commits mailing list